Explains how to use Axinom DRM togather with Google Chromecast

Chromecast Integration with Axinom DRM

Overview

Chromecast provides screen mirroring and media content casting to HDMI enabled devices (via the dongle) or Android TVs (built-in).

Unlike Miracast, Chromecast requires an internet connection, the devices must be on the same network. While Chromecast support both screencasting and media casting, this article will only discuss the media casting which is relevant for playing DRM protected content through the Chromecast.

How Chromecast works

There are two application components involved during a media cast.

  1. Sender application - written for Android, iOS, or Cast-supported web platforms (e.g. Chrome desktop browser) which is developed on top of the Google Cast SDK APIs.

  2. Receiver application - handles the communication between the sender app and the Chromecast device. The receiver application will be running on the Chromecast device. In simple terms, it can be thought of as a web app rendered on a Chrome browser outputting the view through HDMI. A receiver application is not limited to just loading media, but it can be a more featured app like catalogue browsing, etc.There are three options to implement the receiver application:

The Default Media Receiver presented with the Google Cast branding and styling. No custom development is needed. DRM protected content will not work other than the Google sample DRM content.

The Styled Media Receiver for which you can develop the styles and branding.

A custom receiver handles custom messages from your sender app to the Chromecast. A custom receiver is required to handle DRM protected content.

The above three options are implemented as HTML/JavaScript applications that will run on the Chromecast. For more information read https://developers.google.com/cast/docs/web_receiver#web_receiver_application

Additionally, Android TVs can implement their own Android application based on the Android TV Receiver SDK.

Casting Workflow

Casting Workflow
First Step:

Sender device requests to cast with media data with the receiver application ID to be loaded in the Chromecast.

Second Step:

Chromecast retrieves the receiver app hosted URL.

Third Step:

Chromecast requests the receiver app. (This is a standard HTTP request).

Fourth Step:

Response from the receiver app hosted web server.

Fifth Step:

Chromecast loads and renders the receiver app in its built-in Chrome engine.

The receiver app will intercept the sender cast massage and extract the necessary data to load the media (optional, but required for DRM content).

Sixth Step:

Chromecast responds to the sender device with status and any other control options if available.

1. Setup the Chromecast

  1. Setup the Chromecast device and connect the device/TV to the same network as the development workstation.

  2. Register the testing device in the Google Cast SDK Developer Console. (You must have a paid developer account for this).https://developers.google.com/cast/docs/registration#devices Visit for more information.

    Setup Chromecast
  3. Enter the device serial number.

    Serial Number

2. Setting up the Receiver Application

1.Download and extract the sample Axinom DRM receiver application.

2.Host the receiver application on a publicly accessible web host through HTTPS.For testing purposes, let’s use NodeJS http-server and ngrok modules.

a.Install necessary node modules. …​ npm install -g http-server npm install -g ngrok …​

b.Navigate to the sample receiver application folder.

c.Open up a command prompt and run the node web server. …​ ngrok http 8080 …​

ngrok

3. Register the Receiver Application

  1. Register the receiver application in the https://cast.google.com/publish/. For more information https://developers.google.com/cast/docs/registration#register_your_application

    Register Reciever
  2. Select Custom Receiver

    Select Custom Reviewer
  3. Enter the details of your new receiver application.

    New Reciever

    Be sure to use the URL you got with ngrok.

  4. Note down the application ID for the newly registered receiver app.

4. Testing the Playback

  1. Load the https://casttool.appspot.com/cactool/ provided by Google, which is a sender application that runs on a desktop browser. You can develop your own sender application, but this guide this tool provides ready to go solution.

    Command Control Tool
  2. Enter the Receiver App ID, noted above.

    Reciever AppID
  3. Click “SET APP D“ button (#2).

  4. Click the cast button (#3) to connect with the Chromecast. A browser popup should display to select the device.

  5. Goto the “LOAD MEDIA” tab.

    Load Media
  6. Select LOAD option (#2).

  7. Enter the cast message containing the media and DRM token.

    ....
    {
     	"media":
    {
       	"contentUrl": "https://media.axprod.net/TestVectors/v7-MultiDRM-SingleKey/Manifest_1080p.mpd",
       	"customData":
    	{
         	"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2ZXJzaW9uIjoxLCJjb21fa2V5X2lkIjoiYjMzNjRlYjUtNTFmNi00YWUzLThjOTgtMzNjZWQ1ZTMxYzc4IiwibWVzc2FnZSI6eyJ0eXBlIjoiZW50aXRsZW1lbnRfbWVzc2FnZSIsInZlcnNpb24iOjIsImxpY2Vuc2UiOnsiYWxsb3dfcGVyc2lzdGVuY2UiOnRydWV9LCJjb250ZW50X2tleXNfc291cmNlIjp7ImlubGluZSI6W3siaWQiOiI5ZWI0MDUwZC1lNDRiLTQ4MDItOTMyZS0yN2Q3NTA4M2UyNjYiLCJlbmNyeXB0ZWRfa2V5IjoibEszT2pITFlXMjRjcjJrdFI3NGZudz09IiwidXNhZ2VfcG9saWN5IjoiUG9saWN5IEEifV19LCJjb250ZW50X2tleV91c2FnZV9wb2xpY2llcyI6W3sibmFtZSI6IlBvbGljeSBBIiwicGxheXJlYWR5Ijp7Im1pbl9kZXZpY2Vfc2VjdXJpdHlfbGV2ZWwiOjE1MCwicGxheV9lbmFibGVycyI6WyI3ODY2MjdEOC1DMkE2LTQ0QkUtOEY4OC0wOEFFMjU1QjAxQTciXX19XX19.W2FbPDSDaq-LeeLfOnbpTMa-zCmXh8RLChEVDYvdcVw"
       	}
     	}
    }
    ....
    The custom receiver application is developed to handle the custom data that contains the authentication token required for the Axinom DRM license service and PlayReady DRM System can be set through this as well if required. (Refer to the source code).
  8. Click “SEND CUSTOM LOAD REQUEST“ button (#3).

  9. The video should play through the TV now.

Chromecast development getting started - https://developers.google.com/cast/docs/developers

Custom receiver and Sender application development tutorials - https://developers.google.com/cast/docs/tutorials (Check Web Receiver and Web Sender tutorials).

Revision history

Version Date Description

1.0

28.10.2022

Initial version