I'm implementing an application that contains video player. For some reasons video files are encrypted with AES, and size of these files can be rather big to avoid loading it to RAM as one piece. I'm looking for some way to play it with AVPlayer.
Tried:
1) Custom NSURLProtocol as suggested here http://aptogo.co.uk/2010/07/protecting-resources/ Didn't work, I suggest that AVPlayer uses it's own and mine does not get called.
2) Use AVAsset to chop video in small chunks and then feed them to AVPlayer - failed because there's no API in AVPlayer for that.
Any workaround would be greatly appreciated :)
In live video streaming, broadcasters can use AES video encryption for secure streaming. When the video is encrypted, a special key scrambles the video content. They can't access the video unless the viewer has the correct digital access key.
You have 2 options:
If targeting iOS 7 and newer the check out AVAssetResourceLoaderDelegate. It allows you to do what you would with a custom NSURLProtocol but specifically for AVPlayer.
Emulate an HTTP server with support for the Range header and point the AVURLAsset to localhost.
I implemented #2 before and can provide more info if needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With