From 0e37f4af353f74b7d98b756341f717bac5f6af2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Velad=20Galv=C3=A1n?= Date: Wed, 14 Feb 2024 18:06:57 +0100 Subject: [PATCH] fix: don't double wrap URIs for HLS key requests (#6246) The `constructSegmentUris` util already returns an array, so the call to `makeRequest` was being made with an array of arrays. This wasn't causing errors for requests that use the `fetch` plugin, since `fetch` will stringify the first argument if it's an array. But the data URI plugin expects to receive a string and calls `.split()` on it, so keys using data URIs throw an error if the URI is wrapped in an array. Thanks to https://github.com/shaka-project/shaka-player/pull/6243 and @andrew0 Backported to v4.7.x --- lib/hls/hls_parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/hls/hls_parser.js b/lib/hls/hls_parser.js index cc8b08467b..638b1f59d1 100644 --- a/lib/hls/hls_parser.js +++ b/lib/hls/hls_parser.js @@ -2831,12 +2831,12 @@ shaka.hls.HlsParser = class { // Don't download the key object until the segment is parsed, to avoid a // startup delay for long manifests with lots of keys. keyInfo.fetchKey = async () => { - const keyUri = shaka.hls.Utils.constructSegmentUris( + const keyUris = shaka.hls.Utils.constructSegmentUris( getUris(), drmTag.getRequiredAttrValue('URI'), variables); const requestType = shaka.net.NetworkingEngine.RequestType.KEY; const request = shaka.net.NetworkingEngine.makeRequest( - [keyUri], this.config_.retryParameters); + keyUris, this.config_.retryParameters); const keyResponse = await this.makeNetworkRequest_(request, requestType); // keyResponse.status is undefined when URI is "data:text/plain;base64,"