onMediaItemTransition was causing startedPlaying, etc to be run twice because onMediaItemTransition is also called by exoplayer when the playlist changes (Player.MEDIA_ITEM_TRANSITION_REASON_PLAYLIST_CHANGED).
onTracksChanged is only called once when the track is loaded or unloaded. I moved stoppedPlaying up to the top so it can be called when the track is removed also.
onMediaItemTransition
was causingstartedPlaying
, etc to be run twice becauseonMediaItemTransition
is also called by exoplayer when the playlist changes (Player.MEDIA_ITEM_TRANSITION_REASON_PLAYLIST_CHANGED
).onTracksChanged
is only called once when the track is loaded or unloaded. I movedstoppedPlaying
up to the top so it can be called when the track is removed also.