[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
SessionPlayerConnector with a Player instance
- Add playlist items to the
Player, either directly or via the SessionPlayer API
- Clear the playlist directly through the
Player, or by calling SessionPlayer.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
assertion stacktrace.txt
[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.
[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
Playerconnected via aSessionPlayerConnectorto aMediaLibrarySession. TheSessionPlayerAPIs from AndroidX prohibit callingSessionPlayer.setMediaItemwith anullMediaItemargument and callingSessionPlayer.setPlaylist()with anullor emptyList<MediaItem>, but is perfectly fine to callSessionPlayer.removeMediaItem()until the playlist is empty.In my use case I want to update the playlist of a given
ExoPlayerinstance with a diff change script (add/remove/change/move) applied via the existingPlayerplaylist modification APIs.Everything is mostly fine (#8046 ) until the playlist goes empty and an assertion in
SessionPlayerConnector.handlePlaylistChangedOnHandler()kicks in:The code above results in inability to have the player playlist cleared either directly via the
com.google.android.exoplayer2.Playeror the APIs fromandroidx.media2.common.SessionPlayerand 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
SessionPlayerConnectorwith aPlayerinstancePlayer, either directly or via theSessionPlayerAPIPlayer, 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
assertion stacktrace.txt
[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.