Axinom DRM integrates well with all major video players, both in browsers and on mobile devices. In this section you learn how to configure your player to make proper license requiests to a DRM License Service.

7. Integrate a video player

This article is a part of a DRM Quick Start Guide.

Axinom DRM integrates well with all major video players, both in browsers and on mobile devices. All you need to do is to configure the player to use Axinom DRM’s License Service URL for the respective DRM technology, give it a JWT ("token") containing an Entitlement Message and make it append the token as a custom HTTP-Header or a query string parameter.

Follow the steps below to integrate your selected video player:

  1. Set the license acquisition URL

  2. Generate an Entitlement Message

  3. Generate a License Service Message ("token", JWT)

  4. Append the token to each license request

  5. Handle errors

  6. FairPlay specifics

Set the license acquisition URL

All DRM-capable players support setting a license acquisition URL - this is the URL of the DRM License Service which will grant a DRM license.

You will find the URL of the Axinom DRM License Service in Axinom Portal under My Mosaic / DRM.

The URL follows the following format:

https://<tenant-specific-id>.drm-[playready|widevine|fairplay]-licensing.axprod.net/AcquireLicense

Note that for each DRM technology there is a separate URL. However, all of them follow the same naming pattern and implement the same HTTP-interface.

You can omit the <tenant-specific-id> as all of them point to the same server. However, this identifier helps to filter requests for your tenant from the error logs, even if authentication fails or if a request cannot be processed.

Generate an Entitlement Message

This is described in the section Create an entitlement message.

When you generate an entitlement message, you should use the keyId matching the video that you would like to play. It means, when you protected a video (see Protect a video using Axinom Encoding or Protect a video using a third party), you have to store the assigned keyID, so that you have this value when you want to play the video.

Usually, you will want to encapsulate the logic to generate entitlements into a separate component (we call it Entitlement Service). This service will implement your application-specific logic to grant entitlements and to decide on DRM license restrictions.

Generate a License Service Message ("token", JWT)

This is described in the section Create and sign a license service message.

Your Communication Key and Communication Key ID you will find in the Portal under My Mosaic / DRM.

As a result, you will have a JWT ("token") containing an Axinom DRM License Service Message, which contains an Entitlement Message referring to the keyId of the video.

Append the token to each license request

Append the token from the previous step to each license request.

The preferrable way is to pass it using a custom HTTP header X-AxDRM-Message.

Many video players support setting custom HTTP headers. For example, with Dash.js, you can do it like this:

protectionData =
    {
        serverURL: "https://12345678.drm-widevine-licensing.axprod.net/AcquireLicense",
        httpRequestHeaders:{
            X-AxDRM-Message: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2ZXJzaW9uIjoxLCJjb21fa2V
            ...
            TciXX19XX19.W2FbPDSDaq-LeeLfOnbpTMa-zCmXh8RLChEVDYvdcVw"
        }
    }

An alternative is to include the token as a query string parameter AxDrmMessage:

POST https://12345678.drm-widevine-licensing.axprod.net/AcquireLicense?AxDrmMessage=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2ZXJzaW9uIjoxLCJjb21fa2V...Vw

For PlayReady only, there is also a possibility to include the token within the Custom Data part of a PlayReady License Request.

Handle errors

In case of an error, the service returns an HTTP status code following HTTP conventions.

Additionally, the service adds a human-readable explanation of the error in a custom HTTP header X-AxDRM-ErrorMessage.

See Troubleshooting for more information on possible errors and their reasons.

FairPlay specifics

To use FairPlay, you need a FairPlay Streaming Certificate.

Check FairPlay and Axinom DRM for deails about acquiring and configuring FairPlay data set.

You have to host the certificate somewhere and to configure the player to access the certificate by setting its fpsCertificateUrl property.