From 179f06b4134baa1ba53b8b16457c76b92e688395 Mon Sep 17 00:00:00 2001 From: ElementalAlchemist Date: Mon, 13 Nov 2023 20:39:40 -0600 Subject: [PATCH] Fix loading Thrimbletrimmer and defaulting initial chapter time (#361) --- thrimbletrimmer/scripts/edit.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/thrimbletrimmer/scripts/edit.js b/thrimbletrimmer/scripts/edit.js index 405342f..437cfff 100644 --- a/thrimbletrimmer/scripts/edit.js +++ b/thrimbletrimmer/scripts/edit.js @@ -639,10 +639,16 @@ async function initializeVideoInfo() { const chapterDescField = document.getElementById( "range-definition-chapter-marker-first-description", ); + let chapterStartValue = 0; + let chapterDescValue = ""; + if (chapterData.length > 0) { + chapterStartValue = chapterData[0].start; + chapterDescValue = chapterData[0].description; + } chapterStartField.value = videoHumanTimeFromVideoPlayerTime( - chapterData[currentChapterIndex].start - rangeStartOffset + startPlayerTime, + chapterStartValue - rangeStartOffset + startPlayerTime, ); - chapterDescField.value = chapterData[currentChapterIndex].description; + chapterDescField.value = chapterDescValue; currentChapterIndex++; }