Skip to content

Commit

Permalink
test fixes with m3u8-parser update
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonocasey committed Mar 4, 2021
1 parent 5c58f4d commit 32fbfce
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
4 changes: 4 additions & 0 deletions src/playlist-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ const { mergeOptions, EventTarget } = videojs;
* @return {Object} the merged segment
*/
export const updateSegment = (a, b) => {
if (!a) {
return b;
}

const result = mergeOptions(a, b);

// only the old segment has parts
Expand Down
21 changes: 13 additions & 8 deletions src/segment-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -1002,15 +1002,20 @@ export default class SegmentLoader extends videojs.EventTarget {
if (segmentInfo) {
segmentInfo.mediaIndex -= mediaSequenceDiff;

// we need to update the referenced segment so that timing information is
// saved for the new playlist's segment, however, if the segment fell off the
// playlist, we can leave the old reference and just lose the timing info
if (segmentInfo.mediaIndex >= 0) {
segmentInfo.segment = newPlaylist.segments[segmentInfo.mediaIndex];
}
if (segmentInfo.mediaIndex < 0) {
segmentInfo.mediaIndex = null;
segmentInfo.partIndex = null;
} else {
// we need to update the referenced segment so that timing information is
// saved for the new playlist's segment, however, if the segment fell off the
// playlist, we can leave the old reference and just lose the timing info
if (segmentInfo.mediaIndex >= 0) {
segmentInfo.segment = newPlaylist.segments[segmentInfo.mediaIndex];
}

if (segmentInfo.partIndex >= 0 && segmentInfo.segment.parts) {
segmentInfo.part = segmentInfo.segment.parts[segmentInfo.partIndex];
if (segmentInfo.partIndex >= 0 && segmentInfo.segment.parts) {
segmentInfo.part = segmentInfo.segment.parts[segmentInfo.partIndex];
}
}
}

Expand Down

0 comments on commit 32fbfce

Please sign in to comment.