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

Commit

Permalink
comments and mappingForTimeline
Browse files Browse the repository at this point in the history
  • Loading branch information
mjneil committed Oct 17, 2017
1 parent 82ca9e1 commit eda4e01
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/master-playlist-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -609,10 +609,14 @@ export class MasterPlaylistController extends videojs.EventTarget {
});

this.mainSegmentLoader_.on('reseteverything', () => {
// If playing an MTS stream, a videojs.MediaSource is listening for
// hls-reset to reset caption parsing state in the transmuxer
this.tech_.trigger('hls-reset');
});

this.mainSegmentLoader_.on('segmenttimemapping', (event) => {
// If playing an MTS stream in html, a videojs.MediaSource is listening for
// hls-segment-time-mapping update its internal mapping of stream to display time
this.tech_.trigger({
type: 'hls-segment-time-mapping',
mapping: event.mapping
Expand Down
6 changes: 4 additions & 2 deletions src/segment-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -1119,10 +1119,12 @@ export default class SegmentLoader extends videojs.EventTarget {
this.trigger('timestampoffset');
}

if (timingInfo && timingInfo.hasMapping) {
const timelineMapping = this.syncController_.mappingForTimeline(segmentInfo.timeline);

if (timelineMapping !== null) {
this.trigger({
type: 'segmenttimemapping',
mapping: this.syncController_.timelines[segmentInfo.timeline].mapping
mapping: timelineMapping
});
}

Expand Down
9 changes: 7 additions & 2 deletions src/sync-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,6 @@ export default class SyncController extends videojs.EventTarget {
time: segment.start
};
}

timingInfo.hasMapping = true;
}
}

Expand Down Expand Up @@ -453,6 +451,13 @@ export default class SyncController extends videojs.EventTarget {
return this.timelines[timeline].time;
}

mappingForTimeline(timeline) {
if (typeof this.timelines[timeline] === 'undefined') {
return null;
}
return this.timelines[timeline].mapping;
}

/**
* Use the "media time" for a segment to generate a mapping to "display time" and
* save that display time to the segment.
Expand Down

0 comments on commit eda4e01

Please sign in to comment.