When padding video in editor, maintain video playback position in the same spot when possible

mike/debug-playlists
ElementalAlchemist 3 years ago committed by Mike Lang
parent 4bac4a46d0
commit a942af9cb4

@ -78,12 +78,20 @@ window.addEventListener("DOMContentLoaded", async (event) => {
rangesData.push({ start: rangeStartTime, end: rangeEndTime }); rangesData.push({ start: rangeStartTime, end: rangeEndTime });
} }
const videoElement = document.getElementById("video");
const currentVideoPosition = dateTimeFromVideoPlayerTime(videoElement.currentTime);
globalStartTimeString = wubloaderTimeFromDateTime(newStart); globalStartTimeString = wubloaderTimeFromDateTime(newStart);
globalEndTimeString = wubloaderTimeFromDateTime(newEnd); globalEndTimeString = wubloaderTimeFromDateTime(newEnd);
updateSegmentPlaylist(); updateSegmentPlaylist();
globalPlayer.once(Hls.Events.LEVEL_LOADED, (_data) => { globalPlayer.once(Hls.Events.LEVEL_LOADED, (_data) => {
const newVideoPosition = videoPlayerTimeFromDateTime(currentVideoPosition);
if (newVideoPosition !== null) {
videoElement.currentTime = newVideoPosition;
}
let rangeErrorCount = 0; let rangeErrorCount = 0;
for (const [rangeIndex, rangeData] of rangesData.entries()) { for (const [rangeIndex, rangeData] of rangesData.entries()) {
const rangeContainer = rangeDefinitionsElements[rangeIndex]; const rangeContainer = rangeDefinitionsElements[rangeIndex];

Loading…
Cancel
Save