Repository navigation
Description
Version
Media3 1.11.0
More version details
androidx.media3:media3-cast:1.11.0 with play-services-cast-framework:22.3.1. Findings below come from reading the shipped bytecode of media3-cast-1.11.0.aar with javap -c -p.
Devices that reproduce the issue
Not device-specific. The symptom needs a receiver that rejects a request; mine was a Chromecast Audio on the Default Media Receiver (CC1AD845) with a second sender attached to the same session, which made the receiver answer Invalid Request.
Devices that do not reproduce the issue
n/a
Reproducible in the demo app?
Not tested
Reproduction steps
- Cast to a receiver that will reject a request. The reliable way is to join a Default Media Receiver session that another sender is also mutating, so the receiver's sequence numbers stop matching.
- Call
setPlaybackParameters(orsetPlayWhenReady,setRepeatMode,setVolume) on theCastPlayer. - Watch logcat and watch the app.
The Cast SDK reports the rejection:
W/MediaControlChannel: received unexpected error: Invalid Request.
W/MediaControlChannel: Possibility of local queue out of sync with receiver queue.
Refetching sequence number. Current Local Sequence Number = 6
Media3 does not, and the app has no callback through which it could learn.
Expected result
An app can tell that a request it issued was rejected by the receiver, so it can retry, reconcile, or tell the user. Media3 already does this for two other request families, which is why the gap reads as an oversight rather than a deliberate contract:
RemoteCastPlayer$SeekResultCallbackreadsStatus.getStatusCode()and logsSeek failed. Error code.RemoteCastPlayer$StatusListenerlogsSession start failedandSession resume failed.
Actual result
The ResultCallback<MediaChannelResult> instances used for the state setters never look at the result. RemoteCastPlayer$1.onResult is representative — it null-checks the client, clears the pending-result bookkeeping and flushes listener events, and that is all:
public void onResult(RemoteMediaClient$MediaChannelResult);
0: getfield this$0
4: invokestatic RemoteCastPlayer.access$1100 // remoteMediaClient
7: ifnull 28
10: ...
15: invokestatic RemoteCastPlayer.access$1200 // clear pending callback
22: invokestatic RemoteCastPlayer.access$1300 // listeners
25: invokevirtual ListenerSet.flushEvents
28: return
RemoteCastPlayer$2 through $5 have the same shape. None of the five references Status, getStatusCode, or isSuccess; by contrast SeekResultCallback does.
Tracing where those five are constructed, they cover:
| Callback site | Public API |
|---|---|
RemoteCastPlayer$1–$5 |
setPlayWhenReady(boolean), setPlaybackParameters(PlaybackParameters), setRepeatMode(int), setVolume(float), plus updateTracksAndNotifyIfChanged |
So a rejected play/pause, playback-speed, repeat-mode or volume change is indistinguishable from a successful one. The player's masked state reverts on the next receiver status, but nothing tells the app why, and nothing is logged.
The practical consequence for me: playback speed set locally did not take effect on the receiver, and there was no way to find out from the library whether the setPlaybackParameters request had been rejected or never mattered. I ended up re-applying the speed after STATE_READY as a workaround, without being able to confirm which of the two it was.
I have not traced the queue-mutation path (queueInsertItems, queueReorderItems, queueRemoveItems, load) to the same level of certainty, so I am not claiming anything about it here — though those also attach a ResultCallback through StateHolder and were what first sent me looking.
Logging a failure the way SeekResultCallback already does would be enough to make this diagnosable. Surfacing it to the app would be better.
Media
Not content-dependent.
Activity
AquilesCanta commentedon Aug 14, 2026
@tanay187 I would expect the rejected param to be updated with the receiver value after the operation fails. I.e. whatever the result, the pending operation listener should update the remote cast player state with the state advertised by the receiver. According to this code:
@rekinet, does this mean that after remoteMediaClient.setPlaybackRate(...); has failed,
is still yielding the value that you set? That sounds counter-intuitive. Perhaps you can provide additional info here?
I think it makes sense to log operations that fail in remote media client, if only to ease debugging.
rekinet commentedon Oct 19, 2026
@AquilesCanta Apologies for the long delay, and thank you for looking into this.
To answer your question: I did not capture
getPlaybackRate()at the moment of the rejection, so I can't confirm the exact value from a log. What I observed is that the speed did not take effect on the receiver; I have no evidence that the player kept reporting the value I had set. ReadingupdatePlaybackRateAndNotifyIfChanged, the state is reconciled tomediaStatus.getPlaybackRate()whatever the result, so I agree the player state itself should end up matching the receiver.The gap I'm describing is only about diagnosability: when the receiver rejects one of these requests (play/pause, playback speed, repeat mode, volume), nothing is logged or surfaced, so the app cannot tell a rejection apart from an unrelated change on the receiver side. Logging non-success status codes the way
SeekResultCallbackalready does would solve that for me.For completeness, since the issue mentions the queue path: in 1.11.1 the results of
load,queueInsertItemsandqueueReorderItemsare not read either. Forloadthe code comment says this is intentional because the timeline tracker handles the masking, which makes sense for the state; a log line on failure would still help with debugging there.Thank you also to you and @tanay187 for fixing #3372 so quickly.
tanay187 commentedon Oct 22, 2026
Hi @rekinet, we've merged debug logging for errors via c6b70c6.
Queue operations also have debug logs now with commit c74e982
Sorry the commits did not get referenced here. I believe these should cover the scenarios you had in mind. These commits are already a part of Media3 1.12.alpha-01. Do let me know if something is missing. Thanks for reporting!
AquilesCanta commentedon Oct 22, 2026