MCPcopy Create free account
hub / github.com/videojs/http-streaming / setDateTimeMappingForStart

Method setDateTimeMappingForStart

src/sync-controller.js:495–510  ·  view source on GitHub ↗

* Save the mapping from playlist's ProgramDateTime to display. This should only happen * before segments start to load. * * @param {Playlist} playlist - The currently active playlist

(playlist)

Source from the content-addressed store, hash-verified

493 * @param {Playlist} playlist - The currently active playlist
494 */
495 setDateTimeMappingForStart(playlist) {
496 // It's possible for the playlist to be updated before playback starts, meaning time
497 // zero is not yet set. If, during these playlist refreshes, a discontinuity is
498 // crossed, then the old time zero mapping (for the prior timeline) would be retained
499 // unless the mappings are cleared.
500 this.timelineToDatetimeMappings = {};
501
502 if (playlist.segments &&
503 playlist.segments.length &&
504 playlist.segments[0].dateTimeObject) {
505 const firstSegment = playlist.segments[0];
506 const playlistTimestamp = firstSegment.dateTimeObject.getTime() / 1000;
507
508 this.timelineToDatetimeMappings[firstSegment.timeline] = -playlistTimestamp;
509 }
510 }
511
512 /**
513 * Calculates and saves timeline mappings, playlist sync info, and segment timing values

Callers 2

playlistMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected