Track player states
Player state events track how viewers interact with player controls throughout a session. They are optional and not required for core media tracking implementations. The five trackable states are: fullscreen, mute, closedCaptioning, pictureInPicture, and inFocus.
Player state events are useful for understanding accessibility feature usage, such as how often viewers enable closed captioning or mute. They also reveal viewing behavior patterns like fullscreen versus inline viewing and picture-in-picture multitasking.
Player events
Standard and custom states
Five standard player states are available and you can add your own custom states.
ADB.Media.PlayerState.FullscreenfullScreenADB.Media.PlayerState.ClosedCaptioningclosedCaptioningADB.Media.PlayerState.MutemuteADB.Media.PlayerState.PictureInPicturepictureInPictureADB.Media.PlayerState.InFocusinFocusSee Player state variables for the full variable reference including XDM paths and metric definitions.
Custom states: You can create custom states to capture additional player behaviors specific to your application. See the Media API Reference: createStateObject for details on creating custom state objects.
Implementation steps
- Call State start when the player enters any of the five trackable states. Multiple states can be active at the same time, and multiple states can be started in the same event call.
- Call State end when the player exits a state. Multiple states can be ended in the same event call, and states can be started and ended together in a single call.
Guidelines
- One video session is limited to 10 player states.
- Any combination of states is allowed.
- If multiple player states are passed, only the first 10 are retained and forwarded downstream to the media backend.
- The maximum of 10 states applies to all states, regardless of whether they are open or closed.
- A state can start and end multiple times and counts as a single state. For example,
closedCaptioningcan be started and stopped five times but counts as one state. - The player state is computed across all playback states (no splitting).
- Player states are captured for each individual playback session. Player state is not computed across playbacks.
- Knowledge of the application status is not maintained after a state stops. After a state ends, the state must be started again to continue tracking.
Updating multiple states simultaneously
On XDM-based platforms, multiple state changes can be batched into a single statesUpdate call using arrays in statesStart and statesEnd. On Mobile SDKs, each state change requires a separate call.
The following examples start mute and picture-in-picture together, then transition to full screen.
Recommended implementation types
| code language-javascript |
|---|
|
Mobile SDK does not support batching — send a separate call for each state change.
| code language-swift |
|---|
|
Mobile SDK does not support batching — send a separate call for each state change.
| code language-kotlin |
|---|
|
| code language-brightscript |
|---|
|
| code language-sh |
|---|
|
Legacy implementation types (Analytics-only)
Multiple state changes require separate calls.
| code language-javascript |
|---|
|
Multiple state changes require separate calls.
| code language-javascript |
|---|
|
| code language-json |
|---|
|
Long pause
When a video session has a pause duration longer than 30 minutes, the API requires a new session. Generate a new session ID and retain all active states so that they can be restored with stateStart events right after the new sessionStart call.
sessionStart → stateStart (fullscreen) → stateStart (mute) → pauseStart → (pings for 30 minutes) → sessionEnd
After sessionEnd is sent, start a new session and immediately re-send the active states:
sessionStart → stateStart (fullscreen) → stateStart (mute) → ... other API events
State metrics
Three metrics are computed for each tracked state and sent to Adobe Analytics on the media close call:
a.media.states.[state.name].set = truetrue if the state was set at least once during the playbacka.media.states.[state.name].count = 4a.media.states.[state.name].time = 240