diff --git a/src/view.web.tsx b/src/view.web.tsx index 66763a1..490e58d 100644 --- a/src/view.web.tsx +++ b/src/view.web.tsx @@ -119,9 +119,11 @@ export const OmniView = ({ const headersRef = useRef(source?.src?.headers); headersRef.current = source?.src?.headers; + const startTime = source?.startTime; const config = useMemo( () => ({ hlsJs: { + ...(startTime && { startPosition: startTime }), xhrSetup: (xhr: XMLHttpRequest) => { const headers = headersRef.current; if (!headers) return; @@ -131,20 +133,9 @@ export const OmniView = ({ }, }, }), - [], + [startTime], ); - const player = usePlayer(); - const uri = source?.src.uri; - const startTime = source?.startTime; - const prevUri = useRef(undefined); - useEffect(() => { - if (!uri) return; - if (startTime) player.currentTime = startTime; - if (autoplay && prevUri.current && prevUri.current !== uri) player.play(); - prevUri.current = uri; - }, [player, uri, startTime, autoplay]); - // While casting, the receiver renders subtitles (the player forwards the // selection); skip rendering them locally on the idle