diff --git a/src/video/components/Caption.tsx b/src/video/components/Caption.tsx index 119a96a8..af3b8b80 100644 --- a/src/video/components/Caption.tsx +++ b/src/video/components/Caption.tsx @@ -17,7 +17,6 @@ export function Caption({ text }: { text?: string }) { }), }} style={{ - whiteSpace: "pre-wrap", ...captionSettings.style, }} /> diff --git a/src/video/components/CaptionRenderer.tsx b/src/video/components/CaptionRenderer.tsx index 7164232d..ed56781d 100644 --- a/src/video/components/CaptionRenderer.tsx +++ b/src/video/components/CaptionRenderer.tsx @@ -1,3 +1,4 @@ +import { Transition } from "@/components/Transition"; import { useSettings } from "@/state/settings"; import { parse, Cue } from "node-webvtt"; import { useRef } from "react"; @@ -29,7 +30,7 @@ export function CaptionRenderer({ } else { captions.current = []; } - }, [source]); + }, [source?.caption?.url]); if (!captions.current.length) return null; const isVisible = (start: number, end: number): boolean => { @@ -41,18 +42,22 @@ export function CaptionRenderer({ ); }; return ( - - {captions.current.map( - ({ identifier, end, start, text }) => - isVisible(start, end) && ( - - ) - )} - {isControlsShown ? ( -
- ) : ( -
- )} - + + + {captions.current.map( + ({ identifier, end, start, text }) => + isVisible(start, end) && ( + + ) + )} + + ); }