Docs

Cast (Chromecast)

Optional Chromecast support via @moviie/player-expo/cast: install only if you need it.

Cast to another screen

@moviie/player-expo supports transmitting playback to a Chromecast device (Android and iOS) via the optional subpath @moviie/player-expo/cast. Consumers who don't need cast do not install any extra dependency: the main package never imports react-native-google-cast.

Optional install

pnpm add react-native-google-cast

Add the react-native-google-cast config plugin to app.json (the package ships its own plugin):

{
  "expo": {
    "plugins": [
      ["@moviie/player-expo", { ... }],
      [
        "react-native-google-cast",
        {
          "iosReceiverAppId": "CC1AD845",
          "androidReceiverAppId": "CC1AD845"
        }
      ]
    ]
  }
}

CC1AD845 is the Default Media Receiver ID: works out of the box. Use a custom receiver only if you've registered one in the Google Cast SDK Developer Console.

Rebuild native projects after changing plugins:

pnpm prebuild

Wire the adapter

import { useMemo } from "react"
import { MoviieVideo, useMoviiePlayer } from "@moviie/player-expo"
import { createGoogleCastAdapter } from "@moviie/player-expo/cast"

export default function VideoScreen() {
  const moviie = useMoviiePlayer({ embedId: "<embedId>" })
  const castAdapter = useMemo(() => createGoogleCastAdapter(), [])

  return (
    <MoviieVideo {...moviie} castAdapter={castAdapter} aspectRatio={16 / 9} />
  )
}

The cast button appears in the player chrome whenever:

  1. The embed has Chromecast enabled in the dashboard (Settings → Player → Chromecast); and
  2. castAdapter is provided; and
  3. At least one cast-capable device is on the local network.

While connected, the local player pauses and playback continues on the receiver.

Dashboard is the source of truth

The Chromecast toggle in the Moviie dashboard controls availability per embed (default: on). When the toggle is off, the cast button does not appear even if the adapter is wired.

Explicit override

Both directions can be forced via the cast prop on MoviieVideo:

// Force-enable even if dashboard has it off
<MoviieVideo {...moviie} castAdapter={castAdapter} cast />

// Force-disable even if dashboard has it on (silences the missing-adapter warning too)
<MoviieVideo {...moviie} cast={false} />

Resilience: no adapter, no problem

If the embed enables Chromecast but you don't pass a castAdapter, the cast button is hidden and the player works normally. To explicitly disable cast regardless of the dashboard setting, pass cast={false}.

On this page