Repository navigation
Description
Version
Media3 1.11.1
More version details
media3-cast 1.11.1 with play-services-cast-framework 22.3.1. The two handlers described below look the same on the main branch as of 2026-11-25.
Devices that reproduce the issue
Sender: Asus ROG Phone (model ASUS_AI2201), Android 14. Receiver: Google Nest Mini.
The behaviour depends on how the Cast SDK reports the lost connection, not on the receiver model.
Devices that do not reproduce the issue
On a Poco phone a 10-second Wi-Fi gap was reported as onSessionSuspended, which RemoteCastPlayer handles correctly. On the Asus phone a 12-second gap was not reported as a session loss at all (Connected to device. rejoinedApp: true).
Reproducible in the demo app?
Not tested
Reproduction steps
- Cast a long item to a receiver with
CastPlayer(local player +RemoteCastPlayer). - Disable Wi-Fi on the phone for about 45 seconds (
adb shell svc wifi disable), then enable it again. - Watch the
SessionManagerListenercallbacks and the player state.
Measured sequence (local file streamed to a Nest Mini, receiver observed from another machine):
| Time | Event |
|---|---|
| 0 s | phone Wi-Fi off; receiver keeps playing from its buffer |
| 19 s | Cast service: onConnectionFailed, socket error 2259; listeners get onSessionStartFailed for the session that was already running — no onSessionSuspended, no onSessionEnding, no onSessionEnded |
| 19 s | remote queue becomes empty; no transfer to the local player |
| 45 s | Wi-Fi back; Cast service reconnects to devices on the network, the app session is not resumed |
| up to 10 min | no change |
Expected result
RemoteCastPlayer treats onSessionStartFailed and onSessionResumeFailed for the session it currently holds like onSessionEnded: it drops the remote media client, so CastPlayer can transfer back to the local player and the app can react.
Actual result
RemoteCastPlayer only logs in onSessionStartFailed and onSessionResumeFailed. It releases the remote media client only in onSessionEnding, onSessionEnded and onSessionSuspended. After the sequence above the player keeps a CastSession that the SDK no longer has:
CastPlayerstays on the remote player, no transfer back to the local player happens;- the remote queue is empty and the media session state is
NONE; - play, pause and seek have no effect, the position is frozen;
- the receiver keeps playing on its own;
- the Cast button still reports "connected", while the Cast dialog shows the device picker, because the SDK has no session.
The app stays in this state until the user picks the same device again. We left it for 10 minutes with no change.
Workaround we use: we register our own SessionManagerListener and, on onSessionStartFailed / onSessionResumeFailed, forward onSessionEnded to the player's internal listener. There is no public way to do that — we reach the private RemoteCastPlayer.statusListener field by reflection and pin the field name and type with a test. Handling these two callbacks in the player, or a public hook, would remove the need for it.
Media
Not media specific. Reproduced with a local MP3 file served to the receiver over HTTP.
Bug Report
- You will email the zip file produced by
adb bugreportto android-media-github@google.com after filing this issue.
Activity