Dash.js
Integrating dash.js with Axinom DRM
It is easy to integrate dash.js with Axinom DRM. Use the sample below to do this.
-
Create a video element on your HTML Page by adding the following line:
<video id="videoPlayer" controls></video>
-
Add
dash.all.min.js
to the end of the HTML body.<body> ... <script src="yourPathToDash/dash.all.min.js"></script> </body>
-
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);
-
Set the protection data related to the video with the license service details and the token.
player.setProtectionData(ProtectionData);
-
In the
ProtectionData
, specify the license service URL (You can find the Url valid for your tenant from My Mosaic area) and theX-AxDRM-Message
as the token. See an example of theProtectionData
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" } }
-
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 |
|
1.1 |
April 13, 2021 |
|
1.2 |
May 6, 2021 |
|