如何在Cast Receiver Player中续订过期的DRM许可证? [英] How to renew expired DRM license in Cast Receiver Player?

查看:92
本文介绍了如何在Cast Receiver Player中续订过期的DRM许可证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我基于

所以我的问题是:

  1. Cast Receiver API是否支持续订许可证?接收方会触发CAST API中的哪些回调来通知会话已过期?我什么也没收到,我只会收到错误:(并且播放停止.
  2. 如何为播放器提供新许可证以防止其失败?

解决方案

阅读许可证的属性,并查看其是否可更新.如果此属性未设置为true,则无法续订许可证.

I develop custom Cast Receiver application based on Google Cast Application Framework The receiver app is responsible for playback Widevine encrypted streams. Our backed solution requires to add DRM token to PreAuthorization header in license request. I need to perform a couple of authorized requests to retrieve the DRM token. I assumed that the best place to retrieve DRM token is to use Message Interceptor:

this.playerManager_.setMessageInterceptor(
cast.framework.messages.MessageType.LOAD, (loadRequestData) => {
  var media = loadRequestData.media;
  var customData = media.customData;
  var licenseUrl = customData.licenseUrl || null;
  var contentId = media.contentId;
  var cdn = customData.cdn || null;
  return this.getOriginMediaURL(contentId, cdn, PlayerApiImp)
  .then(playbackURL => {
    loadRequestData.media.contentId = playbackURL;
    loadRequestData.media.customData.contentUrl = contentId;
    return this.getDRMToken(customData);
  })
  .then(drmToken => {
    this.preAuthToken = drmToken
    this.playbackConfig_.licenseUrl = licenseUrl;
    return loadRequestData
  })
  .catch(error => {
    this.log_({'ERROR': error});
    return loadRequestData;
  });;
});

Then CAST Player automatically calls licenseRequestHandler and I easily add required DRM token to the headers of license request:

this.playbackConfig_.licenseRequestHandler = requestInfo => {
  if (this.preAuthToken) {
    requestInfo.headers = {};
    requestInfo.headers['PreAuthorization'] = this.preAuthToken;
  }
};

Playback works fine but until the time when license key has expired. On our backend license lives ~30min. After that time the receiver player generates error [cast.framework.media.ShakaPlayer] category: 6 code: 6014 and playback stops. I found that this error means

So my questions are:

  1. Does Cast Receiver API support license renewing? What callbacks in CAST API does receiver trigger to notify that session has expired? I don't receive any, I only get error :( and playback stops.
  2. How I can provide new license to the player to prevent it from failing?

解决方案

Read the properties of the license and see if it is renewable. If this property is not set to true you cant renew the license.

这篇关于如何在Cast Receiver Player中续订过期的DRM许可证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆