Ibr*_*bal 11 android chromecast widevine custom-receiver
我正在使用以下演员接收器
当我将我的Android发送者连接到chromecast设备时,它显示黑屏并且从不播放视频.
https://github.com/googlecast/CastReferencePlayer
我在接收器中为broadvine设置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;
};
Run Code Online (Sandbox Code Playgroud)
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();
}
Run Code Online (Sandbox Code Playgroud)
还需要进行哪些更改?
我需要编辑接收器吗?如果是,那么需要进行哪些编辑?
是否需要
更改customData "licenseUrl"中的字符串名称
?
请帮忙!我被困在这里一个多星期了.
谢谢.
我发现event.data.customData从android发送者应用程序连接时未定义.
所以我用过 event.data.media.customData
并按以下方式访问密钥:
if(event.data.media.customData['licenseUrl'] !== null){
console.log('setting license URL from mobile');
host.licenseUrl = event.data.media.customData.licenseUrl;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
612 次 |
| 最近记录: |