Custom player templates are available only for Video Cloud Pro and Enterprise customers. If you are interested in upgrading your Video Cloud account, please contact Brightcove for more information.
In a player template, you can use a simple binding to set the values of attributes, using the ID and properties of another object. The simple binding syntax looks like this:
<Element attribute="{component.object.property}" />
You can use the ! negation operator to bind to the inverse of a Boolean property. For example, this specifies that the component should be included in the layout if the video player is not in fullscreen mode:
includeInLayout="{!videoPlayer.fullscreen}"
The following table describes, for content-containing components, the objects that are available, together with all of their sub-properties:
| components | binding object | description |
|---|---|---|
| TabBar, List and TileList | selectedItem | The currently selected item. |
| ListItem | currentItem | The data that corresponds to the ListItem's position in its parent list. |
| VideoPlayer, VideoDisplay and ChromelessVideoPlayer | video selectedItem |
The video currently loaded in the player. |
| mediaDuration | The length of the video, in seconds. | |
| mediaPosition | The current position of the playhead, in seconds from the beginning. | |
| menu | Used primarily to bind to menu.open, which returns true or false based on the menu state. | |
| playbackType | The type of the current video:
1 = Live stream 2 = Bumper video 3 = Live stream with DVR |
|
| timeRemaining | The time remaining, in seconds from the end. | |
| playing | Is the video currently playing? A Boolean. |
To enable content assignment to these components and to enable other components to access these objects, the component must have a specific value for its id attribute:
id="playlistCombo"; to display a list of the videos in a single playlist, use id="videoCombo".You do not need to assign a data attribute to these components. Their data is assigned automatically through the id.
Note that the id attribute of any component in a template must be a unique value and that a player template can have only one instance of each of these components that uses these id attribute values: only a single VideoPlayer, ChromelessVideoPlayer, or VideoDisplay component can have id="videoPlayer"; only a single List or TileList component can have id="videoList"; and only a single TabBar component can have id="playlistTabs".
These simple bindings enable components to refer dynamically to important metadata relating to the playlists and videos loaded into the player. Let's look at an example in detail. This is a simple TitleLabel tag that can be found in many templates:
<TitleLabel width="160" height="40"
text="{videoPlayer.video.displayName}" />
Here, the text attribute of the label is videoPlayer.video.displayName. It is usually easiest to understand the data binding if you read it backwards. So, in this example, we are setting the text value to be the 'displayName' of the 'selectedItem' in the 'videoPlayer'.
Where does the player get each of these values?
The DTOs used in BEML are the Flash-only Player API DTOs. You can see the properties of each of these DTOs in the Flash-only Player API Reference.
A ListItem element in a player template can refer to two special values: index and currentItem. The value of index is the integer index in the list of each particular ListItem. The value of currentItem is the data at the index of the List element's dataProvider for each ListItem. For instance, if a List is passed the VideoDTOs from a playlist, each ListItem and all of its subelements can reference its particular VideoDTO through the currentItem value. For example, you can display the thumbnail image of the video that corresponds to the ListItem's position in the list:
<List id="videoList" rowHeight="60" >
<ListItem id="videoItem" boxType="hbox" padding="5" gutter="10">
<Image width="67" height="50"
source="{currentItem.thumbnailURL}" />
</ListItem>
</List>
A ListItem can also use special global functions that enable components in a ListItem to make function calls that do such things as play a video or display the "Get Link" menu. For more information, see Calling Functions from ListItems.