CastPlayer: How to pause at the end of a media item, not to proceed to the next

182 Views Asked by At

I am developing an Android app using Cast in media3 v1.1.0. The CastPlayer automatically moves to the next media item when the playback of the current media item finishes. When there is only one media item in the media queue, the media becomes invisible and the control UI on the Android device becomes unresponsive when playback finishes. However, I want the CastPlayer to pause at the end of playback so that the user can replay the media item. What should I do?

My code is essentially similar to the cast demo (https://github.com/androidx/media/tree/release/demos/cast).

I am using the default receiver (androidx.media3.cast.DefaultCastOptionsProvider).

I attempted to override the onPlaybackStateChanged method in the Player.Listener interface. However, since this callback is invoked after the playback has already ended on the receiver side and the media has become invisible, editing this callback was ineffective.

0

There are 0 best solutions below