-
Notifications
You must be signed in to change notification settings - Fork 6k
Description
[REQUIRED] Issue description
I am using the new media2 extension for Exoplayer (v2.12.0) and I am trying to use the new playlist APIs in a Player connected via a SessionPlayerConnector to a MediaLibrarySession. The SessionPlayer APIs from AndroidX prohibit calling SessionPlayer.setMediaItem with a null MediaItem argument and calling SessionPlayer.setPlaylist() with a null or empty List<MediaItem>, but is perfectly fine to call SessionPlayer.removeMediaItem() until the playlist is empty.
In my use case I want to update the playlist of a given ExoPlayer instance with a diff change script (add/remove/change/move) applied via the existing Player playlist modification APIs.
Everything is mostly fine (#8046 ) until the playlist goes empty and an assertion in SessionPlayerConnector.handlePlaylistChangedOnHandler() kicks in:
...
if (notifyCurrentMediaItem) {
Assertions.checkNotNull(
currentMediaItem, "PlaylistManager#currentMediaItem() cannot be changed to null");
callback.onCurrentMediaItemChanged(SessionPlayerConnector.this, currentMediaItem);
...The code above results in inability to have the player playlist cleared either directly via the com.google.android.exoplayer2.Player or the APIs from androidx.media2.common.SessionPlayer and have the updates to state reported to media2 related classes.
Having this issue together with (#8011) greatly makes the extension unusable if someone wants to use both the playlist APIs and media2 extension introduced in 2.12.0.
[REQUIRED] Reproduction steps
- Instantiate and configure a MediaSession, link it to a
SessionPlayerConnectorwith aPlayerinstance - Add playlist items to the
Player, either directly or via theSessionPlayerAPI - Clear the playlist directly through the
Player, or by callingSessionPlayer.removeMediaItem(0)until the playlist is empty.
[REQUIRED] Link to test content
The issue is not related to media file decoding or playback.
[REQUIRED] A full bug report captured from the device
[REQUIRED] Version of ExoPlayer being used
2.12.0
[REQUIRED] Device(s) and version(s) of Android being used
Any Android-powered device or emulator complying with the minSdk of the Exoplayer library.