How can modules indicate to players that content is streamed?
Stuart Greenfield - April 14, 2009 - 21:11
| Project: | Embed |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
A common use would be for a player to be called to embed itself on the page, but the content is being streamed, rather than being loaded from a file.
Different players have different ways of receiving parameters, so this needs to be standardised within the embed module to make sure that modules interact properly.
Options
- Use another attribute, and unset it from the attributes array before rendering? Not very elegant, and modules that don't understand streamed content will have a surplus attribute.
- Use the #metadata property to indicate a stream? Not really the right use of metadata since streaming does not tell us something about what the object is, but it is to do with how we are going to render it.
- Use the #module_data array, perhaps #module_data['embed']['stream']? That seems reasonable since the fact we are streaming is something we are telling the embed module. By putting the data in here it never gets rendered but all modules can find it if they want it.
On balance using #module_data seems the best compromise, but not entirely sure.

#1
See #434724: Refactor the object element to handle type specific properties where it's proposed to set a few more "top level" properties for things like this, so streaming would be set in the property #stream.
#2
Current code on CVS is uses a property #object_data, with keys below that to define properties of the object that aren't HTML attributes. So to indicate streaming it assumes $element['#object_data']['stream'], if present, contains a value that is the path to the stream provider. It is up to the handler to use that data to render the stream properly. See the sample FlowPlayer module for details.