From a0d06ca6e8eb39e5acedc7b1528f759f8cdaa325 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Tue, 19 Oct 2021 19:00:30 -0400 Subject: [PATCH] Fix start time in preview bar in wrong place --- src/js-components/previewBar.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/js-components/previewBar.ts b/src/js-components/previewBar.ts index c515ec85..5ef5f822 100644 --- a/src/js-components/previewBar.ts +++ b/src/js-components/previewBar.ts @@ -199,7 +199,9 @@ class PreviewBar { bar.style.position = "absolute"; const duration = segment[1] - segment[0]; if (segment[1] - segment[0] > 0) bar.style.width = this.timeToPercentage(segment[1] - segment[0]); - bar.style.left = this.timeToPercentage(Math.min(this.videoDuration - Math.max(0, duration), segment[0])); + + const time = segment[1] ? Math.min(this.videoDuration - Math.max(0, duration), segment[0]) : segment[0]; + bar.style.left = this.timeToPercentage(time); return bar; }