Google Cast: Key Concepts, Streaming Protocol and Cast SDK

Author: IT Sectr Published: 2026-04-30 Reading time: 10 min

Google Cast is a technology from Google for streaming multimedia content from mobile devices to TVs and audio systems via the Cast protocol. The SDK allows developers to add Chromecast support to Android and iOS applications, sending video, audio and images to big screens. According to Google Cast Developer Documentation, 2025, over 100 million Chromecast devices have been sold worldwide, and the Cast SDK is used in 40,000+ applications.

Key Takeaways

  • Google Cast — a protocol and SDK for streaming content from mobile devices to TVs and speakers
  • Sender — the mobile application that sends content to a Cast device
  • Receiver — the application on the TV (Chromecast) that receives and plays content
  • CAF SDK — Cast Application Framework, a simplified API for Cast integration (recommended by Google)
  • Media Streams — HLS, DASH and MP4 streaming via Cast with playback control

What is Google Cast?

Google Cast is a wireless multimedia content transmission protocol developed by Google for streaming from mobile devices, laptops and tablets to TVs, speakers and other screens. Unlike AirPlay (Apple) or Miracast, Cast uses the “send URL” model (send-to-device): the mobile app sends a content URL to Chromecast, and the device itself loads and plays the stream without burdening the phone.

The key advantage of Google Cast over direct streaming (screen mirroring) is energy efficiency. After playback starts, the phone acts only as a remote control: the user can minimize the app, lock the screen, or switch to another app — the video continues playing on the TV. According to Google (2025), Cast consumes 80% less power on the phone compared to mirroring solutions.

Google Cast supports not only Chromecast, but also built-in Cast receivers in TVs from Sony, TCL, Philips, Hisense and other manufacturers with Google TV or Android TV. Cast is also supported in audio systems (Nest Audio, Sonos with Cast) and Chromecast Audio. The Cast protocol works over Wi-Fi (2.4/5 GHz) and requires the sender and receiver to be on the same network.

Cast Architecture: Sender, Receiver and Protocols

The Google Cast architecture consists of three components: Sender (mobile app), Receiver (app on Chromecast/TV) and the transport protocol. The Sender uses the Cast SDK to discover devices on the network, establish a connection and send playback commands. The Receiver is a web application (HTML5 + CSS + JavaScript) running in the Chromecast browser that loads and plays content.

The Google Cast protocol is based on DIAL (Discovery and Launch) for device discovery and a proprietary protocol over WebSocket for playback control. DIAL uses SSDP (Simple Service Discovery Protocol) to find Cast devices on the local network. After discovery, the Sender establishes a WebSocket connection with the Receiver on port 8008 or 8009 and sends commands in JSON format: LOAD, PLAY, PAUSE, STOP, SEEK.

ComponentPlatformTechnology
SenderAndroid / iOS / ChromeCast SDK (Java/Kotlin, Swift, JS)
Default ReceiverChromecast / Android TVBuilt-in (configured via Google Cast Console)
Custom ReceiverChromecast / Android TVWeb application (HTML5, CAF Receiver JS)
ProtocolLocal Wi-Fi networkWebSocket + JSON + DIAL/SSDP
Media TransportInternetHLS, DASH, MP4 (direct Chromecast loading)

Cast Protocol v2 for Playback Control

The Sender sends to the Receiver not the content itself, but a URL (media URL) and metadata (title, image, subtitles). The Receiver independently loads content from the URL, which saves the phone’s battery from data transmission. After playback starts, the Sender can send pause, rewind, volume control commands and receive playback status via Cast Protocol v2.

Cast Application Framework (CAF): Quick Integration

Cast Application Framework (CAF) is a simplified API from Google for integrating Cast into mobile applications, introduced in 2018. CAF replaces the legacy Cast SDK (CastCompanionLibrary) and provides ready-made UI components: Cast Button (device discovery icon), Mini Controller (mini player at the bottom of the screen) and Expanded Controller (full-screen remote). CAF supports Android, iOS, Flutter and React Native.

To use CAF, the developer does not need to write their own Receiver — Google provides a Default Receiver that automatically loads and plays content. The Default Receiver supports HLS, DASH, MP4, WebM, MP3, images and subtitles. Receiver configuration is done in the Google Cast Console — just specify the content URL, and the Default Receiver will handle everything else. A Custom Receiver is only required for non-standard scenarios: custom TV UI, DRM support, playback queues.

kotlin
// Configuring CAF Receiver Options
val receiverOptions = CastReceiverOptions.Builder(context)
    .setReceiverApplicationId(
        CastMediaControlIntent.DEFAULT_MEDIA_RECEIVER_APPLICATION_ID
    )
    .build()

// Connecting Cast Context
val castContext = CastContext.getSharedInstance(context)
castContext.setReceiverOptions(receiverOptions)

Cast Connect: Testing Without a Physical Device

CAF automatically handles the connection lifecycle: device discovery via Cast Button, connection establishment, media loading, pause on temporary connection loss and reconnection. CAF also supports playback queues (media queues) for playlists and the Cast button on the Lock Screen and Notification Center (Android). Minimum version: Android 5.0 (API 21), iOS 14+.

Media Streaming: HLS, DASH and MP4 on Chromecast

Google Cast supports major streaming formats: HLS (HTTP Live Streaming) from Apple, DASH (Dynamic Adaptive Streaming over HTTP) and progressive MP4. Chromecast automatically selects the optimal video quality based on internet connection speed (adaptive bitrate). For HLS and DASH, Chromecast switches streams in real time without stopping playback. HLS is supported from Chromecast firmware version 1.28+.

For streaming via Google Cast, content must be accessible at a public URL (HTTP/HTTPS) — Chromecast loads content directly from the server, not from the phone. DRM (Digital Rights Management) is supported via Widevine: Chromecast supports Widevine L3 (all devices) and L1 (some models, e.g., Chromecast with Google TV). Working with DRM requires a custom Receiver with Shaka Player or ExoPlayer integration. According to Google, Chromecast with Google TV supports 4K HDR with Widevine L1 for Netflix, Disney+ and other services.

kotlin
// Loading Media to Chromecast via CAF
val mediaInfo = MediaInfo.Builder(Uri.parse(videoUrl))
    .setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
    .setContentType("video/mp4")
    .setMetadata(MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE)
        .putString(MediaMetadata.KEY_TITLE, title)
        .putString(MediaMetadata.KEY_SUBTITLE, subtitle))
    .build()

CastSession.RemoteMediaClient
    ?.load(mediaInfo, autoPlay = true)

Subtitle formats: Chromecast supports TTML, WebVTT and CEA-608. Subtitles are passed as part of MediaInfo via MediaTrack. Chromecast also supports asynchronous image loading (photos) with swipe capability between images via the Cast Queue API. For audio, Chromecast supports MP3, AAC, FLAC, WAV and OGG. Audio streaming via Google Cast is supported on Chromecast Audio and Cast speakers.

Cast UI Components: Cast Button and Mini Controller

Cast Button is a key UI component of the Google Cast SDK that displays the Cast icon and automatically changes state: inactive (no devices), available (devices found), connected (active session). When clicked, the Cast Button opens a device selection dialog. The component is available via MediaRouteActionProvider (Android) or GCKUICastButton (iOS). The Cast Button should only be visible when Cast devices are available on the network — CAF automatically hides the button if no devices are found.

Mini Controller is a panel at the bottom of the screen showing the content title, cover art, play/pause buttons and session close button. The Mini Controller appears automatically when a Cast session is active and the user is on a screen not related to playback. CAF provides a ready-made MiniControllerFragment for Android that is embedded in the layout. By default, the Mini Controller is located at the bottom of the screen but can be positioned anywhere.

kotlin
// Customizing Mini Controller via Styles
// styles.xml
// <style name="CastMiniControllerStyle"
//     parent="Theme.GoogleCast">
//     <item name="castMiniBackgroundColor">#FF0000</item>
//     <item name="castShowImageThumbnail">true</item>
// </style>

// Programmatic Mini Controller Control
val miniController = findViewById<MiniControllerFragment>(
    R.id.miniController
)
miniController.setVisibility(
    isCastSessionActive()
)

Expanded Controller is a full-screen playback control on the TV, opened by clicking on the Mini Controller. The Expanded Controller shows: title, description, cover art, a progress bar with seek capability, play/pause/stop buttons, track list (if queued), volume control and a disconnect button. CAF provides a ready-made ExpandedControllerActivity that launches automatically. If a custom UI is needed, extend the base ExpandedControllerActivity.

Custom Receiver: Your Own Interface on the TV

A Custom Receiver is a web application (HTML5 + CSS + JavaScript) that loads on Chromecast when a Cast session starts. Unlike the Default Receiver, a custom one allows full control over the content appearance on the TV: background images, animations, custom controls, brand logo. The Custom Receiver is registered in the Google Cast Console and receives a unique Application ID.

Custom Receiver development is done in JavaScript using the Cast Receiver Framework (CAF Receiver). CAF Receiver provides an API for handling incoming messages from the Sender, managing the media stream, handling queues and integrating with DRM. The Receiver runs in an isolated browser environment on Chromecast (WebKit) with limited DOM access. Minimum requirements: HTML5, CSS3, JavaScript ES6. The Receiver is hosted on an HTTPS server.

js
// Basic Custom Receiver on CAF
const context = cast.framework.CastReceiverContext.getInstance()
const playerManager = context.getPlayerManager()

playerManager.setMessageInterceptor(
    cast.framework.messages.MessageType.LOAD,
    (loadData) => {
        // Custom Media Loading Handling
        console.log("Loading media:", loadData.media.contentId)
        return loadData
    }
)

context.start()

// Handling Custom Messages from Sender
context.addCustomMessageListener("urn:x-cast:custom", (event) => {
    console.log("Custom data:", event.data)
})

Developing and Deploying a Custom Receiver

A Custom Receiver must be tested on a real device via the Cast Developer Console. Google recommends using the Default Receiver for standard scenarios and a custom one only when a custom TV UI, DRM support (Widevine) or playback queues with custom logic are needed. The Receiver does not have access to the Sender page DOM and cannot execute JavaScript sent from the Sender (security).

Code Example: Google Cast Integration on Android

A complete example of integrating Google Cast into an Android application using CAF. The app plays video and allows streaming it to Chromecast via the Cast Button. The code includes CastOptions configuration, CastContext initialization, connection handling and media loading to the Cast device.

kotlin
class CastPlayerActivity : AppCompatActivity() {

    private lateinit var castContext: CastContext

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setupCast()
        setContentView(R.layout.activity_player)
    }

    private fun setupCast() {
        CastOptions.Builder()
            .setReceiverApplicationId(
                CastMediaControlIntent.DEFAULT_MEDIA_RECEIVER_APPLICATION_ID
            )
            .build()
            .let {
                castContext = CastContext.getSharedInstance(this)
            }
    }

    fun castVideo(videoUrl: String, title: String) {
        val mediaInfo = MediaInfo.Builder(Uri.parse(videoUrl))
            .setContentType("video/mp4")
            .setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
            .setMetadata(MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE)
                .putString(MediaMetadata.KEY_TITLE, title))
            .build()

        castContext.sessionManager.getCurrentCastSession()
            ?.remoteMediaClient
            ?.load(mediaInfo)
    }
}

For testing Google Cast, use a virtual Cast device via Chrome DevTools (Cast tab) or a physical Chromecast. Google provides a test Application ID — CC1AD845 (Default Media Receiver). Before publishing, register your application in the Google Cast Console and get a Production Application ID. Cast SDK requires Google Play Services 21.0.0+ and Android 5.0+.

Common Issues and Cast Debugging

The first common issue — Cast Button does not appear. Causes: devices are not on the same Wi-Fi network, Chromecast does not support DIAL (outdated firmware), or Wi-Fi discovery is disabled on the phone. Solution: check that the phone and Chromecast are connected to the same network (2.4 GHz or 5 GHz). Google Cast does not work on guest Wi-Fi networks, VPN or corporate networks with client isolation. Use Cast Connect for testing without a physical device.

The second issue — connection drops during playback. Chromecast may lose Wi-Fi connection due to weak signal, channel congestion or interference from a microwave (2.4 GHz). Solution: place Chromecast closer to the router, use 5 GHz (if supported), configure QoS for Chromecast traffic. In the application, handle the onRemoteMediaPlayerStatusUpdated callback with IDLE state and error reason — on connection loss, show a notification and offer to reconnect.

The third issue — content does not play on Chromecast. Check: the content URL is accessible from the internet (Chromecast loads content directly, not through the phone), the format is supported by Chromecast, and there is no CORS blocking (for .m3u8 and .mpd). If using the Default Receiver, make sure the Application ID is correct. For a custom Receiver, check that the application is hosted on HTTPS. Use the Cast SDK Logger for debugging: CastContext.getSharedInstance().setCastLogger(...).

Frequently Asked Questions

How is Google Cast different from AirPlay and Miracast?

Google Cast uses the “send URL” model — the phone sends Chromecast a content link, which loads directly. AirPlay (Apple) is a similar protocol for the Apple ecosystem. Miracast is direct screen mirroring that burdens the phone. Cast consumes 80% less phone battery and allows minimizing the app without stopping playback.

Do I need Chromecast for Google Cast to work?

Google Cast works not only on Chromecast, but also on TVs with built-in Google TV, Android TV, as well as audio systems with Cast support (Nest Audio, Sonos). For development and testing, you can use a virtual Cast device through Chrome DevTools. For Cast integration in an app, a physical device is not required — use Cast Connect for emulation.

Does Google Cast support 4K and HDR?

Yes, Chromecast with Google TV (2020) and newer models support 4K HDR with Dolby Vision, HDR10 and HDR10+. Standard Chromecast (3rd generation) supports 1080p 60fps. Chromecast Ultra — 4K HDR. For 4K streaming, an internet speed of at least 25 Mbps and Widevine L1 support for DRM content (Netflix, Disney+) are required.

How do I stop a Cast session programmatically?

To stop a session, call CastSession.endSession(boolean stopCasting) with true if you need to stop playback on the TV, or false if you just want to disconnect the phone. You can also use the stop() method on RemoteMediaClient. The user can also stop the session via the Cast Button or Mini Controller by pressing the disconnect button.

Can I send custom data via Google Cast?

Yes, through custom messages. The Sender sends a message via a namespace (e.g., urn:x-cast:custom.namespace) with an arbitrary JSON object. The Receiver processes the message via addCustomMessageListener. Custom messages are only supported with a custom Receiver — the Default Receiver does not handle custom namespaces. The maximum message size is 64 KB.

Summary

  • Google Cast — a content streaming protocol from mobile devices to TVs via Chromecast and Android TV
  • Architecture — the Sender (app) sends a content URL, the Receiver (Chromecast) loads and plays it
  • CAF SDK — Cast Application Framework with ready-made Cast Button, Mini Controller and Expanded Controller components
  • Formats — HLS, DASH, MP4, WebM, MP3, AAC, FLAC with adaptive bitrate and subtitles
  • Default Receiver — Google’s built-in receiver for quick integration without writing TV-side code
  • Custom Receiver — a web application in HTML5/JS for customizing the interface and DRM on the TV
  • Debugging — check Wi-Fi network, content URL and format support; use the Cast SDK Logger

We will develop a mobile application turnkey

IT Sectr creates iOS and Android applications for startups and businesses since 2017. We will advise you and propose the best solution.

Discuss the project

Read also