From 05972970d1f4dcf46fc9f1e770e6138175ca029a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=CC=81lvaro=20Velad=20Galva=CC=81n?= Date: Wed, 18 Sep 2024 12:33:45 +0200 Subject: [PATCH] fix(DASH): Fix HTTP redirect during manifest update --- lib/dash/dash_parser.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/dash/dash_parser.js b/lib/dash/dash_parser.js index 5b5e5921d1..1ac30b6deb 100644 --- a/lib/dash/dash_parser.js +++ b/lib/dash/dash_parser.js @@ -192,6 +192,9 @@ shaka.dash.DashParser = class { /** @private {function():boolean} */ this.isPreloadFn_ = () => false; + + /** @private {?Array.} */ + this.lastCalculatedBaseUris_ = []; } /** @@ -602,7 +605,6 @@ shaka.dash.DashParser = class { } const uriObjs = TXml.findChildren(mpd, 'BaseURL'); - let calculatedBaseUris; let someLocationValid = false; if (this.contentSteeringManager_) { for (const uriObj of uriObjs) { @@ -615,9 +617,10 @@ shaka.dash.DashParser = class { } } } + this.lastCalculatedBaseUris_ = null; if (!someLocationValid || !this.contentSteeringManager_) { const uris = uriObjs.map(TXml.getContents); - calculatedBaseUris = shaka.util.ManifestParserUtils.resolveUris( + this.lastCalculatedBaseUris_ = shaka.util.ManifestParserUtils.resolveUris( manifestBaseUris, uris); } @@ -625,8 +628,8 @@ shaka.dash.DashParser = class { if (this.contentSteeringManager_ && someLocationValid) { return this.contentSteeringManager_.getLocations('BaseURL'); } - if (calculatedBaseUris) { - return calculatedBaseUris; + if (this.lastCalculatedBaseUris_) { + return this.lastCalculatedBaseUris_; } return []; };