-
Notifications
You must be signed in to change notification settings - Fork 6k
Description
Issue description
State updates from Player.EventListener.onPlayerStateChanged() may be inconsistent between multiple listeners added with Player.addListener(). This happens when one of the listeners callbacks changes the Player state.
For example, if a listener call Player.stop() when receiving a Player.STATE_ENDED state update, all succeeding listeners will receive a Player.STATE_IDLE state update.
The Expected behaviour is that all listeners receive the same state update values.
Reproduction steps
- Apply this patch to the main demo app in order to add two new
Player.EventListener: - Play any video from the main demo app. The following logcat snippet is from full play of "YouTube DASH -> Google Play (WebM, VP9)":
05-21 01:16:58.016 16603-16603/com.google.android.exoplayer2.demo D/PlayerEndEventListener: playbackState: IDLE / playyWhenReady: true
05-21 01:16:58.017 16603-16603/com.google.android.exoplayer2.demo D/PlayerLogEventListener: playbackState: IDLE / playyWhenReady: true
05-21 01:16:58.208 16603-16603/com.google.android.exoplayer2.demo D/PlayerEndEventListener: playbackState: BUFFERING / playyWhenReady: true
05-21 01:16:58.208 16603-16603/com.google.android.exoplayer2.demo D/PlayerLogEventListener: playbackState: BUFFERING / playyWhenReady: true
05-21 01:17:00.643 16603-16603/com.google.android.exoplayer2.demo D/PlayerEndEventListener: playbackState: READY / playyWhenReady: true
05-21 01:17:00.643 16603-16603/com.google.android.exoplayer2.demo D/PlayerLogEventListener: playbackState: READY / playyWhenReady: true
05-21 01:18:01.904 16603-16603/com.google.android.exoplayer2.demo D/PlayerEndEventListener: playbackState: ENDED / playyWhenReady: true
05-21 01:18:01.905 16603-16603/com.google.android.exoplayer2.demo D/PlayerEndEventListener: playbackState: IDLE / playyWhenReady: true
05-21 01:18:01.905 16603-16603/com.google.android.exoplayer2.demo D/PlayerLogEventListener: playbackState: IDLE / playyWhenReady: true
05-21 01:18:01.921 16603-16603/com.google.android.exoplayer2.demo D/PlayerLogEventListener: playbackState: IDLE / playyWhenReady: true
The issue is on the latest 4 state updates. Note that PlayerLogEventListener never receives the Player.STATE_ENDED state upate:
PlayerEndEventListener: playbackState: ENDED
PlayerEndEventListener: playbackState: IDLE
PlayerLogEventListener: playbackState: IDLE
PlayerLogEventListener: playbackState: IDLE
Link to test content
Can be reproduced with all medias from main demo app.
Version of ExoPlayer being used
r2.8.0
Device(s) and version(s) of Android being used
Reproduced on Galaxy S7 and Motorola G5, both running Android 7.0 (API 24), and on Emulator running Android 8.1.0 (API 27).
A full bug report captured from the device
bugreport-sdk_gphone_x86-OSM1.180201.007-2018-05-21-01-54-13.zip