Agent skill

Media3 Cast Integration

by arindamxd in arindamxd/camerax-android

Implements Google Cast support in Android apps using Jetpack Media3.

Apache-2.0Auto-check passedMobile

Install Media3 Cast Integration

skills CLI
$ npx skills add arindamxd/camerax-android --skill media3-cast-integration -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install arindamxd/camerax-android media3-cast-integration --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/arindamxd/camerax-android.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/media3-cast-integration .claude/skills/media3-cast-integration && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
media3-cast-integration
GitHub stars
132
Used in
2 other repos
Token cost
~2.7k tokens
SKILL.md length
905 words
Files
4 (incl. references)
Skills in repo
21
Repo updated
First seen
Licence
Apache-2.0

At a glance

Implements Google Cast support in Android apps using Jetpack Media3.

  • Works in 5 steps: Set up dependencies → Update the manifest → Implement the player and service → …
  • Adding Cast functionality
  • SKILL.md covers Prerequisites, Glossary, Common guidelines and Step 1: Set up dependencies, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Media3 Cast Integration is an agent skill from arindamxd/camerax-android. Implements Google Cast support in Android apps using Jetpack Media3. Handles adding build dependencies, updating manifest, configuring OptionsProvider, and managing CastPlayer or RemoteCastPlayer for playback in both Compose and View-based UIs. Use when adding Cast functionality or migrating from legacy Cast SDK to Media3 Cast.

Its SKILL.md is about 2.7k tokens, which your agent loads only when the skill is triggered. The skill folder holds 8 other files, including reference files (for example `references/android/media/media3/cast/create-castplayer.md`, `references/android/media/media3/cast/customize-castoptions.md` and `references/android/media/media3/cast/index.md`).

It sits in Mobile, covering Android development. It works with Android. The repository describes itself as: A Play Store camera app showing Jetpack CameraX APIs in Kotlin — install it, use it, copy the patterns. The licence is Apache-2.0.

When your agent uses it

  • Adding Cast functionality
  • Migrating from legacy Cast SDK to Media3 Cast

Example prompts

  • “Use the media3-cast-integration skill to implement Google Cast support in Android apps using Jetpack Media3”
  • “/media3-cast-integration”

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Set up dependencies
  2. Update the manifest
  3. Implement the player and service
  4. Set up the UI
  5. Clean up legacy Cast SDK code

What it can do on your machine

Read from SKILL.md and the folder at commit 7c36352. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • developer.android.com
    • developers.google.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Media3 Cast Integration loads about 2.7k tokens when it runs, and up to ~7.4k if it reads all its reference files. Until then it costs about 88 tokens; SKILL.md has 905 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~88
When it runs · the whole SKILL.md, loaded when a task matches
~2.7k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~7.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from arindamxd/camerax-android at commit 7c36352, republished under its Apache-2.0 licence (© arindamxd). 905 words, ~2,677 tokens.

Download SKILL.mdSave it as .claude/skills/media3-cast-integration/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
media3-cast-integration
description
Implements Google Cast support in Android apps using Jetpack Media3. Handles adding build dependencies, updating manifest, configuring OptionsProvider, and managing CastPlayer or RemoteCastPlayer for playback in both Compose and View-based UIs. Use when adding Cast functionality or migrating from legacy Cast SDK to Media3 Cast.
license
Complete terms in LICENSE.txt
metadata.author
Google LLC
metadata.last-updated
2026-08-06
metadata.keywords
Android, Media3, Cast, Integration, Migration, ExoPlayer, MediaSession, Jetpack Media3

Prerequisites

  • Jetpack Media3 version must be >= 1.9.0. Cast isn't available in lower versions.

Glossary

  • CastPlayer : Media3 Player that controls playback on both local and remote Cast devices.
  • RemoteCastPlayer : Media3 Player that communicates with a Cast receiver, only used for remote playback.
  • Google Cast SDK: Legacy casting SDK in maintenance mode, superseded by Jetpack Media3.
  • OptionsProvider : Interface providing configuration options to initialize GMS CastContext.

Common guidelines

Step 1: Set up dependencies

To complete this step, you MUST ensure the following:

  • In the app-level build file, declare the media3-cast dependency version 1.9.0 or higher.

    implementation("androidx.media3:media3-cast:1.10.1")
    
  • Ensure required Media3 dependencies are present:

    • androidx.media3:media3-exoplayer
    • androidx.media3:media3-session
    • androidx.media3:media3-ui-compose
  • If the application uses legacy Views, add media3-ui.

  • Enforce the same versions across all Media3 dependencies.

  • Use configurations in "Add build dependencies" section of Getting started with CastPlayer as the source of truth.

  • For apps without an existing Cast integration:

    • Verify legacy Cast SDK (libs.play.services.cast.framework) is absent.
  • If Migrating from Legacy Cast SDK:

    • Add Media3 Cast dependencies first.
    • Keep existing legacy dependencies untouched at this stage to prevent compilation errors.

Step 2: Update the manifest

To complete this step, you MUST ensure the following:

  • Inside the manifest's <application> tag, declare the Cast options provider.
  • Use DefaultCastOptionsProvider by default. See the "OptionsProvider" section in Getting started with CastPlayer.
  • Declare a custom OptionsProvider only if explicitly requested. See Customize CastOptions.
  • Ensure INTERNET permission is present. Don't add any unnecessary permissions.
  • If Migrating from Legacy Cast SDK:
    • Don't delete existing custom options provider files or manifest entries.

Step 3: Implement the player and service

Architecture baseline

Before integrating Media3 Cast, an existing app follows one of two setups:

  • Local-only playback: Uses Media3 ExoPlayer only to support local playback.
  • Legacy Cast setup: Uses ExoPlayer for local playback, alongside a Player wrapper over the legacy RemoteMediaClient for remote playback. The UI interfaces with a MediaSession interacting with a ForwardingPlayer, which finally routes controls to either local or remote playback.

To complete this step, you MUST ensure the following:

  • Inside the application's MediaSessionService (or MediaLibraryService) onCreate() method, initialize ExoPlayer and CastPlayer.
  • Use CastPlayer by default unless RemoteCastPlayer is explicitly requested. See the "Build a CastPlayer" section in Getting started with CastPlayer.
  • For CastPlayer, pass the instance directly to MediaSession.Builder.
  • Replace all legacy forwarding player wrappers.
  • Don't delete legacy class files yet to prevent compilation errors during migration.
Advanced: RemoteCastPlayer
  • Use RemoteCastPlayer only if explicitly requested by user.

  • Initialize MediaSession with localPlayer and set a SessionAvailabilityListener on RemoteCastPlayer to transfer playback state on Cast session availability changes:

    class PlaybackService : MediaSessionService() { private var mediaSession: MediaSession? = null private lateinit var localPlayer: ExoPlayer private lateinit var remotePlayer: RemoteCastPlayer override fun onCreate() { super.onCreate() localPlayer = ExoPlayer.Builder(this).build() remotePlayer = RemoteCastPlayer.Builder(this).build() mediaSession = MediaSession.Builder(this, localPlayer).build() remotePlayer.setSessionAvailabilityListener( object : SessionAvailabilityListener { override fun onCastSessionAvailable() { transferPlaybackState(localPlayer, remotePlayer) } override fun onCastSessionUnavailable() { transferPlaybackState(remotePlayer, localPlayer) } } ) } private fun transferPlaybackState(previousPlayer: Player, newPlayer: Player) { if (previousPlayer.mediaItemCount > 0) { val transferStateBuilder = PlayerTransferState.builderFromPlayer(previousPlayer) if (previousPlayer.playbackState == Player.STATE_ENDED || previousPlayer.currentPosition == C.TIME_END_OF_SOURCE) { transferStateBuilder.setCurrentMediaItemIndex(0) transferStateBuilder.setCurrentPosition(0) } transferStateBuilder.build().setToPlayer(newPlayer) } previousPlayer.stop() previousPlayer.clearMediaItems() newPlayer.prepare() mediaSession?.setPlayer(newPlayer) } }

Step 4: Set up the UI

Show full SKILL.md (394 more words)Show less
Compose-based UI

To complete this step, you MUST ensure the following:

  • See the "Add a MediaRouteButton Composable to the Player" section in Getting started with CastPlayer for Compose integration guidelines.

  • Use the MediaRouteButton composable from androidx.media3.cast package.

  • Don't use AndroidView in the Compose UI hierarchy.

  • Place MediaRouteButton in an area next to playback controls. Don't hide it behind system UI.

  • Don't use PlayerSurface for custom player UI. Use the Material3 Player composable.

  • Force recomposition on playback location shifts to ensure UI sync. Use key constraints on DeviceInfo changes:

    @OptIn(UnstableApi::class)
    @Composable
    fun MainScreen() {
       val player = rememberMediaController()
       val deviceInfo = rememberDeviceInfo(player)
       player?.let { activePlayer -> key(deviceInfo) { PlayerScreen(player = activePlayer) } }
    }
    
    @Composable
    private fun rememberMediaController(): Player? {
       // Logic to connect MediaController to MediaSession and release it
    }
    
    @Composable
    private fun rememberDeviceInfo(player: Player?): DeviceInfo? {
       var deviceInfo by remember(player) { mutableStateOf(player?.deviceInfo) }
       DisposableEffect(player) {
           val activePlayer = player ?: return@DisposableEffect onDispose {}
           deviceInfo = activePlayer.deviceInfo
           val listener = object : Player.Listener {
               override fun onDeviceInfoChanged(info: DeviceInfo) {
                   deviceInfo = info
               }
           }
          activePlayer.addListener(listener)
          onDispose { activePlayer.removeListener(listener) }
       }
       return deviceInfo
    }
View-based UI

To complete this step, you MUST ensure the following:

  • For View-based UI setups, see the "Add UI elements" section in Getting started with CastPlayer.

  • Casting Activities must extend AppCompatActivity or FragmentActivity and use a Theme.AppCompat descendant.

  • Ensure the AppCompat theme has a visible ActionBar if adding MediaRouteButton to the options menu.

  • Replace all instances and imports of CastButtonFactory with MediaRouteButtonFactory.

  • Rebind PlayerView.player references upon onDeviceInfoChanged events to prevent black screens or UI freezes:

    private val playerListener: Player.Listener =
      object : Player.Listener {
        override fun onDeviceInfoChanged(deviceInfo: DeviceInfo) {
          // Resetting to null bypasses PlayerView.setPlayer()'s instance equality check
          // (this.player == player), forcing it to re-bind the video surface to the controller.
          playerView.player = null
          playerView.player = controller
        }
      }
    
  • Migration to Compose:

Step 5: Clean up legacy Cast SDK code

[!WARNING] Warning: Don't perform cleanup directly. Remove legacy files and dependencies only when explicitly requested by the user.

To complete this step, you MUST ensure the following:

  • Remove legacy GMS Cast SDK (libs.play.services.cast.framework) and MediaRouter (libs.androidx.mediarouter) dependencies.
  • Delete custom OptionsProvider classes and manifest entries if DefaultCastOptionsProvider is adopted.
  • Remove legacy MediaTransferReceiver manifest declarations if present.
  • Remove all references to legacy Cast SDK components such as legacy helper wrappers, forwarding players, and RemoteMediaClient interfaces.
  • Delete legacy View XML layouts, menu files, and references to PlayerView if the migration to Compose is complete.

© arindamxd, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (references) in .agents/skills/media3-cast-integration of arindamxd/camerax-android.

  • SKILL.md
  • references/android/media/media3/cast/create-castplayer.md
  • references/android/media/media3/cast/customize-castoptions.md
  • references/android/media/media3/cast/index.md

Open the folder on GitHubat commit 7c36352

Used in 2 other repositories

We found 4 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 2 other GitHub owners. This page covers the copy in arindamxd/camerax-android, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Media3 Cast Integration next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Media3 Cast Integration compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Media3 Cast Integration this skillarindamxd/camerax-android1322 repos~2.7kAutomated safety check: PassApache-2.0
Compose Multiplatform Patternsmonta-app/ocpp-emulator1805 repos~2kAutomated safety check: PassApache-2.0
Mobile QAtloncorp/tlon-apps107—~2.4kAutomated safety check: PassMIT
Ha Android UIhome-assistant/android4k—~1.5kAutomated safety check: PassApache-2.0
Android UI AutomationOpenMinis/MinisSkills444—~1.6kAutomated safety check: PassMIT
Android Design Guidelinesehmo/platform-design-skills606—~9.7kAutomated safety check: PassMIT

Similar skills

  • Compose Multiplatform Patterns

    monta-app/ocpp-emulator

    Compose Multiplatform and Jetpack Compose patterns for KMP projects — state management, navigation, theming, performance, and platform-specific UI.

    180 GitHub starsUsed in 5 repos~2k tokens
    MobileAuto-check passed
  • Mobile QA

    tloncorp/tlon-apps

    Run a mobile QA checklist on a physical Android device over adb for tlon-apps, then triage what fails into fixes.

    107 GitHub stars~2.4k tokensUpdated today
    MobileAuto-check passed
  • Ha Android UI

    home-assistant/android

    Home Assistant Android UI guidance. An agent skill from home-assistant/android.

    4k GitHub stars~1.5k tokensUpdated yesterday
    MobileAuto-check passed
  • Android UI Automation

    OpenMinis/MinisSkills

    Automate Android apps that have no public API or web version by driving the UI layer through the Accessibility Service.

    444 GitHub stars~1.6k tokensUpdated today
    MobileAuto-check passed
  • Android Design Guidelines

    ehmo/platform-design-skills

    Material Design 3 and Android platform guidelines. An agent skill from ehmo/platform-design-skills.

    606 GitHub stars~9.7k tokensUpdated 6 mo ago
    MobileAuto-check passed
  • Jetpack Compose Patterns

    ModinMobileSTS/SlayTheAmethystModded

    Applies practical Jetpack Compose patterns to Android UI code: state hoisting, one-way data flow, side effects, modifiers, theming and testable composables.

    402 GitHub stars~1.7k tokensUpdated yesterday
    MobileAuto-check passed

More from arindamxd/camerax-android

All 21 skills in this repo
  • Styles

    arindamxd/camerax-android

    A skill your agent uses to integrate the Jetpack Compose Styles API into an Android project.

    132 GitHub starsUsed in 4 repos~2.3k tokens
    Auto-check passed
  • Verified Email

    arindamxd/camerax-android

    Provides a complete workflow for implementing verified email retrieval on Android Credential Manager API.

    132 GitHub starsUsed in 4 repos~4.7k tokens
    Auto-check passed
  • Edge To Edge

    arindamxd/camerax-android

    A skill your agent uses to migrate your Jetpack Compose app to add adaptive edge-to-edge support and troubleshoot common issues.

    132 GitHub starsUsed in 5 repos~3.6k tokens
    Auto-check passed
  • Camerax

    arindamxd/camerax-android

    Provide technical guidance for Android camera development with CameraX.

    132 GitHub starsUsed in 2 repos~1.6k tokens
    Auto-check passed
  • Leanback To Compose Tv Migration

    arindamxd/camerax-android

    Provides instructions and architectural patterns for migrating Android TV applications from legacy Leanback UI Toolkit, Android Views, or Support Fragments to Jetpack Compose for TV (androidx.tv).

    132 GitHub starsUsed in 2 repos~8.7k tokens
    Auto-check passed
  • Migrate XML Views To Jetpack Compose

    arindamxd/camerax-android

    Provides a structured workflow for migrating an Android XML View to Jetpack Compose.

    132 GitHub starsUsed in 5 repos~1.4k tokens
    Auto-check passed

Works with

Categories

Questions about Media3 Cast Integration

What does Media3 Cast Integration do?

Implements Google Cast support in Android apps using Jetpack Media3. Media3 Cast Integration is an agent skill from arindamxd/camerax-android. Implements Google Cast support in Android apps using Jetpack Media3.

When should I use Media3 Cast Integration?

Media3 Cast Integration fits situations like: adding Cast functionality; migrating from legacy Cast SDK to Media3 Cast.

How do I install Media3 Cast Integration in Claude Code?

Run `npx skills add arindamxd/camerax-android --skill media3-cast-integration -a claude-code`. Or copy the skill folder (.agents/skills/media3-cast-integration in arindamxd/camerax-android) into .claude/skills/media3-cast-integration in your project. Claude Code loads it when a task matches its description.

How do I install Media3 Cast Integration in Codex?

Run `npx skills add arindamxd/camerax-android --skill media3-cast-integration -a codex`. Or copy the skill folder (.agents/skills/media3-cast-integration in arindamxd/camerax-android) into .agents/skills/media3-cast-integration in your project. Codex loads it when a task matches its description.

Can I use Media3 Cast Integration in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add arindamxd/camerax-android --skill media3-cast-integration -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/media3-cast-integration, .gemini/skills/media3-cast-integration, .github/skills/media3-cast-integration and .opencode/skills/media3-cast-integration in your project.

What does Media3 Cast Integration need to run?

SKILL.md names no scripts, command-line tools or credentials: Media3 Cast Integration is instructions for the agent only.

Does Media3 Cast Integration access the network?

SKILL.md names 2 domains. As links in the text: developer.android.com and developers.google.com. This is read from the text; nothing was executed.

Is Media3 Cast Integration safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Media3 Cast Integration use?

Media3 Cast Integration is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Media3 Cast Integration use?

About 2.7k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 4.7k tokens, read only when the agent opens those files.

What are the alternatives to Media3 Cast Integration?

Skills that share tags, products or a category with Media3 Cast Integration: Compose Multiplatform Patterns (monta-app/ocpp-emulator, 180 stars), Mobile QA (tloncorp/tlon-apps, 107 stars), Ha Android UI (home-assistant/android, 4k stars) and Android UI Automation (OpenMinis/MinisSkills, 444 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Media3 Cast Integration?

arindamxd (a GitHub user) maintains it in arindamxd/camerax-android, which has 132 GitHub stars. The repository holds 21 skills in this directory. The repository was last updated on October 2, 2026.

Source: arindamxd/camerax-android on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.