With the dash.js framework, you can create many MSE and EME video players that play back content by using client-side JavaScript libraries. Learn how to integrate dash.js with Axinom DRM to protect your videos.

Dash.js

The dash.js framework enables to create many different Media Source Extensions (MSE) and Encrypted Media Extensions (EME) players. These players play back MPEG-DASH content using client-side JavaScript libraries.

Integrating dash.js with Axinom DRM

It is easy to integrate dash.js with Axinom DRM. Use the sample below to do this.

  1. Create a video element on your HTML Page by adding the following line:

        <video id="videoPlayer" controls></video>
  2. Add dash.all.min.js to the end of the HTML body.

        <body>
            ...
            <script src="yourPathToDash/dash.all.min.js"></script>
        </body>
  3. Initialize the Player by adding the following line inside your loader method which is executed when you load the player.

        player = dashjs.MediaPlayer().create();
    
        player.initialize(videoPlayer);
  4. Set the protection data related to the video with the license service details and the token.

        player.setProtectionData(ProtectionData);
  5. In the ProtectionData, specify the license service URL and the X-AxDRM-Message as the token. See an example of the ProtectionData array below:

        {
            serverURL: "https://drm-widevine-licensing.axtest.net/AcquireLicense",
            httpRequestHeaders:{
                X-AxDRM-Message: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2ZXJzaW9uIjoxLCJjb21fa2V
                5X2lkIjoiYjMzNjRlYjUtNTFmNi00YWUzLThjOTgtMzNjZWQ1ZTMxYzc4IiwibWVzc2FnZSI6eyJ0eXBlI
                joiZW50aXRsZW1lbnRfbWVzc2FnZSIsInZlcnNpb24iOjIsImxpY2Vuc2UiOnsiYWxsb3dfcGVyc2lzdGV
                uY2UiOnRydWV9LCJjb250ZW50X2tleXNfc291cmNlIjp7ImlubGluZSI6W3siaWQiOiI5ZWI0MDUwZC1lN
                DRiLTQ4MDItOTMyZS0yN2Q3NTA4M2UyNjYiLCJlbmNyeXB0ZWRfa2V5IjoibEszT2pITFlXMjRjcjJrdFI
                3NGZudz09IiwidXNhZ2VfcG9saWN5IjoiUG9saWN5IEEifV19LCJjb250ZW50X2tleV91c2FnZV9wb2xpY
                2llcyI6W3sibmFtZSI6IlBvbGljeSBBIiwicGxheXJlYWR5Ijp7Im1pbl9kZXZpY2Vfc2VjdXJpdHlfbGV
                2ZWwiOjE1MCwicGxheV9lbmFibGVycyI6WyI3ODY2MjdEOC1DMkE2LTQ0QkUtOEY4OC0wOEFFMjU1QjAxQ
                TciXX19XX19.W2FbPDSDaq-LeeLfOnbpTMa-zCmXh8RLChEVDYvdcVw"
            }
        }
  6. Finally, you can open the player, which is now integrated with DRM.

        player.attachSource(url);
        player.on(dashjs.MediaPlayer.events.STREAM_INITIALIZED, streamInitialized.bind(this));
        $('#dash-player').show();
Tip
You can try out the dash.js player with the HTML5 VideoTestBench online tool.

Revision History

The table below outlines the document versions and any changes between them.

Version Date Description

1.0

April 8, 2021

  • Initial version.

1.1

April 13, 2021

  • Player link update.

1.2

May 6, 2021

  • Player integration with DRM - code updated.