From 2e97fc362cfe428ca121c73c3a1b3126eb9fcfdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Fri, 19 Mar 2021 15:19:00 +0100 Subject: [PATCH] Dash: add segment ranges only to streams that have them --- src/dash.js | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/dash.js b/src/dash.js index 7d2ee4c5..10a4f2c1 100644 --- a/src/dash.js +++ b/src/dash.js @@ -160,15 +160,28 @@ function _getStreamRepresentation(stream) .replace(/&/g, '/') .replace(/=/g, '/'); - const segRange = `${stream.indexRange.start}-${stream.indexRange.end}`; - const initRange = `${stream.initRange.start}-${stream.initRange.end}`; + repArr.push( + ` ${encodedURL}` + ); + + if(stream.indexRange) { + const segRange = `${stream.indexRange.start}-${stream.indexRange.end}`; + repArr.push( + ` ` + ); + if(stream.initRange) { + const initRange = `${stream.initRange.start}-${stream.initRange.end}`; + repArr.push( + ` ` + ); + } + repArr.push( + ` ` + ); + } repArr.push( - ` ${encodedURL}`, - ` `, - ` `, - ` `, - ` `, + ` ` ); return repArr.join('\n');