Android 解密Host.processSegment中的段

Android 解密Host.processSegment中的段,android,chromecast,google-cast,Android,Chromecast,Google Cast,我有我的接收器应用程序,它可以播放加密的HLS流。使用清单中的密钥标签(EXT-X-KEY)可以播放加密的内容。但是我想自己解密这些段,因为一些安全问题,不想直接在清单中给出密钥url。 我使用webcrypto来解密HLS块。我在Chrome浏览器中尝试了解密代码(javascript),效果很好 问题 1) 如果我尝试在host.processSegment()中调用解密,Chromecast会显示加载屏幕,然后它会挂在那里,我每次都需要重新启动它。 2) 即使我没有调用decrypt并从清

我有我的接收器应用程序,它可以播放加密的HLS流。使用清单中的密钥标签(EXT-X-KEY)可以播放加密的内容。但是我想自己解密这些段,因为一些安全问题,不想直接在清单中给出密钥url。 我使用webcrypto来解密HLS块。我在Chrome浏览器中尝试了解密代码(javascript),效果很好

问题 1) 如果我尝试在host.processSegment()中调用解密,Chromecast会显示加载屏幕,然后它会挂在那里,我每次都需要重新启动它。
2) 即使我没有调用decrypt并从清单中删除EXT-X-KEY标记,Chromecast也会在加载时挂起

在上述两种情况下,我看不到Chromecast控制台日志从我的decrypt()函数打印我的日志语句。 在所有(常规可玩状态和挂起状态)中,我看到的日志如下

[goog.net.XhrIo]请求完成[GET] 200]
media_player.js:22[1.813s][cast.player.core.QualityManager]0: 当前=24153003.58,平均=19741833.27
media_player.js:22[1.827s] [cast.player.core.SegmentManager]0:进程段
media_player.js:22[1.833s][cast.player.hls.adaption]过程 分段

两个多星期以来,我一直在尝试不同的方法,以使它工作起来,但没有效果。仍在寻找解决方案。 如果你能给我指点,我会很感激的。
我已修改了我的实际代码,以便在此论坛中发布。
这是我的代码片段。

sampleplayer.CastPlayer.prototype.decrypt=函数(buf)
{
this.log((“###--sampleplayer.CastPlayer.prototype.decrypt”);
var castplayerbj=此;
var vector=castplayerbj.getivArrayBuffer();
var key=castplayerbj.cryptoKeyObject;
加密。隐蔽。解密({name:'AES-CBC',iv:vector},key,buf)。然后(函数(解密){
log_35;(“解密成功”);
返回解密;
},
函数(错误){
castPlayerObj.isDecrypting=false;
castplayerbj.log_35;(“解密失败”);
castPlayerObj.log_(错误消息);
返回buff;
});    
};
sampleplayer.CastPlayer.prototype.load=函数(){
var host=new cast.player.api.host({
“url”:url,
“mediaElement”:this.mediaElement_
});
host.processSegment=函数(流索引、数据){
self.log(prototype.loadVideo::My.processSegment);
self.log((“streamIndex=“+streamIndex”);
分段计数++;
self.log_(“段计数=”+段计数);
self.log(数据长度=“+data.length”);
self.log_(“解密流段”);
返回testDecrypt(数据、密钥)*/
//如果我尝试打开此评论,Chromecast将挂起。
//自我解密(数据);
返回数据;
};
this.player=new cast.player.api.player(主机);
};