From 9138c3249d91ca5f7999f571c217908f423a555a Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Thu, 17 Oct 2024 18:34:34 -0600 Subject: [PATCH] Try to fix double load --- src/Video.web.tsx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Video.web.tsx b/src/Video.web.tsx index 7a1bbcd8..57fdb6d5 100644 --- a/src/Video.web.tsx +++ b/src/Video.web.tsx @@ -267,14 +267,7 @@ const Video = forwardRef( if (source?.cropEnd) { shakaPlayerRef.current.configure({playRangeEnd: source?.cropEnd / 1000}) } - if (source?.cropStart) { - shakaPlayerRef.current.configure({playRangeStart: source?.cropStart / 1000}) - } - if (source?.cropEnd) { - shakaPlayerRef.current.configure({playRangeEnd: source?.cropEnd / 1000}) - } - //@ts-ignore - setCurrentSource(source); + //@ts-ignore shakaPlayerRef.current.addEventListener("error", (event) => { //@ts-ignore @@ -287,6 +280,7 @@ const Video = forwardRef( }, }); }); + console.log("Initializing and attaching shaka") //@ts-ignore shakaPlayerRef.current.attach(nativeRef.current); @@ -305,8 +299,10 @@ const Video = forwardRef( console.log("Not starting shaka yet bc undefined") return; } - if (!shallowEqual(source, currentSource)) { + if (!shallowEqual(source, currentSource)) { console.log("Making new shaka, Old source: ", currentSource, "New source", source); + //@ts-ignore + setCurrentSource(source); makeNewShaka() } }, [source, nativeRefDefined, currentSource])