Repository navigation
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Calling play() or pause() right after setMediaItems() sent the request while the load was still in flight. The request targets the receiver's current media session, which the load replaces, so the receiver rejected it. The new media then loaded with the autoplay value from before the call, and the next status update reset playWhenReady. While a load is in flight, keep playWhenReady masked and send the play/pause request once the load completes. If several calls are made, only the last one is sent. Issue: androidx#3557
Vashiru
force-pushed
the
cast-defer-play-during-load
branch
from
November 16, 2026 10:31
1801874 to
3cca2fc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3557.
Problem: With media already loaded on the receiver and the player paused,
setMediaItems(...)followed byplay()loads the new item paused.Cause:
setMediaItemsdispatches the load right away, withautoplay = false.play()then sees the previous item'sMediaStatusand callsremoteMediaClient.play()while the load is still in flight. That request targets the media session the load is replacing, so the receiver rejects it. The next status update reports the new item as paused and resetsplayWhenReadytofalse.Fix:
CastQueueOrchestratornow tracks whether the active operation is a load (setMediaItems,addMediaItemsinto an empty receiver queue, or a reload from the ended state). While one is in flight,setPlayWhenReadykeepsplayWhenReadymasked and asks the orchestrator to run the play/pause once the load completes. Only the last call is sent, and if the load is replaced by another load, the call waits for the newer one. Without a load in flight, nothing changes.Tests: New
RemoteCastPlayerTestcases:play()during a pending load is sent after the load and the player ends up playing.play()thenpause()during a load only sendspause().REPLACEDresult) sendsplay()only after the latest load completes.play()with no load in flight is still sent right away.The first three fail without the fix. All
lib-castunit tests pass.🤖 Generated with Claude Code