Chromecast (JW Platform)

Integrate Studio DRM with your JW Platform and Chromecast

The Google Cast framework enables a viewer to stream content to a compatible TV or sound system. By enabling the Google Cast framework in your app, a viewer can use a cast button to stream your content to a Cast-enabled device on a shared network.

This article explains two integrations:

  • Enabling the Google Cast framework for the JW web player
  • Casting video content protected by Studio DRM with the JW Platform


VUDRM was rebranded as Studio DRM following JW Player’s acquisition of Vualto. Any references to VUDRM in this document or in the Studio DRM Admin portal refer to Studio DRM.


Integrating Studio DRM with JW Platform and Chromecast has several requirements.

Item Notes
Application Registration Registration allows you to test your custom receiver. Specifically, you will be able to connect to the custom receiver with your custom Cast implementation.
Cast App A Cast app enables DRM-protected content to be streamed on a Cast-enabled device.

A Cast app consists of two components:
  • Sender app (JW web player)
  • Custom web receiver
You can use the JW Player Chromecast Custom Receiver Demo App to guide your implementation.


Google recommends installing a mix of http-server and ngrok to deploy your receiver locally.

Content URLs Through a signed URL, the license URL and streaming URL for each media ID are retrieved.

Use the following steps to retrieve the content URLs:
  1. Use this sample code to generate the signed URL.
  2. Make a GET call with the signed URL.
  3. From the API response, extract the license and streaming URLs from the following parameters:
    • playlist[].sources.drm.widevine.url (license)
    • playlist[].sources.drm.file (streaming)

// Signed URL response - Delivery API sample
   "kind":"Single Item",

Configure the Cast app

For DRM playback, deploy your custom web receiver.

<!DOCTYPE html>

<html lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Studio DRM Custom Chromecast Receiver</title>
    <link rel="stylesheet" href="main.css" media="screen" />
    <script src="//"></script>

    <script src="receiver.js"></script>
(() => {
    const context = cast.framework.CastReceiverContext.getInstance();
    const playerManager = context.getPlayerManager();
    var laurl;

    // Wait until the cast player is loaded, get the laurl from the media request and use it in the player config
    playerManager.setMessageInterceptor(cast.framework.messages.MessageType.LOAD, loadRequestData => {
        let customData =;
        // Check all content source fields for asset URL or ID
        let source = || ||;
        if (!source || source == "") {
            let error = new cast.framework.messages.ErrorData(
            error.reason = cast.framework.messages.ErrorReason.INVALID_REQUEST;
            return error;
        } = source;

        if (customData) {
            if (customData["laurl"]) {
                laurl = customData["laurl"];
            } else if (customData["drm"]["widevine"]["url"]) {
                laurl = customData["drm"]["widevine"]["url"];
        return loadRequestData;


    function createPlaybackConfig(playerManager) {
        let playbackConfig = (Object.assign(new cast.framework.PlaybackConfig(), playerManager.getPlaybackConfig()));
        playbackConfig.licenseUrl = laurl;
        playbackConfig.protectionSystem = cast.framework.ContentProtection.WIDEVINE;
        return playbackConfig;


Enable casting for a viewer

Once you set up your custom receiver, you will be able to cast DRM content from the JW web player. For reference, you may see our Studio DRM integration with JW Player.

  1. Add the cast object to your setup.
  2. In the JW Player studiodrm-jwplayer.js file, define dash-stream-url with your signed streaming URL.
  3. Define widevine-license-url with the signed license URL.
  4. Define your-receiver-application-id with your registered custom receiver app ID from the Google Cast developer console.
(function() {

    // Set the mpeg-dash stream URL.
    var dashStreamURL = "<dash-stream-url>"

    // Set the hls stream URL.
    var hlsStreamURL = "<hls-stream-url>";

    // Set the URL to retrieve the fairplay certificate from.
    var fairplayCertURL = "<fairplay-cert-url>";

    // setup jwplayer, passing the stream URLs and DRM configurations.
        "playlist": [{
            "sources": [{
                "file": dashStreamURL,
                "drm": {
                    "widevine": {
                        "url": "<widevine-license-url>"
                    "playready": {
                        "url": "",
                "file": hlsStreamURL,
                "drm": {
                    "fairplay": {
                        "certificateUrl": fairplayCertURL,
                        "processSpcUrl": function (initData) {
                            return "https://" + initData.split("skd://").pop();
                        "licenseRequestHeaders": [
                                "name": "Content-type",
                                "value": "arraybuffer"
        "cast": {
            "appid": "<your-receiver-application-id>"

You can now cast DRM-protected video content onto a Chromecast device.


How do I implement Airplay with DRM media?

Airplay will automatically be implemented by the Apple OS with DRM Media.


If an Airplay session is initiating after 10 minutes or longer of playback on the sending device, playback on the receiving device will fail. The user will need to restart the video in the Airplay session. This occurs because the Airplay receiver is using the existing authorization which has timed out.