question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid assertions in `SessionPlayerConnector`

See original GitHub issue

[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

  1. Instantiate and configure a MediaSession, link it to a SessionPlayerConnector with a Player instance
  2. Add playlist items to the Player, either directly or via the SessionPlayer API
  3. 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.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ojw28commented, Nov 20, 2020

Fixed in https://github.com/google/ExoPlayer/commit/2f1c0a5d0d556f9896af43b61ff0d8f04f31de30. This will be included in the 2.12.2 release, which is due in the next couple of weeks.

0reactions
SungsooLimcommented, Nov 20, 2020

Fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - Connecting exoplayer with MediaSessionCompat
The connector mediates between the player instance and the media session. This means the connector listens to state transitions of the ...
Read more >
Pro Tools Error Codes - What They Mean And How To Fix Them
In this article, we take a comprehensive look at the error codes that Pro Tools can throw up when you are least expecting...
Read more >
MediaSessionConnector (ExoPlayer library)
The connector listens for actions sent by the media session's controller and implements these actions by calling appropriate player methods.
Read more >
ssh - "Invalid MIT-MAGIC-COOKIE-1 key" when trying to run ...
I am using SSH as my means of connecting to the server, but do not wish to use X-forwarding since it slows down...
Read more >
Bluetooth devices disconnect and reconnect right after several ...
I also removed the bluetooth connections and repaired them, ... messages coming up: gvc_mixer_card_get_index: assertion 'GVC_IS_MIXER_CARD ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found