Interface: StateChange

  • The StateChange interface represents a player state change within the cast.framework.stats namespace.

  • Key properties include duration (time spent in state), state (the state entered, e.g., 'playing', 'paused'), and timestamp (when the state was entered).

  • The duration property for the last entry in a list of state changes will increase as the player remains in that state.

  • Possible values for the state property are 'buffering', 'playing', 'paused', or 'ended'.

Properties

duration

number

The number of seconds the player was in this state. If this is the last entry in the list, the player is still in this state, so the duration will continue to increase.

state

string

The state the player entered. This could be 'buffering', 'playing', 'paused', or 'ended'.

timestamp

number

The timestamp the state was entered, in seconds since 1970 (i.e. Date.now() / 1000).