---
title: shouldHandleStateChange
framework: tvmljs
role: symbol
role_heading: Instance Property
path: tvmljs/player/1627428-shouldhandlestatechange
---

# shouldHandleStateChange

An event that indicates a state change request has occurred.

## Declaration

```data
attribute  shouldHandleStateChange;
```

## Discussion

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 are playing, paused, and scanning. state—The state that the player is about to switch to. Valid values are playing, paused, and scanning. 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. note: This event occurs after a user has performed an action and needs to be handled as quickly as possible.

## See Also

### Responding to Events

- [mediaItemDidChange](tvmljs/player/1627385-mediaitemdidchange.md)
- [mediaItemWillChange](tvmljs/player/1627345-mediaitemwillchange.md)
- [playbackDidStall](tvmljs/player/1682114-playbackdidstall.md)
- [playbackError](tvmljs/player/1682115-playbackerror.md)
- [requestSeekToTime](tvmljs/player/1627354-requestseektotime.md)
- [shouldChangeToMediaAtIndex](tvmljs/player/1682117-shouldchangetomediaatindex.md)
- [stateDidChange](tvmljs/player/1627390-statedidchange.md)
- [stateWillChange](tvmljs/player/1627331-statewillchange.md)
- [timeBoundaryDidCross](tvmljs/player/1627443-timeboundarydidcross.md)
- [timeDidChange](tvmljs/player/1627344-timedidchange.md)
- [timedMetadata](tvmljs/player/1627384-timedmetadata.md)
- [transportBarVisibilityDidChange](tvmljs/player/1682120-transportbarvisibilitydidchange.md)
