当前位置: 动力学知识库 > 问答 > 编程问答 >

ios - AVPlayer crashes on encrypted HLS material

问题描述:

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?

网友答案:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: