Setting HTTP Header for DRM license server authentication with Tizen AVPlay

2.2k views Asked by At

I am using AVPlay to play DRM contents. I need to set a HTTP header for the license URL. How can I do it?

webapis.avplay.setDrm('PLAYREADY', 'SetProperties', angular.toJson({
    LicenseServer:entitlementData.LicenseURL,
    'X-AxDRM-Message':entitlementData.DRMToken
}));

I need to set X-AxDRM-Message in the HTTP header

4

There are 4 answers

0
Fatih Çelik On

I figure out how to send multiple Http Headers to DRM License Server. If you want to send multiple http headers, you must seperate them with \n key.

You can try it yourself:

        var drmParam = {
            DeleteLicenseAfterUse: true,
            LicenseServer: licenseServerURL,
            HttpHeader: "Authorization:" + authValue + "\nMY-Ticket:" + ticketValue
        };
        webapis.avplay.setDrm("PLAYREADY", "SetProperties", JSON.stringify(drmParam));
2
Sarvesh Venkat On
let DrmParam = {};

DrmParam.LicenseServer = entitlementData.LicenseURL;
DrmParam.HttpHeader = "X-AxDRM-Message:" + entitlementData.DRMToken;

webapis.avplay.setDrm("PLAYREADY", "SetProperties", JSON.stringify(DrmParam));
2
Md. Armaan-Ul-Islam On

As you may already know, angular.toJson() and JSON.stringify() have some significant difference.

Difference between toJSON() and JSON.Stringify()

By Checking out the Code example on this API reference, it seems JSON.stringify() should be Used.

http://developer.samsung.com/tv/develop/api-references/samsung-product-api-references/avplay-api

var drmParam = new Object();
drmParam.LicenseServer = "http://license.company.com";
drmParam.CustomData = "mycustom";
playerObj.setDrm("PLAYREADY", "SetProperties", JSON.stringify(drmParam));

You may try this format on your source code.

In addition, This document contains some discussion on HTTP header, though its about Apple tvOS but may of your use I guess.

Sending and Receiving AVPlayer HTTP Headers

0
Alexandro Campos On

What you need to do is set the parameters:

const drmParam = {
          DeleteLicenseAfterUse: true,
          LicenseServer: uri,
          X-AxDRM-Message: : entitlementData.DRMToken
        };

And then you need to make sure is a JSON Object like this:

const params = JSON.stringify(drmParam);

After you have the object you will be able to do the parameter setup as follows:

webapis.avplay.setDrm('PLAYREADY', 'SetProperties', params);

Hope that helps!