Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(web): read active caption cues without assuming item indexer

Richie McIlroy6c13f43cc509
diff --git a/apps/web/app/s/[videoId]/_components/caption-cues.ts b/apps/web/app/s/[videoId]/_components/caption-cues.ts
index c6dfb5663..00c5a6967 100644
--- a/apps/web/app/s/[videoId]/_components/caption-cues.ts
+++ b/apps/web/app/s/[videoId]/_components/caption-cues.ts
@@ -6,9 +6,15 @@ export function getActiveCaptionText(
}
let selectedCue: VTTCue | null = null;
+ const cueList = activeCues as TextTrackCueList & {
+ item?: (index: number) => TextTrackCue | null;
+ };
for (let index = 0; index < activeCues.length; index++) {
- const cue = activeCues.item(index) as VTTCue | null;
+ const cue = (cueList[index] ?? cueList.item?.(index)) as
+ | VTTCue
+ | null
+ | undefined;
if (cue && (!selectedCue || cue.startTime >= selectedCue.startTime)) {
selectedCue = cue;
}