Skip to content

Commit

Permalink
[MSS] Fix parsing of case insensitive boolean attribute values (#3533)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbert authored Feb 8, 2021
1 parent 3b7f2a5 commit cb5c297
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/mss/parser/MssParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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'));
Expand All @@ -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;
}

Expand Down

0 comments on commit cb5c297

Please sign in to comment.