Search code examples
objective-ciosios5http-live-streaming

How to play m3u8 encrypted playlists by providing key file separately?


I have a m3u8 playlist file(lets call it prime), which points to another playlist file which in turn has the ts URLs with the key file URL. Using MPMoviePlayer I can currently play the prime m3u8 file. The segments are encrypted with AES-128 bit encryption and the key file is in the final m3u8 file. Is there a way that I can supply the final m3u8 file and tell the app to use a local key file to decrypt the video, so I don't have to publish the key file publicly.

This is somewhat related to this SO question


Solution

  • Yes -- You can modify the final m3u8 file before passing it to the player. For example, change the KEY lines to refer to http://localhost/key. Then you would want to run a local http server such as cocoahttpserver to deliver the key to the video player.