Event listeners can be set on the player events (after the player has been created and initialized).
Available player listening options:
Call the listen method for a specific event, in this case playerReady (see example):
player.events().playerReady.listen(function(result)
{
// Triggered once the player is ready
});Call the listen method on the entire collection of events (see example):
var PlayerEventType = TOP.events.PlayerEventType;
player.events().listen(function(type, result)
{
switch (type)
{
case PlayerEventType.Player_Ready:
// Triggered once the player is ready
break;
}
});Also see PlayerEventType enum to check the type parameter for the type of event.
Call the listen method providing a map of events (see PlayerApiEvents for key values) (see example)::
player.events().listen({
playerInitialized: function(result) {
// Triggered once the player is initialized
},
playerReady: function(result) {
// Triggered once the player is ready
},
...
});