Skip to main content
Skip table of contents

Casting playback to Chromecast

To test this feature and view the example code, please see the Android SDK 5 Example Code Quick Start guide.

Casting content to a Google Cast-supporting device (such as Chromecast) does not require the use of the CONNECT Player SDK. Nevertheless, example code is provided with the SDK package, demonstrating how the application can switch playback from the device (using the CONNECT player) and a Chromecast device.

The chromecast example code in this project contains two source parts:

  • The sender code - the Android example source code in charge of playback on the Android device and controlling the casting.

  • The receiver html+js source code that runs on the Google Cast device.

The receiver part of the code is located alongside the example code for reference only. To make this code available for use by the Chromecast device:

  • The receiver application code needs to be hosted on an HTTP server.

  • The hosted app's URL needs to be registered and published through the Google Cast registry.

  • Once the application is registered it is assigned an Application ID (an 8-digit hexadecimal number) which is used by the Chromecast device to load the application.

For the use of this example code, the receiver application is already registered by Nagra with the ID 870505BA.

  • The sender example code follows the guidelines as demonstrated in the Google Cast codelab called Cast-enable an Android app.

  • The receiver reference code follows the guidelines in the Build a Custom Web Receiver Codelabs tutorial.

  • The sender Android application makes use of the MediaInfo class, part of the play-services-cast-framework dependency prerequisites. To play encrypted content or the Secure Session Management (SSM) protected stream, DRM configuration information (e.g. server URLs, tokens) is passed as custom-cast data in a MediaInfo object. When receiving this data, the receiver application interprets the message and configures the playback functionality based on these parameters.

For SSM, playback on the sender device and playback on the Chromecast device are considered as two separate sessions. If the playback token has a limit on the number of sessions, this may prevent playback on the casting device. To avoid that, the sender application, once starting a remote casting, should stop playback locally and release the local SSM session.

References

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.