Event mapping for Web SDK

Review a table representing event mapping for Web SDK.

AMP1 eventAMP2 eventMigration notesCode example
autoplayblockedplaybackcouldnotbestartedDirect mappingplayer.on('playbackcouldnotbestarted', handler)
bufferingchangeN/AMonitor data loading/pushing separatelyUse a combination of events
busyN/ACould integrate with combination of eventsCustom implementation required
canplayreadyDirect mappingplayer.on('ready', handler)
canplaythroughUse video elementAccess native video elementvideoElement.addEventListener('canplaythrough', handler)
contentchangedN/ANo direct equivalentCustom implementation required
destroydestroyDirect mappingplayer.on('destroy', handler)
displaystatechangeviewmodechangedDifferent event nameplayer.on('viewmodechanged', handler)
durationchangedurationchangedDirect mappingplayer.on('durationchanged', handler)
endedplaybackfinishedDirect mappingplayer.on('playbackfinished', handler)
errorerrorDirect mappingplayer.on('error', handler)
failoverattemptcontentlocationchangedDifferent namingplayer.on('contentlocationchanged', handler)
fullscreenchangeviewmodechangedDifferent event nameplayer.on('viewmodechanged', handler)
isliveN/ACustom integrationUse timechanged and player.isLive() check
languagechangeaudiochangedUse with subtitle events if neededplayer.on('audiochanged', handler)
loadstartN/ACould wrap load methodWrap player.load() method
loadeddatasourceloadedDirect mappingplayer.on('sourceloaded', handler)
loadedmetadataUse video elementAccess native elementvideoElement.addEventListener('loadedmetadata', handler)
mediachangeN/ANo direct equivalentMonitor source changes
mediasequenceabortedN/ANo direct equivalentCustom implementation
mediasequenceendedN/ANo direct equivalentCustom implementation
mediasequencestartedN/ANo direct equivalentCustom implementation
mediumchangeN/ANo direct equivalentCustom implementation
mutechangemuted, unmutedSplit into two eventsplayer.on('muted', handler); player.on('unmuted', handler)
pauseUse video elementAccess native elementvideoElement.addEventListener('pause', handler)
pausedpausedDirect mappingplayer.on('paused', handler)
playplayDirect mappingplayer.on('play', handler)
playrequestN/ANo direct equivalentMonitor play method calls
playstatechangeN/ACombination of eventsMonitor play, playing, and paused events
playbackratechangeplaybackspeedchangedDirect mappingplayer.on('playbackspeedchanged', handler)
playbacktargetavailabilitychangecastavailableDifferent namingplayer.on('castavailable', handler)
playbacktargetchangecaststarted, caststoppedSplit eventsplayer.on('caststarted', handler)
playingplayingDirect mappingplayer.on('playing', handler)
progressUse video elementAccess native elementvideoElement.addEventListener('progress', handler)
qualitychangeAudioqualitychange, videoqualitychangeSplit by media typeplayer.on('videoqualitychange', handler)
qualitychangingaudiodownloadqualitychange, videodownloadqualitychangeSplit by typeMonitor download quality changes
qualitylevelsloadedaudiodownloadqualitychanged, videodownloadqualitychangedSplit eventsMonitor when qualities load
qualitymodechangeN/ANo direct equivalentCustom implementation
qualityswitchedaudioqualitychanged, videoqualitychangedSplit by typeplayer.on('videoqualitychanged', handler)
readyreadyDirect mappingplayer.on('ready', handler)
recordcontentchangeN/ANo direct equivalentN/A
resumeplayingDifferent eventplayer.on('playing', handler)
seekedseekedDirect mappingplayer.on('seeked', handler)
seekingseekDifferent event nameplayer.on('seek', handler)
settingschangeN/ANo direct equivalentN/A
stalledstallstartedDirect mappingplayer.on('stallstarted', handler)
startedstallendedDifferent purposeplayer.on('stallended', handler)
temporaltypechangeN/ATrack isLive and durationchangedCustom implementation
timeupdatetimechangedDirect mappingplayer.on('timechanged', handler)
timedmetadatametadatachangedDirect mappingplayer.on('metadatachanged', handler)
trackerrorerror and ErrorCodeCheck error codeplayer.on('error', (e) => { if(e.code === X) {...} })
viewcreatedN/AUse MutationObserverMonitor DOM changes
volumechangevolumechangedDirect mappingplayer.on('volumechanged', handler)
waitingUse video elementAccess native elementvideoElement.addEventListener('waiting', handler)

Events related to captioning

AMP1 eventAMP2 eventMigration notesCode example
cuechangecueenter, cueexitSplit into two eventsplayer.on('cueenter', handler); player.on('cueexit', handler)
enabledsubtitleenabledDirect mappingplayer.on('subtitleenabled', handler)
visibilitychangesubtitleenabled / subtitledisabledCould integrate with combination of eventsplayer.on('subtitleenabled', handler);player.on('subtitledisabled', handler);
tracksloadedsubtitleaddedDirect mappingplayer.on('subtitleadded', handler)
trackselectedsubtitleenabledDirect mappingplayer.on('subtitleenabled', handler)
trackerrorerror event + ErrorCodeCheck error codeplayer.on('error', (e) => { if(e.code === X) {...} })