0

Hi I am trying to achieve any one of the below

1) Set a extra token to the license url by the code ' requestInfo.url = requestInfo.url + "#12345678";'

OR

2) Set headers by the code 'requestInfo.headers = new String('token:12345678\r\n');'

But nothing seems to work.

After updating the url in receiver logs i see 'Updated requestInfo.url ' with the extra '#12345678' at the end of the license url. But on license server I get only the url which is unmodified ( no #12345678).

Same with requestInfo.headers. I don't see any headers which I set in receiver app when the request comes in license server.

I also tried returning the requestInfo; but with this the chromecast is not able to play anything. So I commented the return statement.

Would appreciate any pointers to fix this issue. Here is my code.

 var host = new cast.player.api.Host({
    'url': url,
    'mediaElement': this.mediaElement_
  });

  host.onManifestReady = function() {
   self.log_('prototype.loadVideo_::My onManifestReady');
    };


 host.updateLicenseRequestInfo = function(requestInfo){
        self.log_('prototype.loadVideo_::updateLicenseRequestInfo()');
        self.log_('requestInfo.url ' + requestInfo.url);
        self.log_('requestInfo.headers ' + requestInfo.headers);
        self.log_('requestInfo.protectionSystem ' + requestInfo.protectionSystem);
        self.log_('requestInfo.setResponse ' + requestInfo.setResponse);
        self.log_('requestInfo.skipRequest ' + requestInfo.skipRequest);
        self.log_('requestInfo.timeoutInterval ' + requestInfo.timeoutInterval);
        self.log_('requestInfo.withCredentials ' + requestInfo.withCredentials );
        requestInfo.url = requestInfo.url + "#12345678";
        //host.licenseUrl = requestInfo.url;
        //requestInfo.headers = new String('token:12345678\r\n');
        self.log_('Updated requestInfo.url ' + requestInfo.url);
        self.log_('Updated requestInfo.headers ' + requestInfo.headers);
        //return requestInfo;
}; 

this.player_ = new cast.player.api.Player(host);

1 Answers1

0

updateLicenseRequestInfo - enables the host to customize request information used to get media license from the server. Applications should override this method to add a token to the url, set headers or withCredentials flag.

Here is the example code on how to use it.

host.updateManifestRequestInfo = function(requestInfo) {
  if (!requestInfo.url) {
    requestInfo.url = this.url;
  }
  requestInfo.withCredentials = true;
};

host.updateLicenseRequestInfo = function(requestInfo) {
  requestInfo.withCredentials = true;
};

host.updateSegmentRequestInfo = function(requestInfo) {
  requestInfo.withCredentials = true;
};

You can also visit this page for more information.

KENdi
  • 7,576
  • 2
  • 16
  • 31
  • Hi KENdi Thanks for the reply. Do you see any thing wrong in my code to set the header " //requestInfo.headers = new String('token:12345678\r\n');". With the added header the Chromecast just hangs. 1) I was able to fix issue adding a token in the url. The issue was with the '#' character in the url. Its a reference symbol . If I use any other symbol it works fine. ---------Would really appreciate if you could let me know how to fix adding header----. – Gopalkrishna Mudaliar May 24 '16 at 23:42