From 45f2d51dab053a77704dfb9267221da44c06d04b Mon Sep 17 00:00:00 2001 From: Bertrand Berthelot Date: Fri, 5 Feb 2021 11:05:54 +0100 Subject: [PATCH] [MSS] Fix parsing of case insensitive boolean attribute values --- src/mss/parser/MssParser.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mss/parser/MssParser.js b/src/mss/parser/MssParser.js index 0f3e846431..e395c4cee8 100644 --- a/src/mss/parser/MssParser.js +++ b/src/mss/parser/MssParser.js @@ -87,6 +87,12 @@ function MssParser(config) { logger = debug.getLogger(instance); } + function getAttributeAsBoolean(node, attrName) { + const value = node.getAttribute(attrName); + if (!value) return false; + return value.toLowerCase() === 'true'; + } + function mapPeriod(smoothStreamingMedia, timescale) { const period = {}; let streams, @@ -598,7 +604,7 @@ function MssParser(config) { // Set manifest node properties manifest.protocol = 'MSS'; manifest.profiles = 'urn:mpeg:dash:profile:isoff-live:2011'; - manifest.type = smoothStreamingMedia.getAttribute('IsLive') === 'TRUE' ? 'dynamic' : 'static'; + manifest.type = getAttributeAsBoolean(smoothStreamingMedia, 'IsLive') ? 'dynamic' : 'static'; timescale = smoothStreamingMedia.getAttribute('TimeScale'); manifest.timescale = timescale ? parseFloat(timescale) : DEFAULT_TIME_SCALE; let dvrWindowLength = parseFloat(smoothStreamingMedia.getAttribute('DVRWindowLength')); @@ -607,7 +613,7 @@ function MssParser(config) { dvrWindowLength = Infinity; } // Star-over - if (dvrWindowLength === 0 && smoothStreamingMedia.getAttribute('CanSeek') === 'TRUE') { + if (dvrWindowLength === 0 && getAttributeAsBoolean(smoothStreamingMedia, 'CanSeek')) { dvrWindowLength = Infinity; }