Add single callback for all simultaneous state changes to prevent duplicate event handling.
- Dominant language
- Java
- Stars
- 21.9k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
### [REQUIRED] Issue description
Starting with ExoPlayer version 2.10.5 MediaControllerCompat.Callback.onPlaybackStateChanged is called twice for some states like STATE_STOPPED(1).
Player.EventListener onPlayerStateChanged is not affected.
### [REQUIRED] Reproduction steps
Test project:
https://github.com/AndrazP/uamp
Update ExoPlayer from version 2.10.4 to 2.10.5 to reproduce the bug in https://github.com/AndrazP/uamp/blob/master/build.gradle
Build and run test app.
Select Albums -> "Irsen's Tale" -> Last song in the list "Outro"
Observe Logcat for onPlaybackStateChanged logs
Example log from ExoPlayer 2.10.4
> 2020-01-06 17:54:51.274 21876-21876/com.example.android.uamp.next D/dev: onPlaybackStateChanged 0 STATE_NONE
2020-01-06 17:54:51.279 21876-21876/com.example.android.uamp.next D/dev: onPlaybackStateChanged 0 STATE_NONE
2020-01-06 17:55:25.104 21876-21876/com.example.android.uamp.next D/dev: onPlaybackStateChanged 6 STATE_BUFFERING
2020-01-06 17:55:25.105 21876-21876/com.example.android.uamp.next D/dev: onPlaybackStateChanged 6 STATE_BUFFERING
2020-01-06 17:55:25.285 21876-21876/com.example.android.uamp.next D/dev: onPlaybackStateChanged 6 STATE_BUFFERING
2020-01-06 17:55:25.412 21876-21876/com.example.android.uamp.next D/dev: onPlaybackStateChanged 6 STATE_BUFFERING
2020-01-06 17:55:26.179 21876-21876/com.example.android.uamp.next D/dev: onPlaybackStateChanged 3 STATE_PLAYING
2020-01-06 17:56:31.638 21876-21876/com.example.android.uamp.next D/dev: onPlaybackStateChanged 1 STATE_STOPPED
Example log from ExoPlayer 2.10.5
> 2020-01-06 17:43:59.274 20335-20335/com.example.android.uamp.next D/dev: onPlaybackStateChanged 0 STATE_NONE
2020-01-06 17:43:59.275 20335-20335/com.example.android.uamp.next D/dev: onPlaybackStateChanged 0 STATE_NONE
2020-01-06 17:47:21.770 20335-20335/com.example.android.uamp.next D/dev: onPlaybackStateChanged 6 STATE_BUFFERING
2020-01-06 17:47:21.772 20335-20335/com.example.android.uamp.next D/dev: onPlaybackStateChanged 6 STATE_BUFFERING
2020-01-06 17:47:21.989 20335-20335/com.example.android.uamp.next D/dev: onPlaybackStateChanged 6 STATE_BUFFERING
2020-01-06 17:47:22.197 20335-20335/com.example.android.uamp.next D/dev: onPlaybackStateChanged 6 STATE_BUFFERING
2020-01-06 17:47:22.788 20335-20335/com.example.android.uamp.next D/dev: onPlaybackStateChanged 3 STATE_PLAYING
2020-01-06 17:47:22.789 20335-20335/com.example.android.uamp.next D/dev: onPlaybackStateChanged 3 STATE_PLAYING
2020-01-06 17:48:28.313 20335-20335/com.example.android.uamp.next D/dev: onPlaybackStateChanged 1 STATE_STOPPED
2020-01-06 17:48:28.314 20335-20335/com.example.android.uamp.next D/dev: onPlaybackStateChanged 1 STATE_STOPPED
### [REQUIRED] Link to test content
See "Reproduction steps"
### [REQUIRED] A full bug report captured from the device
Capture a full bug report using "adb bugreport
[bugreport-sdk_gphone_x86-OSR1.170901.043-2020-01-06-17-50-16.zip](https://github.com/google/ExoPlayer/files/4026991/bugreport-sdk_gphone_x86-OSR1.170901.043-2020-01-06-17-50-16.zip)
### [REQUIRED] Version of ExoPlayer being used
2.10.5
### [REQUIRED] Device(s) and version(s) of Android being used
Nexus 5X emulator API 26
Contributor guide
Assessment
This issue has not been assessed yet.