---
title: mediaItemWillChange
framework: tvmljs
role: symbol
role_heading: Instance Property
path: tvmljs/player/1627345-mediaitemwillchange
---

# mediaItemWillChange

An event notifying the listener that the player is about to changed a media item.

## Declaration

```data
attribute  mediaItemWillChange;
```

## Discussion

Discussion This attribute contains the reason the media item is about to change. Valid values are: errorDidOccur, fastForwardedToEndOfMediaItem, manuallyChanged, newPlaylist, playerInvalidated, and playedToEndOfMediaItem. The listener is passed an event object with the following attributes: reason—An integer that represents the reason for why the media changed. Valid values are 0:Unknown, 1:Played to the end, 2:Forwarded to the end, 3:Error occurred, 4:Playlist changed, and 5:User initiated. target—The event object, which is the Player object. timeStamp—The time that the event occurred. type—The name of the event.

## See Also

### Responding to Events

- [mediaItemDidChange](tvmljs/player/1627385-mediaitemdidchange.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)
- [shouldHandleStateChange](tvmljs/player/1627428-shouldhandlestatechange.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)
