[Cast] CastTimeline stays empty on reconnect
- Dominant language
- Java
- Stars
- 21.9k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
The `CastTimeline` initially stays empty when reconnecting to a cast device even though it has an active `MediaQueueItem`.
Only after a state change (play / pause) will the timeline be populated.
How to reproduce:
1. Launch the sender app and cast something to a device.
2. Pause the content (not required but helps to avoid extra state changes from buffering etc.).
3. Completely restart the sender app (re-launch through Android Studio).
4. Wait for the automatic re-connect to the cast or do so manually.
5. The `currentTimeline` of the `CastPlayer` stays empty (as long as there is no other interaction with the cast).
Expected behavior:
- The timeline contains the currently playing item.
The issue is also observable in the demo-cast project if one adds logging and changes the timing a bit:
https://github.com/inv3rse/ExoPlayer/commit/ec6e303de1185095559afd85e3a7947c9e2de915
The issue appears to be the usage of `remoteMediaClient.getMediaQueue().getItemIds()` in the `CastTimelineTracker`.
After a reconnect it will always return an empty array until there are further state changes on the cast.
I am not sure about the internals of the MediaQueue, but simply getting the ids from the MediaStatus instead appears to be working fine: https://github.com/google/ExoPlayer/pull/9078
ExoPlayer version: 2.14.0
Android version: 10
Android device: Galaxy S9
Contributor guide
Assessment
This issue has not been assessed yet.