Skip to content

Commit

Permalink
update to only add segments if there is a sidx box parsed. Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ldayananda committed Mar 11, 2019
1 parent 1a1e8d1 commit f48bb8d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { parseUTCTimingScheme } from './parseUTCTimingScheme';

export const VERSION = version;

export const parse = (manifestString, options) =>
export const parse = (manifestString, options = {}) =>
toM3u8(toPlaylists(inheritAttributes(stringToMpdXml(manifestString), options)), options.sidxMapping);

/**
Expand Down
4 changes: 2 additions & 2 deletions src/toM3u8.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ const addSegmentInfoFromSidx = (playlists, sidxMapping) => {
const playlist = playlists[i];
const sidxKey = playlist.sidx.uri + '-' +
byteRangeToString(playlist.sidx.byterange);
const sidxMatch = sidxMapping[sidxKey];
const sidxMatch = sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx;

if (playlist.sidx && sidxMatch) {
addSegmentsToPlaylist(playlist, sidxMatch.sidx, playlist.sidx.resolvedUri);
addSegmentsToPlaylist(playlist, sidxMatch, playlist.sidx.resolvedUri);
}
}

Expand Down

0 comments on commit f48bb8d

Please sign in to comment.