Example event
Event schema
id: A random UUID generated and assigned to the event at creation.type: The type of event, see the table below for a listing of event types.description: A short human-readable description of the event.initiatedBy: 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-intro-outro, ignored-due-to-scrubbing, ignored-due-to-precedence }createdAt: The time when the event was created in simplified extended ISO 8601 format.processedAt: The time when the event was processed in simplified extended ISO 8601 format.changedProps: An object listing the widget properties that were changed by the event.
changedProps and additional event fields (e.g., index) since these might change.
Instead, query the widget props directly using the Widget API when listening to events.
Event types
The following table lists all event types emitted by the widget. 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 ads are playing.
To inspect the events further, it is recommended you listen to "<any>" event and console log them.
Listen to events
The widget 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.
See Event schema and Event types for a full listing of event types and their fields.
Clean 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: