Enabling Google Cast support

Learn how to connect your Bitmovin Player to a cast-compatible device using Flutter.

Google Cast support allows a user to play a source on on a cast-compatible device, while controlling playback using the Player.

Google Cast support is available on all supported platforms.


Have a look at our sample app showcasing Google Cast support in Flutter.


The following four steps are required to enable casting with the Bitmovin Player SDK in your Flutter app.

Adding the dependencies

The following dependencies have to be added manually to Android's build.gradle as well as iOS's Podfile.

You can get the correct version of the cast dependencies by referring to the sample app.




pod 'google-cast-sdk', '4.8.0'

Initializing the BitmovinCastManager

Before creating a Bitmovin Player instance that supports casting, the BitmovinCastManager singleton has to be initialized once.

final castManager = await BitmovinCastManager.initialize();


Good to know

Optionally, an instance of BitmovinCastManagerOptions can be provided to the initialize function in order to configure the ID of the receiver application and a message namespace used for communication with the cast receiver.

Configuring the Player

The RemoteControlConfig is used to configure the remote playback behaviour of the Player instance. Most prominently, RemoteControlConfig.isCastEnabled defines whether casting is enabled in a certain Player instance or not. The default value is true.

Additional setup steps on Android

The cast feature requires some additional setup on Android. In the Android manifest, the ExpandedControllerActivity as well as the CastOptionsProvider have to be declared:

     <action android:name="android.intent.action.MAIN" />
              android:value="com.bitmovin.player.flutter.example.MainActivity" />

           android:value="com.bitmovin.player.casting.BitmovinCastOptionsProvider" />


The activity used for the ExpandedControllerActivity has to be of type FlutterFragmentActivity rather than FlutterActivity.

In the native Activity, the following code has to be added to the onCreate function to ensure that the cast state is updated correctly:

    try {
      CastContext.getSharedInstance(this, Runnable::run);
    } catch (Exception e) {
      // cast framework not supported

Additional setup steps on iOS

On iOS, the Info.plist file of the application has to be extended with local network and bluetooth permissions in order to allow finding and connecting to cast-compatible devices on your WiFi network.

	<string>Required by Google Cast to use the local network to connect to Cast-enabled devices on your WiFi network</string>
	<string>Required by Google Cast</string>

Switching sources when Casting on iOS

A common use case is to play HLS streams with FairPlay DRM protection on iOS devices. This solution works very well for protecting the content whilst ensuring compatibility with the iOS native system.

However, this presents some issues if you'd like to enable casting to devices that do not support FairPlay. In scenarios like this, it's possible to instruct the player to switch to a different streaming and DRM format that is compatible, such as DASH + Widevine DRM.

final source = Source(
  sourceConfig: sourceConfig,
  remoteControl: const SourceRemoteControlConfig(
    castSourceConfig: SourceConfig(
      url: 'https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/mpds/11331.mpd',
      type: SourceType.dash,
      drmConfig: {
          widevine: {
            licenseUrl: 'https://cwip-shaka-proxy.appspot.com/no_auth',

A full example of this can be found here.

Supported Events

The following events are emitted while casting to a remote-enabled device.

CastAvailableEmitted when casting to a cast-compatible device is available.
CastStartEmitted when casting is initiated, but the user still needs to choose which device should be used.
CastWaitingForDeviceEmitted when a cast-compatible device has been chosen and the player is waiting for the device to get ready for playback.
CastStartedEmitted when the cast app is launched successfully.
CastPlayingEmitted when playback on a cast-compatible device has started.
CastTimeUpdatedEmitted when the time update from the currently used cast-compatible device is received.
CastPausedEmitted when the playback on a cast-compatible device was paused.
CastPlaybackFinishedEmitted when the playback on a cast-compatible device has finished.
CastStoppedEmitted when casting to a cast-compatible device is stopped.


The cast feature currently has a few limitations when using it in Flutter.

Custom ExpandedControllerActivity

It is currently not possible to define and use a custom ExpandedControllerActivity on Android.

Different Events on Android and iOS

In the future, normal playback related events should be emitted during cast playback instead of the cast specific ones to simplify integration. On Android, the non cast specific events are already emitted at the same time as the cast specific ones.

Events emitted on iOS and AndroidEvents additionally emitted on Android at the same time