Version
Media3 main branch
More version details
We're migrating from our RemoteMediaClient wrapper to media3 CastPlayer. We found out that if the media items is more than 2, it will throw an exception upon disconnecting from the device. Here's the stacktrace:
java.lang.NullPointerException
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:902)
at androidx.media3.exoplayer.source.ProgressiveMediaSource$Factory.createMediaSource(ProgressiveMediaSource.java:297)
at androidx.media3.exoplayer.source.ProgressiveMediaSource$Factory.createMediaSource(ProgressiveMediaSource.java:86)
at androidx.media3.exoplayer.ExoPlayerImpl.createMediaSources(ExoPlayerImpl.java:2191)
at androidx.media3.exoplayer.ExoPlayerImpl.setMediaItems(ExoPlayerImpl.java:627)
at androidx.media3.common.PlayerTransferState.setToPlayer(PlayerTransferState.java:249)
at androidx.media3.cast.CastPlayer$TransferCallback.lambda$static$0(CastPlayer.java:66)
at androidx.media3.cast.CastPlayer$TransferCallback$$ExternalSyntheticLambda0.transferState(D8$$SyntheticClass:0)
at androidx.media3.cast.CastPlayerImpl.updateActivePlayer(CastPlayerImpl.java:58)
at androidx.media3.cast.CastPlayerImpl.access$100(CastPlayerImpl.java:32)
at androidx.media3.cast.CastPlayerImpl$SessionAvailabilityListenerImpl.onCastSessionUnavailable(CastPlayerImpl.java:103)
at androidx.media3.cast.RemoteCastPlayer.setCastSession(RemoteCastPlayer.java:1651)
at androidx.media3.cast.RemoteCastPlayer.access$1900(RemoteCastPlayer.java:105)
at androidx.media3.cast.RemoteCastPlayer$StatusListener.onSessionEnding(RemoteCastPlayer.java:1870)
at com.google.android.gms.cast.framework.SessionManager.endCurrentSession(SessionManager.java:3)
at com.bandlab.media.player.impl.LazyCastPlayer.stopCastSession(LazyCastPlayer.kt:95)
After debugging, we found out that the RemoteMediaPlayer.getMediaItemAt(index) can return an invalid/incorrect MediaItem
If we play all the items in the playlist, this problem will not happened.
Devices that reproduce the issue
Emulator OS 16
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Not tested
Reproduction steps
- Have playlist with media item count > 3
- Connect to Cast Device
- Disconnect from Cast Device
Expected result
TransferCallback.DEFAULT or the CastPlayer should handle this internally so the exception will not happen
Actual result
Crashing
Media
Bug Report
Version
Media3 main branch
More version details
We're migrating from our
RemoteMediaClientwrapper to media3CastPlayer. We found out that if the media items is more than 2, it will throw an exception upon disconnecting from the device. Here's the stacktrace:After debugging, we found out that the
RemoteMediaPlayer.getMediaItemAt(index)can return an invalid/incorrectMediaItemIf we play all the items in the playlist, this problem will not happened.
Devices that reproduce the issue
Emulator OS 16
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Not tested
Reproduction steps
Expected result
TransferCallback.DEFAULTor theCastPlayershould handle this internally so the exception will not happenActual result
Crashing
Media
Bug Report
adb bugreportto [email protected] after filing this issue.