RESOLVED FIXED272525
REGRESSION (iOS 17.4): HLS Videos with AES Encryption in combination with data-uri's fail to start
https://bugs.webkit.org/show_bug.cgi?id=272525
Summary REGRESSION (iOS 17.4): HLS Videos with AES Encryption in combination with dat...
markmeeus
Reported 2024-04-11 06:48:06 PDT
In our web app we use data-uri's for loading hls encoded videos. These videos are AES encrypted and the key url is also passed as a data-uri. This used to work up to iOS 17.3, but after upgrading to 17.4 our videos fail to start. In the developer console, we do see a request to the first fragment, so I assume the manifests are parsed correctly.
Attachments
markmeeus
Comment 1 2024-04-11 07:00:31 PDT
We are not able to reproduce this issue on a simulator. Only real devices seem to have this problem
Alexey Proskuryakov
Comment 2 2024-04-11 13:00:11 PDT
Thank you for the report! Would it be possible to share a URL where we can reproduce this?
Radar WebKit Bug Importer
Comment 3 2024-04-11 13:00:37 PDT
Vipul Firodiya
Comment 4 2024-04-11 20:31:49 PDT
We are also facing the same issue, manifest is getting parsed correctly. There is a problem in the decryption of the fragments. Non encrypted HLS is working fine.
markmeeus
Comment 5 2024-04-12 00:40:23 PDT
@Vipul Firodiya is your key url also a data uri? It seems that at least someone solved this issue by using a key on https, see this ticket: https://github.com/videojs/video.js/issues/8641
markmeeus
Comment 6 2024-04-12 00:55:28 PDT
Also, maybe a wild guess, but this seems a recent change that might be related: https://bugs.webkit.org/show_bug.cgi?id=267804
markmeeus
Comment 7 2024-04-12 02:49:55 PDT
We just did a test with a key on an https url, and that does seem to work.
Ahmad Saleem
Comment 8 2024-04-12 05:05:26 PDT
(In reply to markmeeus from comment #5) > @Vipul Firodiya is your key url also a data uri? It seems that at least > someone solved this issue by using a key on https, see this ticket: > https://github.com/videojs/video.js/issues/8641 I just checked and it seems to work fine in iOS 17.4 as well. Can you share the URL, with 'http' so we can reproduce where it does not work.
markmeeus
Comment 9 2024-04-12 06:17:03 PDT
It's a bit tedious to set up a sample, because our hls fragments are generated on the fly. But I think it can be easily reproduced by using a stream manifest with a key definition that looks like this: #EXT-X-KEY:METHOD=AES-128,URI="data:application/octet-stream;charset=utf-8;base64,REDACTED-KEY-IN-BASE64",IV=0XFB84E8FB21A0D6170945E0D0C2FD6E35 so it's not related to http, but to having the key in a data uri like this.
Vipul Firodiya
Comment 10 2024-04-12 06:37:23 PDT
(In reply to markmeeus from comment #9) > It's a bit tedious to set up a sample, because our hls fragments are > generated on the fly. > But I think it can be easily reproduced by using a stream manifest with a > key definition that looks like this: > > #EXT-X-KEY:METHOD=AES-128,URI="data:application/octet-stream;charset=utf-8; > base64,REDACTED-KEY-IN-BASE64",IV=0XFB84E8FB21A0D6170945E0D0C2FD6E35 > > so it's not related to http, but to having the key in a data uri like this. are you using "data:application/octet-stream;charset=utf-8; > base64,REDACTED-KEY-IN-BASE64" this format to resolve the issue or purely https url like> blob:https://example.origin/e2094e7c-218c-42ca-8898-79a2f94a632c I am having url like this blob:https://example.origin/e2094e7c-218c-42ca-8898-79a2f94a632c. but it is not working. One of the way I have used to resolve this issue for now, is decrypt the HLS content first and remove #EXT-X-KEY: line from .m3u8 file and pass that to src of video
markmeeus
Comment 11 2024-04-12 07:15:01 PDT
yes, blob's don't work either. You have to have the key url with https to work around this issue. in your case something like #EXT-X-KEY:METHOD=AES-128,URI="https://example.origin/video/xyz/key",IV=0XFB84E8FB21A0D6170945E0D0C2FD6E35
Jean-Yves Avenard [:jya]
Comment 12 2024-04-14 21:05:59 PDT
Do you have a HLS manifest available to test this? thank you
markmeeus
Comment 13 2024-04-15 01:42:50 PDT
We created a small demo here: https://www.romenov.com/streaming/ It has 2 links, the first one shows a video with encrypted segments where the key is loaded with an http request. The key line in the m3u8 looks like this: #EXT-X-KEY:METHOD=AES-128,URI="oceans.key" This video works in Safari and Mobile Safari on iOS devices. The second link has the exact same video, except it loads the key using a data uri. The key line looks like this: #EXT-X-KEY:METHOD=AES-128,URI="data:application/octet-stream;charset=utf-8;base64,9XG/7P0aua2wXOb6Aw79gQ==" This one does work in Safari, but not in Mobile Safari on a 17.4 iOS Device. (Make sure to test on an actual device because it does work in a simulator)
Jean-Yves Avenard [:jya]
Comment 15 2024-04-15 04:11:01 PDT
likely the same as bug 245428 which is resolved in iOS 17.5
Jean-Yves Avenard [:jya]
Comment 16 2024-04-15 04:11:32 PDT
ignore above comment, I entered it in the wrong bug. Apologies
Note You need to log in before you can comment on or make changes to this bug.