[英]Setting HTTP Header for DRM license server authentication with Tizen AVPlay
I am using AVPlay to play DRM contents. 我正在使用AVPlay播放DRM内容。 I need to set a HTTP header for the license URL.
我需要为许可证URL设置HTTP标头。 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 我需要在HTTP标头中设置
X-AxDRM-Message
As you may already know, angular.toJson() and JSON.stringify() have some significant difference. 您可能已经知道,angular.toJson()和JSON.stringify()有一些明显的区别。
Difference between toJSON() and JSON.Stringify() toJSON()和JSON.Stringify()之间的区别
By Checking out the Code example on this API reference, it seems JSON.stringify() should be Used. 通过检查此API参考上的Code示例,似乎应该使用JSON.stringify()。
http://developer.samsung.com/tv/develop/api-references/samsung-product-api-references/avplay-api 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. 另外,本文档包含有关HTTP标头的一些讨论,尽管它与Apple tvOS有关,但我想可能有用。
Sending and Receiving AVPlayer HTTP Headers 发送和接收AVPlayer HTTP标头
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: 然后,您需要确保是这样的JSON对象:
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! 希望有帮助!
let DrmParam = {};
DrmParam.LicenseServer = entitlementData.LicenseURL;
DrmParam.HttpHeader = "X-AxDRM-Message:" + entitlementData.DRMToken;
webapis.avplay.setDrm("PLAYREADY", "SetProperties", JSON.stringify(DrmParam));
I figure out how to send multiple Http Headers to DRM License Server. 我弄清楚了如何将多个Http标头发送到DRM许可证服务器。 If you want to send multiple http headers, you must seperate them with \\n key.
如果要发送多个http标头,则必须使用\\ n键将它们分开。
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));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.