Skip to content

Fix: Implement CastMediaRouteController to enable Google Cast functionality#3505

Open
OsirisLord wants to merge 1 commit into
microg:masterfrom
OsirisLord:fix-cast-route-controller
Open

Fix: Implement CastMediaRouteController to enable Google Cast functionality#3505
OsirisLord wants to merge 1 commit into
microg:masterfrom
OsirisLord:fix-cast-route-controller

Conversation

@OsirisLord
Copy link
Copy Markdown

Summary

This PR fixes Google Cast (Chromecast) functionality in microG by implementing the previously stubbed CastMediaRouteController methods. The cast button has been showing discovered devices, but selecting a device did nothing because onSelect(), onControlRequest(), onRelease(), and other methods were empty stubs.

Changes

CastMediaRouteController.java - All methods implemented:

  • onSelect(): Connects to the Chromecast device via TCP/TLS using the existing su.litvak.chromecast library (which handles the TLS certificate exchange and pairing internally). Queries device status after connection.
  • onControlRequest(): Dispatches MediaControlIntent actions to specific handlers:
    • ACTION_START_SESSION: Launches the requested Cast receiver app (or default CC1AD845)
    • ACTION_PLAY: Loads media by URL/mime type on the receiver
    • ACTION_PAUSE / ACTION_RESUME: Pauses/resumes playback
    • ACTION_SEEK: Seeks to a specified position
    • ACTION_STOP: Stops current media
    • ACTION_GET_STATUS / ACTION_SYNC_STATUS: Queries device and session status
    • ACTION_END_SESSION: Stops the running session
  • onRelease() / onUnselect(): Cleanly disconnects from the device
  • onSetVolume() / onUpdateVolume(): Forwards volume changes to the device
  • All network operations run on background threads via AsyncTask to avoid blocking the UI thread

Scope

This is strictly scoped to the Cast v1 MediaRouteProvider → RouteController pathway. It does not include:

  • Cast v2 framework dynamite module (separate follow-up needed)
  • Roku/DIAL protocol support (separate issue/PR)
  • Changes to CastDeviceControllerImpl or CastDeviceControllerService (Binder pathway was already functional)

Testing

Manual testing is required on a device running microG:

  1. Build the modified GmsCore APK
  2. Test with YouTube (cast button should now connect when selecting a device)
  3. Test with VLC (known to work via Binder path — should still work)
  4. Test with Google's CastVideos-android sample app
  5. Monitor logcat for GmsCastRouteController tags

Fixes #580

@ItsJustSomeDude
Copy link
Copy Markdown

You tested this, huh? It's a blob of base64. And the Java that does exist in the decoded blob: does it work? I wouldn't hold my breath.

It takes .1 seconds of looking at the diff to be like "wait... this doesn't look right."

Probably slop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

What's the status on Google Cast implementation?

2 participants