0

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

Jiew Meng
  • 84,767
  • 185
  • 495
  • 805

4 Answers4

1

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));
Fatih Çelik
  • 401
  • 7
  • 16
0

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

Md. Armaan-Ul-Islam
  • 2,154
  • 2
  • 16
  • 20
0

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!

0
let DrmParam = {};

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

webapis.avplay.setDrm("PLAYREADY", "SetProperties", JSON.stringify(DrmParam));
  • While this code may answer the question, it is better to explain how to solve the problem and provide the code as an example or reference. Code-only answers can be confusing and lack context. – Robert Columbia Sep 20 '18 at 21:24
  • At Samsung Developer site, it recommends this. But it is not clear how to use it. And also I got to send two headers and I don't know how to concat. Is there any documentation/experience about it? https://developer.samsung.com/tv/support/documentation-qa/developing-applications-qa/multimedia-drm/#qna_2 – Fatih Çelik Nov 09 '18 at 06:44