我正在尝试通过自定义接收器(CAF)将Widevine DRM内容从Android应用程序流式传输到Chromecast,但是我不知道如何动态设置许可证网址。
在下面的接收方示例中,许可证是硬编码的,但是我需要将其作为参数从发送方应用发送到接收方应用。
<html>
<head>
<script type="text/javascript" src="//www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js">
</script>
</head>
<body>
<cast-media-player></cast-media-player>
<script>
//cast.framework.CastReceiverContext.getInstance().start();
const context = cast.framework.CastReceiverContext.getInstance();
const playbackConfig = new cast.framework.PlaybackConfig();
//Widevine license URL
playbackConfig.licenseUrl = 'http://10.4.251.23:8094/license';
context.start({playbackConfig: playbackConfig});
</script>
</body>
</html>
这是发件人应用(Android):
String mStreamUrl = getStreamUrl();
String licenseUrl = getLicenseUrl();
MediaMetadata movieMetadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE);
movieMetadata.putString(MediaMetadata.KEY_TITLE, childTitle.getName());
movieMetadata.addImage(new WebImage(Uri.parse(childTitle.getBackgrounImage())));
return new MediaInfo.Builder(mStreamUrl)
.setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
.setContentType("video/mp4")
.setMetadata(movieMetadata)
.build();
}
答案 0 :(得分:0)
MediaInfo.Builder允许您也使用此方法以JSON格式发送自定义数据
公共MediaInfo.Builder setCustomData(JSONObject customData)