Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

Commit

Permalink
[MSS] Fix parsing of case insensitive boolean attribute values (Dash-…
Browse files Browse the repository at this point in the history
  • Loading branch information
bbert committed Mar 4, 2021
1 parent 17ac64b commit c7bb136
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 c7bb136

Please sign in to comment.