Search code examples
iosstreamingios5http-live-streaming

Encrypted Live stream does not play in IOS5 but plays in IOS4


basically the below shown segmented video files playlist plays fine in IOS4 but not in IOS5, so i guess that there is no error in the encoding, segmenting or the encryption.

#EXTM3U
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:1
#EXT-X-KEY:METHOD=AES-128,URI="http://xxx.xx.x.xx/ios/keys/key.txt",IV=0x00000000000000000000000000000000
#EXTINF:10,
http://xxx.xx.x.xx/ios/myvideo/stream-1.ts
#EXTINF:10,
http://xxx.xx.x.xx/ios/myvideo/stream-2.ts

...

#EXTINF:10,
http://xxx.xx.x.xx/ios/myvideo/stream-502.ts
#EXTINF:10,
http://xxx.xx.x.xx/ios/myvideo/stream-503.ts
#EXT-X-ENDLIST

the error is a blunt 'The operation could not be completed' in the safari. but the same list plays fine if the files are not encrypted is both OS versions.

This thread seems to discuss a similar issue but the solution is closed to public.

i also came across this thread which suggests it is related to the #EXT-X-TARGETDURATION tag but i cannot make out much about it.


Solution

  • As per the docs here the IV tag is optional and this explains that sequence no should be used as IV while decryption if IV is missing.

    the problem IOS4 and IOS5 handles them differently

    so this works for IOS5, but threw error in IOS4

    #EXT-X-KEY:METHOD=AES-128,URI="http://xxx.xx.x.xx/ios/keys/key.txt"
    

    while this works for IOS4, but throws error in IOS5

    #EXT-X-KEY:METHOD=AES-128,URI="http://xxx.xx.x.xx/ios/keys/key.txt",IV=0x00000000000000000000000000000000
    

    in my case.