Example event
Event schema
id: a random UUID generated and assigned to the event at creationtype: the type of event, see the table below for a listing of event typesdescription: a short human-readable description of the eventinitiatedBy: who initiated the event, one of:{ user, media, browser, media-session-api, google-ima-sdk }emittedFrom: which interface emitted the event, one of:{ inline-player, bottom-widget, segment, segment-widget }status: the status of the event, one of:{ handled, ignored-due-to-advert, ignored-due-to-scrubbing, ignored-due-to-precedence }createdAt: the time when the event was created in simplified extended ISO 8601 formatprocessedAt: the time when the event was processed in simplified extended ISO 8601 formatchangedProps: an object listing the player properties that were changed by the event
changedProps and additional event fields (e.g. index) since these might change.
Instead, please query the player props directly using the Player SDK when listening to events.
Event types
The following table lists all event types emitted by the player. Initiators denoted with a plus(+) can also be initiated by media-session-api, e.g. using playback controls on a phone lock screen.
Initiators denoted with a star (*) can also be initiated by google-ima-sdk when VAST adverts are playing.
To inspect the events further, it is recommended you listen to "<any>" event and console log them.
Listening to events
The player emits events in response to user actions, playback time updates, entering full screen, etc. You can listen to these events in your JavaScript code:type and createdAt and some contain additional fields.
Please refer to Event schema and Event types for a full listing of event types and their fields.
Cleaning up
The return value ofaddEventListener is a string that is a handle to the listener.
This allows you remove the listener, for example, if a React component is unmounted: