【问题标题】:DRM WideVine video not playing from android cast sender applicationDRM WideVine 视频未从 android cast 发件人应用程序播放
【发布时间】:2018-01-15 15:42:14
【问题描述】:

我正在使用以下投射接收器

当我将我的 android 发送器连接到 chromecast 设备时,它显示黑屏并且从不播放视频。

https://github.com/googlecast/CastReferencePlayer

我在接收器中为 widevine 设置 licenseUrl,如下所示:

sampleplayer.CastPlayer.prototype.preloadVideo_ = function(mediaInformation) {
  this.log_('preloadVideo_');
  var self = this;
  var url = mediaInformation.contentId;
  var protocolFunc = sampleplayer.getProtocolFunction_(mediaInformation);
  if (!protocolFunc) {
    this.log_('No protocol found for preload');
    return false;
  }
  var host = new cast.player.api.Host({
    'url': url,
    'mediaElement': self.mediaElement_
  });
  host.onError = function() {
    self.preloadPlayer_.unload();
    self.preloadPlayer_ = null;
    self.showPreviewModeMetadata(false);
    self.displayPreviewMode_ = false;
    self.log_('Error during preload');
  };
      host.licenseUrl = event.data.customData.licenseUrl;
      self.preloadPlayer_ = new cast.player.api.Player(host);
      self.preloadPlayer_.preload(protocolFunc(host));
      return true;
    };

host.licenseUrl = event.data.customData.licenseUrl;

我将它托管在一个在开发者控制台上注册的 https 服务器上。

我将自定义数据作为 licenseUrl 传递到 json 对象中。

我的android发件人设置媒体信息的代码如下。

private MediaInfo buildMediaInfo() {
        MediaMetadata movieMetadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE);
        movieMetadata.putString(MediaMetadata.KEY_SUBTITLE, "Subtitle");
        movieMetadata.putString(MediaMetadata.KEY_TITLE, "Title");
        jsonObj = new JSONObject();
        try{
            jsonObj.put("licenseUrl","https://wv.test.expressplay.com/hms/wv/rights/?ExpressPlayToken=token-value");
        }catch (JSONException e){
            Log.e(null,"Failed to add description to the json object", e);
        }
        /*drmModel.getData().getStreamURL()*/
        return new MediaInfo.Builder("https://pathOfMystream.mpd")
                .setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
                .setContentType("application/dash+xml")
                .setMetadata(movieMetadata)
                .setCustomData(jsonObj)
                .setStreamDuration(player.getDuration()*1000)
                .build();
    }
  • 还需要进行哪些更改?

  • 我需要编辑接收器吗?如果是,那么需要进行哪些修改?

  • customData中的字符串名称是否“licenseUrl”需要
    变了吗?

  • CORS 已在托管视频内容的 S3 服务器上启用

请帮忙!我在这里被困了一个多星期。

谢谢。

【问题讨论】:

    标签: android chromecast widevine custom-receiver


    【解决方案1】:

    我发现event.data.customData 在从 android 发件人应用程序连接时未定义。

    所以我用event.data.media.customData

    并按如下方式访问key

    if(event.data.media.customData['licenseUrl'] !== null){
                        console.log('setting license URL from mobile');
                        host.licenseUrl = event.data.media.customData.licenseUrl;
                    }
    

    【讨论】:

      猜你喜欢
      • 2021-07-05
      • 1970-01-01
      • 1970-01-01
      • 2014-10-21
      • 2018-07-11
      • 2018-05-17
      • 2022-07-16
      • 2018-01-10
      • 1970-01-01
      相关资源
      最近更新 更多