Integrate ExpressPlay Multi-DRM with Bitmovin

The following tutorial will show you how to create a video distribution platform, ready to target multiple devices and browsers with a DRM system compatible with Apple’s FairPlay, Google’s Widevine, Microsoft’s PlayReady and the open-standards-based Marlin DRM.

This solution is an end-to-end solution that integrates the ExpressPlay Multi-DRM system with the Bitmovin Cloud Encoding system. By following this tutorial and using the supporting documents that you will find linked below, you can create a video on demand service with the same speed and quality as Netflix.

Multi-DRM System – High Level Architecture

DRM service integration tutorial with ExpressPlay

  1. Use the Bitmovin Cloud Encoding Service to encode the content
  2. The client (HTML5 app or native app) requests the content from the service
  3. The service uses the ExpressPlay REST API to request a token for the DRM support by the client
  4. The token is passed back to the device
  5. Playback and / or download starts

Setup Bitmovin Cloud Encoding with DRM

The following code example shows the configuration required to encrypt your adaptive stream to use Playready, Widevine and Fairplay. You are not required to include all the DRM schemas. For example, you can leave out Fairplay if it is not required.

Create the combined Playready and Widevine config

Note: You will need to set values for drmConfig.kid and drmConfig.key. The drmConfig.laUrl is the Playready license URL and the drmConfig.pssh is the Widevine PSSH box. You will get this values from the ExpressPlay Multi DRM service (see below).

CombinedDrmConfig drmConfig = new CombinedDrmConfig();
drmConfig.kid = "YOUR_KEY_ID";
drmConfig.key = "YOUR_KEY";
drmConfig.laUrl = "";
drmConfig.pssh = "CAESEAABAgMEBQYHCAkKCwwNDg8aCmludGVydHJ1c3QiASo==";

Create the Fairplay DRM config

Note: You need to set the values for hlsEncryptionConfig.key, hlsEncryptionConfig.iv and hlsEncryptionConfig.uri. You will get this values from the ExpressPlay Multi DRM service.

HlsEncryptionConfig hlsEncryptionConfig = new HlsEncryptionConfig();
hlsEncryptionConfig.method = HlsMethod.FAIRPLAY; 
hlsEncryptionConfig.key = "YOUR_KEY"; 
hlsEncryptionConfig.iv = "YOUR_IV"; 
hlsEncryptionConfig.uri = "skd://expressplay_token";

Create a DRM Encoding

JobConfig jobConfig = new JobConfig(); 
jobConfig.speed = Speed.STANDARD; 
jobConfig.hlsEncryptionConfig = hlsEncryptionConfig; 
jobConfig.drmConfig = drmConfig; 

The full example code can be found in the examples of the Java API client. We also offer other API clients for the most popular languages including PHP, node.js, python, Ruby, C#/.NET, etc. You can try out our encoding service for free, just sign up for a free account. This account will allow you up to 10 encodings or 2.5GB per month.

Our encoding API is well documented, and you can find information on how to use it in our support section.

You may also find our tutorial on using multiple DRMs in parallel useful.

Requesting the DRM Tokens from ExpressPlay Service

Once the encoding part is done, you can use the Bitmovin HTML5 Player to render the protected content on a browser. Keep in mind that each browser supports a different DRM schema. This article contains more information on browser capabilities and DRM support.

To decrypt the content, the player needs to receive the LA URLs (License Acquisition URLs) for the different DRMs. These are obtained by requesting tokens from the ExpressPlay Multi DRM service.

The example code below will obtain a Widevine token:

curl -k ' Format=json&kid=YOUR_KID&contentKey=YOUR_KEY&securityLevel=1&hdcpOutputCo ntrol=0'

Playready would have a similar request:

curl -k ' Format=json&kid=YOUR_KID&contentKey=YOUR_KEY&rightsType=BuyToOwn&analogVi deoOPL=100&compressedDigitalAudioOPL=100&compressedDigitalVideoOPL=100&un compressedDigitalAudioOPL=100&uncompressedDigitalVideoOPL=100'

As per our other examples, you will need to add your own content key and kid values, and they should match the values used in the encoding phase.

The responses that you will obtain from the ExpressPlay service will be somethings like the following:
For Widevine:
ExpressPlayToken=AQAAAw3paRMAAABQKFj_RAZgprsZ_un0Co4o36Ibd2EBQ3_JRDY69vsk inJLJbhCchnJpDP5dz_A1RATVGOp8uNOkfdIO0PFF9Va6DCfSqo9dybIeCq4mTsmCecfDrims KOMz66DNRC-tV9n8-C8tx 

…and for Playready

{"licenseAcquisitionUrl":"","token":"AQAAAw3pX5gAAABgXwydVZFjaBnspTeDbSWv7YjCHn_t G4ZNLbrBu5pQLF1xKw6GqOlIzBHnt7zClEDj3S65AU5j_Q7ANZ-l-i2J2QuJB7tLqKVzqpx59VyvbnhQtdI5G8YuoMcJN5l9TJOwTmTri8YJFegnCYx-tE270e6wMwE"} 

Find more detailed documentation on the ExpressPlay API.

Setup the Bitmovin HTML5 Player with DRM

You will need to pass the response you get from ExpressPlay through to you Bitmovin Adaptive Streaming Player.

drm : {
  widevine                : {
    LA_URL                : '
    prepareMessage        : function(keyMessage) {
      return keyMessage.message;
  playready : { 
    LA_URL: ''
  fairplay: {
    certificateURL: 'CERTIFICATE_URL',
    LA_URL: '',
    prepareMessage: function(event, session) {
      return event.message;
    prepareContentId: function(contentId) {
      var link = document.createElement('a');
      link.href = contentId;
      return link.hostname;
    prepareLicense: function(license) {
      return new Uint8Array(license);
    headers: [{
      name: 'Content-type',
      value: 'application/octet-stream'
    useUint16InitData: true,
    licenseResponseType: 'arraybuffer'

The Bitmovin Player API is well documented. You can find more information on how to configure it in our support section under Player Documentation.

Get started with your free Bitmovin account and download the HTML5 Player.

Back to Top
Simple Share Buttons