Skip to content

Commit

Permalink
fix: dash manifest not refreshed if only some playlists are updated (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-barstow authored Sep 22, 2020
1 parent 3927c0c commit 31d3441
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 20 deletions.
5 changes: 2 additions & 3 deletions src/dash-playlist-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const parseMasterXml = ({ masterXml, srcUrl, clientOffset, sidxMapping })
* playlists merged in
*/
export const updateMaster = (oldMaster, newMaster) => {
let noChanges;
let noChanges = true;
let update = mergeOptions(oldMaster, {
// These are top level properties that can be updated
duration: newMaster.duration,
Expand All @@ -74,8 +74,7 @@ export const updateMaster = (oldMaster, newMaster) => {

if (playlistUpdate) {
update = playlistUpdate;
} else {
noChanges = true;
noChanges = false;
}
}

Expand Down
44 changes: 27 additions & 17 deletions test/dash-playlist-loader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,15 @@ QUnit.test('updateMaster: returns falsy when there are no changes', function(ass

QUnit.test('updateMaster: updates playlists', function(assert) {
const master = {
playlists: {
length: 1,
0: { uri: '0', id: '0' }
playlists: [{
uri: '0',
id: '0'
},
{
uri: '1',
id: '1',
segments: []
}],
mediaGroups: {
AUDIO: {},
SUBTITLES: {}
Expand All @@ -92,15 +97,18 @@ QUnit.test('updateMaster: updates playlists', function(assert) {
minimumUpdatePeriod: 0
};

// Only the first playlist is changed
const update = {
playlists: {
length: 1,
0: {
id: '0',
uri: '0',
segments: []
}
playlists: [{
id: '0',
uri: '0',
segments: []
},
{
uri: '1',
id: '1',
segments: []
}],
mediaGroups: {
AUDIO: {},
SUBTITLES: {}
Expand All @@ -112,14 +120,16 @@ QUnit.test('updateMaster: updates playlists', function(assert) {
assert.deepEqual(
updateMaster(master, update),
{
playlists: {
length: 1,
0: {
id: '0',
uri: '0',
segments: []
}
playlists: [{
id: '0',
uri: '0',
segments: []
},
{
uri: '1',
id: '1',
segments: []
}],
mediaGroups: {
AUDIO: {},
SUBTITLES: {}
Expand Down

0 comments on commit 31d3441

Please sign in to comment.