From 6fc8710166b90676d0802309c58341eb5d735836 Mon Sep 17 00:00:00 2001 From: ElementalAlchemist Date: Thu, 14 Oct 2021 22:35:17 -0500 Subject: [PATCH] Fix breakage of the stream page --- thrimbletrimmer/beta/scripts/common.js | 8 ++++++-- thrimbletrimmer/beta/scripts/stream.js | 10 ++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/thrimbletrimmer/beta/scripts/common.js b/thrimbletrimmer/beta/scripts/common.js index 4d4a5a5..23c454d 100644 --- a/thrimbletrimmer/beta/scripts/common.js +++ b/thrimbletrimmer/beta/scripts/common.js @@ -138,11 +138,15 @@ function generateDownloadURL(startTime, endTime, downloadType, allowHoles, quali const endURLTime = getWubloaderTimeFromDate(endTime); const queryParts = [ - `start=${startURLTime}`, - `end=${endURLTime}`, `type=${downloadType}`, `allow_holes=${allowHoles}`, ]; + if (startURLTime) { + queryParts.push(`start=${startURLTime}`); + } + if (endURLTime) { + queryParts.push(`end=${endURLTime}`); + } const downloadURL = `/cut/${globalStreamName}/${quality}.ts?${queryParts.join("&")}`; return downloadURL; diff --git a/thrimbletrimmer/beta/scripts/stream.js b/thrimbletrimmer/beta/scripts/stream.js index 561a4ef..f899458 100644 --- a/thrimbletrimmer/beta/scripts/stream.js +++ b/thrimbletrimmer/beta/scripts/stream.js @@ -1,10 +1,10 @@ -var globalLoadedVideoPlayer = false; -var globalVideoTimeReference = TIME_FRAME_AGO; - const TIME_FRAME_UTC = 1; const TIME_FRAME_BUS = 2; const TIME_FRAME_AGO = 3; +var globalLoadedVideoPlayer = false; +var globalVideoTimeReference = TIME_FRAME_AGO; + window.addEventListener("DOMContentLoaded", async (event) => { commonPageSetup(); const timeSettingsForm = document.getElementById("stream-time-settings"); @@ -78,7 +78,9 @@ function updateTimeSettings() { updateDownloadLink(); - if (getEndTime() < getStartTime()) { + const startTime = getStartTime(); + const endTime = getEndTime(); + if (endTime && endTime < startTime) { addError( "End time is before the start time. This will prevent video loading and cause other problems." );