Remote Display

Version warning:
This page and the Remote Display API are for use only with Cast SDK v2
and must not be mixed with v3.

The Google Cast remote display API builds upon existing screen mirroring technologies that
Cast already supports. With the remote display APIs, your sender app can now render directly to any
Cast receiver, like a Chromecast. The remote display on the receiver can present information that is
entirely different than the information presented in the display on the sender device.

This capability allows you to run native games on the sender device, as well as native presentation
applications (for example, a slide show application), and cast them to a receiver device. With the
remote display API, graphics-intensive, high-bandwidth, CPU-gobbling native apps can be cast to the
big screen.

The Google Cast Remote Display API is still in development, released as a
beta version. This document describes features that may change before the API is officially released.

Compatibility

Supported devices and systems are as follows:

Android version 4.4 (API level 19) and later

iOS version 8 and later

These devices have
been tested to work best with Google Cast. Other Android devices might
not have the necessary power to provide an optimized Google Cast experience.

Remote display is not currently supported in Chrome.

Considerations

For Android, audio does not stream while the app is in the background.

For iOS, there is no way to initiate a background service for remote display, and applications
may only request up to 3 minutes of processing time while in the background. An iOS app cannot run
on a remote display while it is in the background.

Implementing the remote display APIs follows the pattern for implementing a
Presentation in Android. The Context of a Presentation is different from the context of its
containing Activity or Service. It is important to inflate the layout of a Presentation and load
other resources using the Presentation's own context to ensure that assets of the correct size and
density for the target display are loaded.

Create the connection

Use the
MediaRouteSelector to find the route for your remote display application ID. You obtain the application
ID when you register your application for remote display. See Registration for
information about registering your app. Here is an example of how to select the route for your application
ID:

iOS Development

First, follow the guide, iOS Sender App Development to get
started with building your app for remote display. Follow the procedures in that document up to,
but not including, Launch application before following the
procedures in this guide.

An app using the Cast Remote Display API for iOS requires a device with at least
512MB of RAM. Devices with less than 1 GB of RAM are limited to casting at 420p. The Cast receiver
upscales 480p to 720p.

Connect your app

As described in Launch application, once your sender
app is connected to the receiver, you can launch your application. You pass in the application ID
that you received when you register your application.
The following example launches the application:

Rendering to the remote display session

You can redirect your app's audio stream by installing a tap on your audio engine's final mix and
setting the samples to zero after the session copies them. Ideally you should integrate remote display
audio in a way that leverages the core audio high priority thread.

Use frame inputs and the session to send video frames. Create a frame input object matching your
rendering API. Frame inputs are adapters that make it easy to integrate your rendering code with
remote display. The general flow is to render to a texture instead of a system surface. Once you have
your remote display frame encoded, hand over the texture to the frame input for processing.

You do not have to send video or audio frames if they are not needed. This is a great way to save
power and bandwidth. For example, if a game is in a paused state with no animations, submit the paused
frame once then stop until the game resumes.

The following code example demonstrates the basic scaffolding for integrating remote display with
a renderer: