videojs / m3u8-parser

An m3u8 parser.
Other
471 stars 98 forks source link

Widevine + Fairplay multi-drm stream #139

Closed victordidenko closed 3 years ago

victordidenko commented 3 years ago

Looks like stream, configured with multi-drm setup, Widevine + Fairplay, conflicts with AES-128 encryption detection.

In my m3u8 playlist there are two EXT-X-KEY rows, like

#EXT-X-KEY:METHOD=SAMPLE-AES,URI="data:text/plain;base64,...",KEYID=...,IV=...,KEYFORMATVERSIONS="1",KEYFORMAT="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"
#EXT-X-KEY:METHOD=SAMPLE-AES,URI="skd://...",KEYFORMATVERSIONS="1",KEYFORMAT="com.apple.streamingkeydelivery"

First one — is for Widevine, second one is for Fairplay.

This stream is correctly played in Safari, but not in Chrome. Parser correctly recognises Widevine options, but second row is recognised like AES-128 key for segments. And later, VideoJS segment loader fails to load "key" by skd:// URL, thus failing to play stream.

Shaka Player plays this stream in Chrome without errors, I guess, because there is no AES-128 support in it (https://github.com/google/shaka-player/issues/850).

victordidenko commented 3 years ago

I think parser should just ignore lines with KEYFORMAT="com.apple.streamingkeydelivery", because parser is not used in Safari (am I right?) and Safari supports HLS natively. Or add second contentProtection key for "com.apple.fps.1_0".

victordidenko commented 3 years ago

To check my guess I've added

if (entry.attributes.KEYFORMAT === "com.apple.streamingkeydelivery") {
  return;
}

in key handler, just under Widevine detection, and everything is working like charm! Widevine in Chrome, AES-128 in Chrome, Fairplay in Safari and AES-128 in Safari.

brandonocasey commented 3 years ago

I think that we should add a second contentProtection key here for com.apple.fps.1_0

victordidenko commented 3 years ago

Thanks! Do you have any idea maybe when it will be or could be landed in VideoJS?

UPD: Already landed 🎉