AVPlayer 在加密的 HLS 素材上崩溃
我遇到一个问题,在播放加密的 HLS 资产时,我在 URLConnectionClient 中得到 EXC_BAD_ACCESS ,并且加密密钥丢失。 MPMovieViewController 没有问题,它只是无法播放,但正如我提到的,当 AVPlayer 无法检索解密密钥时,我会崩溃。
例如:
AVPlayer *player = [[AVPlayer alloc] initWithURL:
[NSURL URLWithString:@"http://192.168.1.69/prog_index.m3u8"]];
如果文件 prog_index.m3u8 已加密并且解密密钥不可用,则会在单独的线程(具体为 com.apple.coremedia.networkbuffering)中崩溃。我已经验证,当可以加载解密密钥时,它可以正常工作。
有谁知道解决方法?
I have an issue where I get EXC_BAD_ACCESS deep in URLConnectionClient when playing encrypted HLS assets and the encryption key goes missing. MPMovieViewController has no problem, it just fails to play, but as I mention, I get a crash when AVPlayer can't retrieve the decryption keys.
For instance this:
AVPlayer *player = [[AVPlayer alloc] initWithURL:
[NSURL URLWithString:@"http://192.168.1.69/prog_index.m3u8"]];
Will crash in a separate thread (com.apple.coremedia.networkbuffering to be specific), if the file prog_index.m3u8 is encrypted and the decryption key is unavailable. I have verified that it works fine when the decryption key can be loaded.
Does anyone know of a workaround?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此错误已报告给 Apple。
解决方法是加载并解析 .m3u8 文件并加载相关的解密密钥。
如果发生错误,很容易妥善处理。
将下载的解密密钥存储在手机本地,并将 .m3u8 文件中的远程 URL 替换为本地路径。
最后,将修改后的 .m3u8 存储在本地并将该本地 URL 提供给 AVPlayer。
This bug has been reported to Apple.
A workaround would be to load and parse the .m3u8-file and load the related decryption keys.
If an error occurs, it's easy to handle that gracefully.
Store the downloaded decryption keys locally on the phone and replace the remote URL in the .m3u8 file with the local paths.
Finally, store the modified .m3u8 locally and feed that local URL to AVPlayer.