-
Notifications
You must be signed in to change notification settings - Fork 769
custom receivers are holding corrupted queues #3129
Description
Version
Media3 1.9.2
More version details
No response
Devices that reproduce the issue
OnePlus Nord 2T (Android 14)
Google TV Streamer
Google Nest Mini
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Yes
Reproduction steps
For your custom receiver:
1 - Create and publish a custom receiver app (you can use the google sample project here https://github.com/googlecast/CastReceiver and follow the steps) (the default receiver app works fine btw but since the code is not public no one knows why)
2 - Setup in the cast console doesn't seem to matter much but I supported audio only and didn't support guest mode and we have no Android TV app.
In the demo-cast Android project:
1 - add your own OptionsProvider that points to your custom receiver
2 - create a MediaSessionService with a CastPlayer that has both an ExoPlayer and a RemoteCastPlayer with a custom mediaItemConverter (you can use the DefaultMediaItemConverter inside the custom converter)
3 - edit the PlayerManager class to use a MediaController tied to our MediaSessionService as a player instead of the local player
4 - in the PlayerManager class implement the onTimelineChanged callback and log all the windows and their respective media item details
5 - run the app
6 - add 6+ items to the queue (first HLS stream item 6 times does the trick)
7 - connect cast to your preferred device (I used a Google TV Streamer or a Google Nest Mini) and wait for it to play
8 - stop casting
CastOptionsProvider.java
AndroidManifest.xml
PlaybackService.java
PlayerManager.java
Expected result
- It should not crash.
- The MediaQueueItem and MediaItem passed to the MediaItemConverter after switching to another cast device or disconnecting from cast should not have empty title, url, etc. fields.
- The last onTimelineChanged trigger should log the queue with all the details just like the default receiver app (A12D4273) does.
Actual result
- It crashes because the mediaItemConverter expects media item fields like the stream url, title, etc to be present.
- onTimelineChanged logs a list where only the first or first couple of items are loaded (see the last lines of the log document below, this document contains the logs from my own app but the effect is the same)
Note that after connecting to the cast device even the default receiver app triggers an initial onTimelineChanged call with only one or two items that contain the values they should contain and the rest of the playlist has empty fields. However, the default receiver recovers itself by triggering a second onTimelineChanged call with a complete and uncorrupted playlist.
Media
Not applicable but I mostly used the first HLS stream item and added it 6+ times to the queue before playing.
Bug Report
- You will email the zip file produced by
adb bugreportto android-media-github@google.com after filing this issue.