Introduction
The Player API is the top-level API. This API exposes:
- basic functions to manipulate video playback, such as start and pause;
- properties to check states and values, such as the playhead position;
- events to track changes.
The list below overviews how-to articles related to the Player API.
- How do you know when a stream or an advertisement is playing?
- How to measure time-to-first-frame
- How can we track the first play(ing) event?
- How to track player states
Events
As a developer, you can programmatically attach event listeners to different APIs. Event listeners are often used to implement a custom UI or to implement a custom analytics integration.
The THEOplayer API exposes many events across different interfaces, as can be seen in the graphic below. Furthermore, most events exist in all SDKs (Web, iOS-based, Android-based and Roku).
The table below gives an overview of a subset of the available events per interface in the THEOplayer Web SDK.
Interface | Event | Description |
---|---|---|
Player | canplay | Fired when the player can resume playback of the media data. |
Player | canplaythrough | Fired when the player can resume playback of the media data and buffering is unlikely. |
Player | contentprotectionerror | Fired when an error related to content protection occurs. |
Player | contentprotectionsuccess | Fired when the key is usable for decryption. |
Player | currentsourcechange | Fired when the current source, which is chosen from ChromelessPlayer.source.sources, changes. |
Player | destroy | Fired when the the player is destroyed. |
Player | dimensionchange | Fired when the dimensions of the HTML element changes. |
Player | durationchange | Fired when ChromelessPlayer.duration changes. |
Player | emptied | Fired when the player's source is cleared. |
Player | encrypted | Fired when the player encounters key system initialization data in the media data. |
Player | ended | Fired when playback has stopped because the end of the media resource was reached. |
Player | error | Fired when an error occurs. |
Player | loadeddata | Fired when the player can render the media data at the current playback position for the first time. |
Player | loadedmetadata | Fired when the player determines the duration and dimensions of the media resource. |
Player | loadstart | Fired when the player starts loading the manifest. |
Player | manifestupdate | Fired when the manifest is updated. |
Player | pause | Fired when ChromelessPlayer.paused changes to true. |
Player | play | Fired when ChromelessPlayer.paused changes to false. |
Player | playing | Fired when playback is ready to start after having been paused or delayed due to lack of media data. |
Player | progress | Fired when the player loaded media data. |
Player | ratechange | Fired when ChromelessPlayer.playbackRate changes. |
Player | readystatechange | Fired when ChromelessPlayer.readyState changes. |
Player | representationchange | Fired when the current representation changes. |
Player | resize | Fired when either ChromelessPlayer.videoWidth or ChromelessPlayer.videoHeight changes. |
Player | seeked | Fired when ChromelessPlayer.seeking changes to false after the current playback position was changed. |
Player | seeking | Fired when ChromelessPlayer.seeking changes to true, and the player has started seeking to a new position. |
Player | segmentnotfound | Fired when a segment can not be found. |
Player | sourcechange | Fired when ChromelessPlayer.source changes. |
Player | timeupdate | Fired when the current playback position changed as part of normal playback or in an especially interesting way, for example discontinuously. |
Player | volumechange | Fired when ChromelessPlayer.volume changes. |
Player | waiting | Fired when playback has stopped because the next frame is not available, but the player expects that frame to become available in due course. |
Player | currentTime | The current playback position of the media, in seconds. |
Player | currentProgramDateTime | The current playback position of the media, as a timestamp. |
Player | muted | Whether audio is muted. |
Player | ... | ... |
Ads (Client-Side) | adbegin | Fired when an ad begins. |
Ads (Client-Side) | adbreakbegin | Fired when an ad break begins. |
Ads (Client-Side) | adbreakchange | Fired when an ad break changes. |
Ads (Client-Side) | adbreakend | Fired when an ad break ends. |
Ads (Client-Side) | adbuffering | Fired when the ad has stalled playback to buffer. |
Ads (Client-Side) | addad | Fired when an ad is added. |
Ads (Client-Side) | addadbreak | Fired when an ad break is added. |
Ads (Client-Side) | adend | Fired when an ad ends. |
Ads (Client-Side) | aderror | Fired when an ad errors. |
Ads (Client-Side) | adfirstquartile | Fired when an ad reaches the first quartile. |
Ads (Client-Side) | adimpression | Fired when an ad counts as an impression. |
Ads (Client-Side) | adloaded | Fired when an ad is loaded. |
Ads (Client-Side) | admetadata | Fired when an ads list is loaded. |
Ads (Client-Side) | admidpoint | Fired when an ad reaches the mid point. |
Ads (Client-Side) | adskip | Fired when an ad is skipped. |
Ads (Client-Side) | adthirdquartile | Fired when an ad reaches the third quartile. |
Ads (Client-Side) | removeadbreak | Fired when an ad break is removed. |
Ads (Client-Side) | updatead | Fired when an ad is updated. |
Ads (Client-Side) | updateadbreak | Fired when an AdBreak is updated. |
Vendor Cast | statechange | Fired when the state changes. |
Chromecast | error | Fired when an error occurs while casting or trying to cast. |
Track List | addtrack | Fired when a track is added. |
Track List | change | Fired when a track is activated or deactivated. |
Track List | removetrack | Fired when a track is removed. |
Track | change | Fired when a media track's enabled or a text track's changes. |
Track | update | Fired when the track updates. |
Media Track | activequalitychanged | Fired when the media track's active quality changes. |
Media Track | qualityunavailable | Fired when a quality of the track becomes unavailable. |
Media Track | targetqualitychanged | Fired when the media track's target quality changes. |
Text Track | addcue | Fired when a cue is added to the track. |
Text Track | cuechange | Fired when a cue of the track changes. |
Text Track | entercue | Fired when a cue of the track enters. |
Text Track | error | Fired when an error occurred while loading or parsing the track. |
Text Track | exitcue | Fired when a cue of the track exits. |
Text Track | readystatechange | Fired when the text track's changes. |
Text Track | removecue | Fired when a cue of the track is removed. |
Text Track | typechange | Fired when the text track's changes. |
Text Track Cue | enter | Fired when the cue is entered. |
Text Track Cue | exit | Fired when the cue is exited. |
Text Track Cue | update | Fired when the cue is updated. |
Presentation | error | Fired when an error occurs. |
Presentation | presentationmodechange | Fired when the presentation mode changes. |
VR | directionchange | Fired when the VR.direction changes. |
VR | error | Fired when an error occurs. |
VR | statechange | Fired when the VR.state changes. |
VR | stereochange | Fired when the VR.stereo changes. |
Verizon Media | assetinforesponse | Fired when an asset info response is received. |
Verizon Media | pingerror | Fired when an error or invalid response is received from the Ping API. |
Verizon Media | pingresponse | Fired when a Ping response is received. |
Verizon Media | preplayresponse | Fired when a Preplay response is received. |
Verizon Media | ads | The Verizon Media SSAI API. |
Verizon Media | assets | List of Verizon Media assets. |
Verizon Media Ad Break List | addadbreak | Fired when the ad break is added. |
Verizon Media Ad Break List | removeadbreak | Fired when the ad break is removed. |
Verizon Media Ad Break | adbreakbegin | Fired when the ad break begins. |
Verizon Media Ad Break | adbreakend | Fired when the ad break ends. |
Verizon Media Ad Break | adbreakskip | Fired when the ad break is skipped. |
Verizon Media Ad Break | updateadbreak | Fired when the ad break is updated. |
Verizon Media Ad | adbegin | Fired when an ad begins. |
Verizon Media Ad | adcomplete | Fired when the ad is completed. |
Verizon Media Ad | adend | Fired when the ad ends. |
Verizon Media Ad | adfirstquartile | Fired when the ad reaches the first quartile. |
Verizon Media Ad | admidpoint | Fired when the ad reaches the mid point. |
Verizon Media Ad | adthirdquartile | Fired when the ad reaches the third quartile. |
Our APIs are continuously evolving, and so is our list of events. Refer to our API references of our SDKs to go through the latest sets of events: