shouldHandleStateChange
An event that indicates a state change request has occurred.
Declaration
attribute shouldHandleStateChange;Discussion
This event is called when the user requests a change, but before the change occurs. Only a single shouldHandleStateChange listener can be active at a time. If multiple listeners are set to listen for shouldHandleStateChange, only the last one will be updated. The listener is passed an event object with the following attributes:
duration—The duration, in seconds, of the asset being played.elapsedTime—The elapsed time, in seconds, of the asset being played.oldState—The previous state of the player. Valid values areplaying,paused, andscanning.state—The state that the player is about to switch to. Valid values areplaying,paused, andscanning.target—The event object, which is the Player object.timeStamp—The time that the event occurred.type—The name of the event.
The listener must return one of the following values:
true. The state is allowed.false. The state change is not allowed.