Skip to main content
Player events are simple JSON objects that are emitted by the BeyondWords player. They contain information about the current state of the player. They are separate from analytics events which contain information about user engagement. You can listen to player events and perform your own actions after they are processed by the player in its RootController. Events have a set of fields that are always present and some events contain additional fields. Here is an example:
Example event
For the above example, the ‘index’ field additional and is specific to the PressedPlaylistItem event. All of the other fields are present in every event. Their schema is explained below.

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-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 player properties that were changed by the event
It is recommended to not depend on 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:
The code above registers an event listener that listens to any event and logs it to the console. If you only want to listen to a single event type, provide its name:
Events contain a standard set of fields such as 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 of addEventListener is a string that is a handle to the listener. This allows you remove the listener, for example, if a React component is unmounted:
Or when your Svelte component is unmounted:
Otherwise, the callback function will continue to be called which may result in an error in your application.