[object Object] Icon

Encoding
Learn how to create, start, manage and modify Encodings

[object Object] Icon

Player
Learn how to create, start, manage and modify Players

[object Object] Icon

Analytics
Learn how to create, start, manage and modify Analyticss

Docs Home
User shortcuts for search
Focus by pressing f
Hide results by pressing Esc
Navigate via   keys

Mon Jan 14 2019

How to enable Chromecast Support

OverviewLink Icon

Our goal is always to offer our customers a solution that is flexible enough so it can be perfectly adjusted to their use case. This applies to the integrated Chromecast support of our player SDK's for Web, iOS and Android as well. Besides simply enabling this feature, you can also customize the look&feel of the player UI used on Chromecast, as well as leverage your own application by providing your own app-id and messaging namespace, and you can push additional metadata upon initialization to configure your app or share other details needed by it.

SetupLink Icon

Chromecast support is disabled by default, but can be simply enabled in your player configuration by providing a remotecontrol configuration [1], which sets its type parameter to googlecast.

V8 configuration example:

1var playerConfiguration = {
2 key: 'YOUR_PLAYER_KEY_HERE',
3 remotecontrol: {
4 type: 'googlecast',
5 },
6 };

V7 (and below) configuration example: This configuration [2] is still available in v8 as well, but deprecated. If you are using v8, please use the remotecontrol configuration as shown above.

1var playerConfiguration = {
2 key: 'YOUR_PLAYER_KEY_HERE',
3 cast: {
4 enable: 'true',
5 }
6 source: {
7 dash: 'https://example.com/path/to/your/content.mpd'
8 }
9}

Once set, a cast icon will be shown in the UI of the player, if there is an Chromecast device available in your current local network.

Web SDK ConfigurationLink Icon

However, it wouldn’t be our product if there weren’t more configurations available, so you customize a particular feature to your needs, especially when you are using a custom Chromecast receiver application.

receiverApplicationId: If not set, the Bitmovin Player is using its default Bitmovin Chromecast receiver application to manage the playback of your content. If you want to use own custom receiver application, you can provide its receiver application ID here and it will be used by our player instead.

customReceiverConfig: It expects an object and can be used to provide custom configuration values to your own Chromecast receiver application to set it up accordingly.

1var playerConfiguration = {
2 key: 'YOUR_PLAYER_KEY_HERE',
3 remotecontrol: {
4 type: 'googlecast',
5 customReceiverConfig: {
6 yourCustomOption: "yourCustomValue",
7 thisIsAwesome: true
8 },
9 },
10 };

customReceiverConfig.receiverStylesheetUrl: This particular key can be used to provide a URL to a CSS file that gets embed into the chromecast receiver application. This enables you for example to apply customized CSS rules for the Player UI used on Chromecast. Typical use cases are to apply to customize the look&feel of the player, or to remove the watermark.

1var playerConfiguration = {
2 key: 'YOUR_PLAYER_KEY_HERE',
3 remotecontrol: {
4 type: 'googlecast',
5 customReceiverConfig: {
6 receiverStylesheetUrl: "https://example.com/path/to/your/custom-receiver.css",
7 },
8 },
9 };

messageNamespace: If your custom receiver application is using a custom message namespace, as the player functionality can’t be covered the Cast Media Controls, you can provide it here to be used by our player accordingly.

Android SDK ConfigurationLink Icon

Project setup

To use Google Cast in our Android application via our SDK you will have to add some addtional dependencies to your project first and adjustments to your AndroidManifest.xml have to be made. Please see point 3 in the instructions for the Android SDK Project setup.

Initialization

In order to simply enable the Chromecast support of our Android SDK, all you have to do is to call

1BitmovinCastManager.initialize();

In the Application class of your project. This enable the chromecast feature of the player, and will show the Chromecast icon, if a Chromecast device is available in the same local network. By default, our default Chromecast receiver application will be used.

One general thing to keep in mind is that, in every Activity that is using the Cast function you have to call updateContext in its onCreate method.

1BitmovinCastManager.getInstance().updateContext(this);

Use a custom receiver application

If you don't use our default receiver application, but your own, you can do so by providing the APPID and the MESSAGENAMESPACE of your custom application, to the BitmovinCastManager.initialize() method.

1BitmovinCastManager.initialize("APPID","MESSAGENAMESPACE");

A full example application that shows how you can enable Chromecast support in the Android SDK can be found in its Github sample repository as well.

iOS SDK ConfigurationLink Icon

Project Setup

At first, you have to add the pod for the google-cast-sdk in your podfile [example] in order to use the Google Cast SDK. Further, beginning with iOS 12, your App ID requires an additional app service called Access Wifi information that needs to be enabled. Please see point 3 in the instructions for the iOS SDK Project Setup for more details.

Initialization

In order to simply enable the Chromecast support of our iOS SDK, all you have to do is to call

1BitmovinCastManager.initializeCasting();

In the AppDelegate of your project. This enable the chromecast feature of the player.

Use a custom receiver application

If you don't use our default receiver application, but your own, you can do so by providing the APPID and the MESSAGENAMESPACE of your custom application, to the BitmovinCastManager.initializeCasting() method.

1BitmovinCastManager.initializeCasting("APPID","MESSAGENAMESPACE");

A full example application that shows how you can enable Chromecast support in the iOS SDK can be found in its Github sample repository as well. It provides an Advanced Casting example as well, which shows how you can load a different source for Casting, e.g. while playing HLS content in your app, you could play its MPEG-DASH version on Chromecast.

Give us feedback