Order of playback events

TVSDK dispatches events/notifications in generally expected sequences. Your player can implement actions based on events in the expected sequence.

The following examples show the order of some events that include playback events.

  • When successfully loading a media resource through MediaPlayer.replaceCurrentResource, the order of events is:

    • MediaPlayerStatusChangeEvent.STATUS_CHANGED with status MediaPlayerStatus.INITIALIZING

    • MediaPlayerItemEvent.ITEM_CREATED

    • MediaPlayerStatusChangeEvent.STATUS_CHANGED with status MediaPlayerStatus.INITIALIZED

  • When preparing for playback through MediaPlayer.prepareToPlay, the order of events is:

    • MediaPlayerStatusChangeEvent.STATUS_CHANGED with status MediaPlayerStatus.PREPARING

    • TimelineEvent.TIMELINE_UPDATED if ads were inserted

    • MediaPlayerStatusChangeEvent.STATUS_CHANGED with status MediaPlayerStatus.PREPARED

  • For live/linear streams, during playback as the playback window advances and additional opportunities are resolved, the order of events is:

    • MediaPlayerItemEvent.ITEM_UPDATED
    • TimelineEvent.TIMELINE_UPDATED if ads were inserted

The following example shows a typical progression of events:

mediaPlayer.addEventListener(MediaPlayerItemEvent.ITEM_CREATED, onItemCreated); 
public function onItemCreated(event:MediaPlayerItemEvent):void { 
    var item:MediaPlayerItem = event.item; 
    ... 
} 
mediaPlayer.addEventListener(MediaPlayerItemEvent.ITEM_UPDATED, onItemUpdated); 
public function onItemUpdated(event:MediaPlayerItemEvent):void { 
    var item:MediaPlayerItem = event.item; 
    ... 
} 
mediaPlayer.addEventListener(MediaPlayerStatusChangeEvent.STATUS_CHANGED,  
                             onStatusChanged); 
public function onStatusChanged(event:MediaPlayerStatusChangeEvent):void { 
    switch(event.status){ 
        case MediaPlayerStatus.INITIALIZING: 
        case MediaPlayerStatus.INITIALIZED: 
        ... 
    } 
    ... 
} 
mediaPlayer.addEventListener(TimeChangeEvent.TIME_CHANGED, onTimeChanged); 
public function onTimeChanged(event:TimeChangeEvent):void { 
    var timeInMilliseconds:Number = event.time; 
    ... 
}

On this page

Adobe Summit Banner

A virtual event April 27-28.

Expand your skills and get inspired.

Register for free
Adobe Summit Banner

A virtual event April 27-28.

Expand your skills and get inspired.

Register for free
Adobe Maker Awards Banner

Time to shine!

Apply now for the 2021 Adobe Experience Maker Awards.

Apply now
Adobe Maker Awards Banner

Time to shine!

Apply now for the 2021 Adobe Experience Maker Awards.

Apply now