Radiant Media Player

Google Cast support



Documentation sections


Google Cast™ support in Radiant Media Player

Google Cast badge
Google Cast and the Google Cast badge are trademarks of Google Inc.

Google Cast™ is a protocol allowing media data to be sent from an emitting (or casting) device to a receiving device (example a TV). This is generally referred to as "second screen experience" in the industry. The emitting/casting device can be a notebook or an Android tablet for example. One can then watch video content on a TV or larger screen while still being able to control the content through the casting device.

Radiant Media Player supports in-player Google Cast casting from Google Chrome (Desktop, Android) and mobile applications for Android and iOS (Cordova-based) to any Google Cast compatible receiving device (like Chromecast or Android TV). Our implementation is based on Google Cast SDK v3. Information on Google Cast SDK can be found here.

When a Google Cast receiver is detected in range the player will automatically display a casting icon (as part of a player module). A dedicated user interface has been designed within Radiant Media Player to support remote controlling of media content when casting is engaged.

We have developed our own custom Cast Application Framework (CAF) receiver app which is used by default by the player. Further customisation of this CAF app receiver, including support for CSS and DRM, is possible and start-point examples have been published on GitHub. A Google Cast app receiver runs in a web environment (HTML5, CSS, JavaScript). To load media content in a Google Cast app receiver your streaming server must be properly CORS configured.


Supported receiving devices

  • Chromecast
  • Android TV
  • Any Google Cast™ compatible receiving device

Assistance for setting up a Chromecast device can be found here.


Supported emitting devices

  • Google Chrome 32+ on Desktop/laptop: Windows, Linux & macOS
  • Google Chrome 51+ on Chrome for Android

Google Cast is not supported on the iOS Chrome browser.

Chrome sender apps need to support HTTPS to maintain Cast compatibility, as Chrome is deprecating support for the Presentation API on insecure origins. This means you must use our player on a HTTPS origin to insure Google Cast features work as expected.


Google Cast support in an Android or iOS mobile app

For Google Cast support in a mobile application for Android or iOS see our Google Cast for Cordova guide.


Supported features

  • In-player casting from desktop Chrome and Chrome for Android - for usage in a mobile application for Android or iOS see our Google Cast for Cordova guide
  • Remote controlling
  • Adaptive bitrate with HLS, DASH or progressive download
  • Video ads (VAST and VMAP support)
  • DASH DRM (Widevine) & SAMPLE AES/AES-128 HLS
  • Multi-language WebVTT captions casting through the ccFiles setting or in-manifest HLS/DASH captions
  • Live and on-demand video support
  • DASH/HLS multi-audio tracks switching
  • Audio-only support
  • Playlist
  • Related content
  • Player API

The following features are currently not supported by our custom Cast Application Framework (CAF) receiver app:

  • HLS with H.264/MP3 or fmp4 HLS (will fail to load)
  • HLS with audio-only content (will fail to load)
  • Casting of CEA* captions (will load but CEA captions will be unavailable)

Cast Application Framework (CAF) Receiver app

Our production custom CAF receiver app should cover most generic case-scenario. However you should consider developing your own custom CAF receiver app in the following cases:

  • you need to support DRM: the DRM example below has been tested for DASH with Widevine DRM
  • you need to apply your own styling to the CAF player
  • you need to implement some other kind of custom behaviour required by your project

In order to assist Radiant Media Player customers with this task, we have published our custom CAF receiver app on GitHub.


Google Cast player settings

Radiant Media Player will automatically detect an in-range Google Cast receiver and will provide in-player casting options when needed.

The following player settings are available:

googleCast: Boolean

Enables or not Google Cast detection. Default: true. This setting is not supported and automatically set to false for the following features: 360 video.

googleCastReceiverAppId: String

Google Cast receiver app id. Since Radiant Media Player 4.7.0 we use a custom Cast Application Framework (CAF) receiver app. The application ID for this custom receiver is C899A03E. Default: 'C899A03E'. If you would rather use Google default receiver app (Receiver v2 app) you can set googleCastReceiverAppId to 'cast-default'.

googleCastAdTagUrl: String

By default the player uses the VAST tag from the adTagUrl setting to display ads on our Google Cast CAF receiver. Using googleCastAdTagUrl lets you define a VAST tag that will only be used on our Google Cast CAF receiver. Default: ''.

googleCastVmapAdsRequest: String

If you want VMAP support on our Google Cast CAF receiver then you must explicitly pass your VMAP tag with this setting. Default: ''.

Additionally casted WebVTT captions can be customised. See our closed captions documentation for more information.


Player API

When casting is engaged two player exist at the same time: the remote player which lives in the receiver application and the local player which lives in the sender application. When a media is successfully cast from the sender application to the receiver application the local player is paused and its UI controls the remote player. The player API can be used to control the remote player when casting is engaged.

Supported player API events include

  • play
  • pause
  • playing
  • waiting
  • timeupdate
  • durationchange
  • volumechange
  • castmedialoaded: media has been successfully loaded on receiving device
  • castmediaerror: media could not be loaded on receiving device - current casting session ends
  • castapiavailable: the Google Cast API has been successfully loaded and is now available. The global Google Cast related variables can now be accessed including window.chrome.cast and window.cast.framework

Supported player API methods include

  • play
  • pause
  • stop
  • getPaused
  • getVolume
  • setVolume
  • getMute
  • setMute
  • seekTo
  • getCurrentTime
  • getDuration
  • getLiveCurrentTime
  • getLiveDuration
  • setSrc
  • destroy
  • getCastUrl: returns a String representing the currently cast URL.
  • getCastMediaLoaded: returns a Boolean stating if a media is loaded on the receiving application.
  • getCastConnected: returns a Boolean stating if the remote player is currently connected to the sender application. Note that in some instances (like when a media ends on the receiving application) the remote player can be connected to the sender application but with no media loaded within it.

Player code examples

Video ads with Google Cast - see this example here

<script src="https://cdn.radiantmediatechs.com/rmp/5.9.2/js/rmp.min.js"></script>
<div id="rmpPlayer"></div>
<script>
  var src = {
    hls: 'https://your-hls-url.m3u8'
  };
  var settings = {
    licenseKey: 'your-license-key',
    src: src,
    width: 640,
    height: 360,
    contentMetadata: {
      poster: [
        'https://your-poster-url.jpg'
      ],
      title: 'Video ads demo through Google Cast'
    },
    // Our video ads setting
    ads: true,
    // Upon loading content on Google Cast the adTagUrl will play on receiver device
    adTagUrl: 'https://your-ad-tag-url',
    // if the adTag you are passing is a VMAP adTag make sure to use googleCastVmapAdsRequest
    // so that the CAF receiver can properly display the VMAP ads
    // googleCastVmapAdsRequest: 'https://your-vmap-ad-tag-url'
  };
  var elementID = 'rmpPlayer';
  var rmp = new RadiantMP(elementID);
  rmp.init(settings);
</script>

DASH Widevine DRM with Google Cast - see this example here

<script src="https://cdn.radiantmediatechs.com/rmp/5.9.2/js/rmp.min.js"></script>
<div id="rmpPlayer"></div>
<script>
  var src = {
    dash: 'https://your-dash-widevine-drm-url'
  };
  // Then we set our player settings
  var settings = {
    licenseKey: 'your-license-key',
    src: src,
    width: 640,
    height: 360,
    // passing DRM settings - those settings will automatically be passed to the CAF receiver app
    shakaDrm: {
      servers: {
        'com.widevine.alpha': 'https://your-widevine-license-url'
      }
    },
    // we support passing custom headers for license request
    // and license request with credentials to the CAF receiver
    shakaRequestConfiguration: {
      license: {
        headers: {
          'drm-custom-header': 'abcdefghijklmnopqrstuvwxyz1234156789'
        }
        //credentials: true
      }
    },
    contentMetadata: {
      poster: [
        'https://your-poster-url.jpg'
      ],
      title: 'DASH Widevine DRM demo through Google Cast'
    }
  };
  var elementID = 'rmpPlayer';
  var rmp = new RadiantMP(elementID);
  rmp.init(settings);
</script>
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License.