From 91cc3311281943eb4de5c9e92db2c30c1b5f1ec9 Mon Sep 17 00:00:00 2001 From: ElementalAlchemist Date: Tue, 16 Nov 2021 18:57:40 -0600 Subject: [PATCH] Move the error selecting times on restreamer to be common to both pages --- thrimbletrimmer/scripts/common.js | 7 +++++++ thrimbletrimmer/scripts/stream.js | 8 -------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/thrimbletrimmer/scripts/common.js b/thrimbletrimmer/scripts/common.js index 97e1b0f..8056b78 100644 --- a/thrimbletrimmer/scripts/common.js +++ b/thrimbletrimmer/scripts/common.js @@ -74,6 +74,13 @@ async function loadVideoPlayer(playlistURL) { globalPlayer.attachMedia(video); return new Promise((resolve, _reject) => { globalPlayer.on(Hls.Events.MEDIA_ATTACHED, () => { + const startTime = getStartTime(); + const endTime = getEndTime(); + if (endTime && endTime.diff(startTime).milliseconds < 0) { + addError( + "End time is before the start time. This will prevent video loading and cause other problems." + ); + } globalPlayer.loadSource(rangedPlaylistURL); globalPlayer.on(Hls.Events.ERROR, (_event, data) => { diff --git a/thrimbletrimmer/scripts/stream.js b/thrimbletrimmer/scripts/stream.js index 1cc1e57..70a4b46 100644 --- a/thrimbletrimmer/scripts/stream.js +++ b/thrimbletrimmer/scripts/stream.js @@ -90,14 +90,6 @@ function updateTimeSettings() { } updateDownloadLink(); - - const startTime = getStartTime(); - const endTime = getEndTime(); - if (endTime && endTime.diff(startTime).milliseconds < 0) { - addError( - "End time is before the start time. This will prevent video loading and cause other problems." - ); - } } function generateDownloadURL(startTime, endTime, downloadType, allowHoles, quality) {