Meta-Player API methods
API methods
When integrating the meta-player into your website or customizing the meta-player to suit your own needs, the properties and methods described in this chapter may be used.
Events
The meta-player dispatches events to indicate certain things have happened.
Most of these events are standard media events dispatched by the underlying video element. Information about these can be found here
Some however, are custom, and indicate that the meta-player instance has
progressed to a new stage in its start up. You'd expect to receive the
haveStreamInfo
, playerChosen
and initialized
events in this order.
haveStreamInfo
This event is dispatched by the target element when the meta-player has
retrieved a stream's meta data. From now on, it can be read from
MistVideo.info
.
comboChosen
This event is dispatched by the target element when the meta-player has
chosen a player and source combination. This happens before the selected
player is asked to build. The player name is now available at
MistVideo.playerName
, and the source at MistVideo.source
.
initialized
This event is dispatched by the target element when the interface has been built and the selected player has completed its build method.
If you need to be certain the video is loaded, you will want to listen
for the loaddedmetadata
event, dispatched by the video element.
initializeFailed
This event is dispatched by the target element when the meta-player was unable to complete its initialization sequence.
The meta-player will always generate either an initialized
or an
initializeFailed
event, unless it is unloaded before it has reached
either point.
log
This is event is dispatched by the target element for each new log
message. The message itself is available as the event's message
property.
metaUpdate_tracks
This event is dispatched each time the list of tracks changes (tracks added or removed). The contents are the same as the JSON format stream information which contains a full description of the stream.
The player API
Players will also have their own methods and properties, which can be
found in MistVideo.player
.
MistVideo.player.resizeAll()
Calling this method will ask the meta-player to recalculate its size and resize the video accordingly.
MistVideo.player.api
If the player can respond to most of the methods of a standard HTML5 video element, this property will be set. In it the usual methods and properties of a video element can be found. Please refer to the general HTML5 video element documentation for their workings.
MistVideo.player.api
should be used to control and access the video
element rather than MistVideo.video
, as the players may modify the
behaviour of the methods stored in the player api to achieve a more
consistent experience for the end user.
For example, the values of currentTime
and duration
of the player
api will be different to those of the video element for live playback of
MP4 in the HTML5 player.