From 9afce3b423406aae0cd2841bb39071c90196c792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Velad=20Galv=C3=A1n?= Date: Tue, 15 Nov 2022 17:47:30 +0100 Subject: [PATCH] fix: Fix usage of WebCrypto in old browsers (#4711) --- lib/hls/hls_parser.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/hls/hls_parser.js b/lib/hls/hls_parser.js index 93696f906c..57ad53bf82 100644 --- a/lib/hls/hls_parser.js +++ b/lib/hls/hls_parser.js @@ -2156,8 +2156,11 @@ shaka.hls.HlsParser = class { shaka.util.Error.Code.HLS_AES_128_INVALID_KEY_LENGTH); } + const algorithm = { + name: 'AES-CBC', + }; keyInfo.cryptoKey = await window.crypto.subtle.importKey( - 'raw', keyResponse.data, 'AES-CBC', true, ['decrypt']); + 'raw', keyResponse.data, algorithm, true, ['decrypt']); keyInfo.fetchKey = undefined; // No longer needed. };