How to enable Chromecast support

Casting VoD content to another device like a Smart-TV or Chromecast is a common way to enjoy the content on a bigger or simply different screen. Learn how to enable it in our player and how to adjust its configuration or to leverage your own Chromecast receiver app.

Overview

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 SDKs for Web, iOS, and Android as well. The latter can be achieved either via CAF (Casting Application Framework) or Google Cast V2, which while still work in Bitmovin’s old player versions but not on Bitmovin V3 for iOS and Android, has been deprecated by Google.

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.

Enabling CAF

Visit here for a fully updated guide on how to enable CAF support on the Bitmovin Player.

Enabling Cast V2 (Deprecated)

Bitmovin Android and iOS V3 SDKs do not support V2 cast receivers. If you are creating a new fresh application, consider moving to CAF.

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:

var playerConfiguration = {
    key: 'YOUR_PLAYER_KEY_HERE',
    remotecontrol: {
      type: 'googlecast',
    },
  };

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.

var playerConfiguration = {
    key: 'YOUR_PLAYER_KEY_HERE',
    cast: {
      enable: 'true',
    }
    source: {
       dash: 'https://example.com/path/to/your/content.mpd'
    }
}

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 configuration

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.

var playerConfiguration = {
    key: 'YOUR_PLAYER_KEY_HERE',
    remotecontrol: {
      type: 'googlecast',
      customReceiverConfig: {
        yourCustomOption: "yourCustomValue",
        thisIsAwesome: true
      },
    },
  };

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.

var playerConfiguration = {
    key: 'YOUR_PLAYER_KEY_HERE',
    remotecontrol: {
      type: 'googlecast',
      customReceiverConfig: {
        receiverStylesheetUrl: "https://example.com/path/to/your/custom-receiver.css",
      },
    },
  };

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 configuration

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

BitmovinCastManager.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.

BitmovinCastManager.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.

BitmovinCastManager.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 configuration

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

BitmovinCastManager.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.

BitmovinCastManager.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.