video-dev / hls.js

HLS.js is a JavaScript library that plays HLS in browsers with support for MSE.
https://hlsjs.video-dev.org/demo
Other
14.46k stars 2.55k forks source link

How to implement PART-AES LLHLS #3875

Closed TroyKomodo closed 2 years ago

TroyKomodo commented 3 years ago

What do you want to do with Hls.js? Hi, i want to use the parent part's AES key and apply that to the child partial parts although i think the player does not like that. What have you tried so far? Exactly that.

TroyKomodo commented 3 years ago
#EXTM3U
#EXT-X-VERSION:6
#EXT-X-ALLOW-CACHE:NO
#EXT-X-TARGETDURATION:2
#EXT-X-MEDIA-SEQUENCE:0

#EXT-X-KEY:METHOD=AES-128,URI="1620601319059414600.key",IV=0x48b472b4ffd68481fc82b39ca447dd35
#EXT-X-PROGRAM-DATE-TIME:2021-05-10T01:01:59.059Z
#EXT-X-PART:DURATION=0.416,URI="0.0.ts"
#EXT-X-PART:DURATION=0.406,URI="0.1.ts"
#EXT-X-PART:DURATION=0.405,URI="0.2.ts"
#EXT-X-PART:DURATION=0.406,URI="0.3.ts"
#EXT-X-PART:DURATION=0.362,URI="0.4.ts"
#EXTINF:1.995,
0.ts
#EXT-X-PROGRAM-DATE-TIME:2021-05-10T01:02:00.549Z
#EXT-X-PART:DURATION=0.402,URI="1.0.ts"
#EXT-X-PART:DURATION=0.405,URI="1.1.ts"
#EXT-X-PART:DURATION=0.405,URI="1.2.ts"
#EXT-X-PART:DURATION=0.406,URI="1.3.ts"
#EXT-X-PART:DURATION=0.366,URI="1.4.ts"
#EXTINF:1.984,
1.ts
#EXT-X-PROGRAM-DATE-TIME:2021-05-10T01:02:02.484Z
#EXT-X-PART:DURATION=0.407,URI="2.0.ts"
#EXT-X-PART:DURATION=0.405,URI="2.1.ts"
#EXT-X-PART:DURATION=0.406,URI="2.2.ts"
#EXT-X-PRELOAD-HINT:TYPE=PART,URI="2.3.ts"
robwalch commented 3 years ago

Does this work in Safari with native playback? Please provide a sample stream that does, and we'll look into adding support.

TroyKomodo commented 3 years ago

Does this work in Safari with native playback? Please provide a sample stream that does, and we'll look into adding support.

No i was more asking if its possible? i wasnt sure since the spec says nothing about the it.

robwalch commented 3 years ago

While it's possible and I even imagine it should be supported, we do not have a test stream to verify that it is. I could also imagine that decryption may not be applied properly after the first (or any) part.

We've done work to support AES with CTE "progressive" option enabled, but it only worked with the software decryptor where were could maintain the moving vector. No testing or work was done to verify this with LL-HLS because we have no sample to verify or fix issues in the current implementation.

Another issue is that keys with vectors must be applied to the start of a segment. So if we tried to start or switch mid-segment on an independent part, decryption would fail.

Finally, if we did have a sample, then the next question is "Does Apple support it in Safari and AVPlayer?" because if they do not, it does not make sense to add support in HLS.js at this time.

TroyKomodo commented 3 years ago

Thank you. I switched to an alternative method by just verifying the auth at playlist request and then caching that for the next 5min or so and then just randomising the segment names.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] commented 2 years ago

This issue has been automatically closed because it has not had recent activity. If this issue is still valid, please ping a maintainer and ask them to label it accordingly.