Cast: system output switcher on Samsung One UI 9 (Android 17) only offers Samsung Audio Mirroring, never a Cast session

Open
#3,500 3 comments 0 reactions 2 assignees View on GitHub

Maintainers usually reply within 5 days

@tanay187 is already working on this.

Since Oct 30, 2026.

Assessment

This issue has not been assessed yet.

Description

bug cast needs triage
Version

Media3 1.11.1

More version details
  • media3-cast 1.11.1, initialized with:
    Cast.getSingletonInstance(this).initialize(
        CastParams.Builder()
            .setReceiverApplicationId(/* custom receiver */)
            .setRemoteToLocalEnabled(true)
            .setShowSystemOutputSwitcherOnCastButtonClick(true)
            .build()
    )
    
  • compileSdk/targetSdk 37. ACCESS_LOCAL_NETWORK is granted, and androidx.mediarouter.media.MediaTransferReceiver is declared in the manifest.
  • The Cast button is set up with MediaRouteButtonFactory.setUpMediaRouteButton.
  • Google Play services 26.42.31, Samsung Audio Mirroring (com.samsung.android.audiomirroring) 4.1.00.5.
Devices that reproduce the issue

Samsung Galaxy S24 (SM-S921B), One UI 9, Android 17 (API 37), build CP2A.260605.016.S921BXXUHEZIF, security patch 2026-09-05. Also reported by a user on Samsung S24 with One UI 9 / Android 17.

Cast devices tried: a Chromecast

Devices that do not reproduce the issue
  • A non-Samsung Android 17 phone, where the system output switcher starts a Cast session normally.
  • Phones below Android 17, including Samsung. They aren't affected, because Media3 only uses the system output switcher on Android 17 and later. Below that, the Cast button opens the Cast dialog.
Reproducible in the demo app?

Yes

Reproduction steps

demos/session on main at 950e56896b reproduces it on the same Samsung S24 (One UI 9 / Android 17):

  1. Open Album Folder → Mango Open Movie project → Play.
  2. Tap the Cast button and pick a Chromecast connected to a TV in Samsung's media output panel.

SessionDemoApplication calls CastParams.Builder().setShowSystemOutputSwitcherOnCastButtonClick(true), so the demo goes through the same system output switcher path. Because the demo uses the default receiver, our custom receiver and app code are ruled out.

Expected result

A Cast session starts on the selected device, and playback moves to the remote player, as it does on non-Samsung Android 17 devices.

Actual result
  • No Cast session starts. SessionManagerListener gets no callbacks at all.
  • SystemUI moves the app's system routing session to Samsung's Audio Mirroring route for that device instead of the app's Cast route. The phone then streams its own audio output to the device.
  • If the app has a video decoder open, Audio Mirroring refuses and shows the toast "Can't play video while mirroring sound to Wi-Fi speaker". Its allow list of apps that may play video while mirroring only contains Spotify.

Screenshot of the toast:
Image

The only transferable routes SystemUI offers the app are Samsung's Audio Mirroring routes. The Cast routes from Play services (com.google.android.gms/.cast.media.CastMediaRoute2ProviderService_Persistent:…) are discovered by the app's MediaRouter with the app's Cast category, but they are never offered:

I InfoMediaManager: connectToDevice(), device = <Chromecast>/com.android.server.media/.SystemMediaRoute2Provider2:SYSTEM-com.samsung.android.audiomirroring/.service.MediaRoute2MirroringProviderService-fa48595f…
V MR2     : [proxy-<app>] Transferring routing session. session= RoutingSessionInfo{ sessionId=com.android.server.media/.SystemMediaRoute2Provider2:SYSTEM_SESSION, clientPackageName=<app>, selectedRoutes={…ROUTE_ID_BUILTIN_SPEAKER…}, transferableRoutes={…SYSTEM-com.samsung.android.audiomirroring/.service.MediaRoute2MirroringProviderService-a439b276…, …-2f84f900…, …-fa48595f…} … }, route=MediaRoute2Info{ id=…SYSTEM-com.samsung.android.audiomirroring/…-fa48595f…, type=REMOTE_TV, routingTypes=SYSTEM_AUDIO, isSystem=true, features=[com.google.android.gms.cast.CATEGORY_CAST…, com.samsung.android.audiomirroing.feature.AudioMirroring, android.media.route.feature.LIVE_AUDIO], deduplicationIds=fa48595f…, providerId=com.android.server.media/.SystemMediaRoute2Provider2 … }
I RemoteCast:MirroringProvServ: Current app using VideoCodec
I Toast   : show: caller = N.a.run:21

The Audio Mirroring route has the same deduplication ID as the real Cast route for the same device (fa48595f…).

Workaround

With setShowSystemOutputSwitcherOnCastButtonClick(false), the Cast SDK's own dialog starts a real Cast session on the same device, and playback works. During that transfer, the framework logs the Play services Cast route as non-transferable for the app:

I MR2     : [local] Transferring to a non-transferable route=MediaRoute2Info{ id=com.google.android.gms/.cast.media.CastMediaRoute2ProviderService_Persistent:fa48595f…, type=REMOTE_TV, routingTypes=REMOTE, isSystem=false, … }

If the system output switcher can't offer Cast routes on some devices, could Media3 detect that and fall back to the Cast dialog? Or could the limitation be documented on setShowSystemOutputSwitcherOnCastButtonClick?

Media

Not specific to the media. It reproduces in demos/session with "Mango Open Movie project" from Album Folder, and in our app with an HLS live stream with video, loaded through a custom Web Receiver. Any media fails the same way, because no Cast session ever starts. Audio-only media just gets mirrored without the toast.

Bug Report
  • You will email the zip file produced by adb bugreport to [email protected] after filing this issue.
Dominant language
Java
Stars
3.1k
Forks
1k
Avg merge
8d 4h
Merged PRs (30d)
5

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from androidx/media

All issues in androidx/media

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.