diff --git a/materialious/src/lib/api/model.ts b/materialious/src/lib/api/model.ts index 7902c11c..793e795c 100644 --- a/materialious/src/lib/api/model.ts +++ b/materialious/src/lib/api/model.ts @@ -98,6 +98,8 @@ export interface Ytjs { rawApiResponse: ApiResponse; } +export type FallbackPatches = 'youtubejs' | 'piped'; + export interface VideoPlay extends Video { keywords: string[]; likeCount: number; @@ -120,7 +122,7 @@ export interface VideoPlay extends Video { captions: Captions[]; storyboards?: StoryBoard[]; ytjs?: Ytjs; - fallbackPatch?: 'youtubejs' | 'piped'; + fallbackPatch?: FallbackPatches; } export interface StoryBoard { diff --git a/materialious/src/lib/components/player/ClosedCaptions.svelte b/materialious/src/lib/components/player/ClosedCaptions.svelte index 75f52ad6..9eff9dd3 100644 --- a/materialious/src/lib/components/player/ClosedCaptions.svelte +++ b/materialious/src/lib/components/player/ClosedCaptions.svelte @@ -48,11 +48,12 @@ {#if trackVisible && captionsCues.length > 0} - {#if currentCaption && currentTime <= currentCaption.endTime && currentTime >= currentCaption.startTime} + {#if currentCaption}
- {#if currentCaption?.text} + {#if currentCaption}

- {decodeHtmlCharCodes(currentCaption.text)} + + {@html renderVTTCueString(currentCaption, currentTime)}

{/if}
diff --git a/materialious/src/lib/components/watch/Transcript.svelte b/materialious/src/lib/components/watch/Transcript.svelte index 988f600f..5c8fd05c 100644 --- a/materialious/src/lib/components/watch/Transcript.svelte +++ b/materialious/src/lib/components/watch/Transcript.svelte @@ -1,31 +1,32 @@