From 6d2f5868e058be7233f1b8e55a28d95de6efc0b2 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 16 Aug 2024 13:48:41 +0200 Subject: [PATCH] Faster transcription segment detection --- .../shared/player-widgets/video-transcription.component.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/app/+videos/+video-watch/shared/player-widgets/video-transcription.component.ts b/client/src/app/+videos/+video-watch/shared/player-widgets/video-transcription.component.ts index 89f211005..ff9898b46 100644 --- a/client/src/app/+videos/+video-watch/shared/player-widgets/video-transcription.component.ts +++ b/client/src/app/+videos/+video-watch/shared/player-widgets/video-transcription.component.ts @@ -161,8 +161,8 @@ export class VideoTranscriptionComponent implements OnInit, OnChanges { const entries = parse(content).entries this.segmentsStore = entries.map(({ from, to, text }) => { - const start = Math.ceil(from / 1000) - const end = Math.ceil(to / 1000) + const start = Math.round(from / 1000) + const end = Math.round(to / 1000) return { start, @@ -217,7 +217,7 @@ export class VideoTranscriptionComponent implements OnInit, OnChanges { for (let i = this.segmentsStore.length - 1; i >= 0; i--) { const current = this.segmentsStore[i] - if (current.start < this.currentTime) { + if (current.start <= this.currentTime) { this.activeSegment = current break }