Try to fix double load
This commit is contained in:
parent
7a1d0e8b10
commit
9138c3249d
@ -267,14 +267,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
|
||||
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<VideoRef, ReactVideoProps>(
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
console.log("Initializing and attaching shaka")
|
||||
//@ts-ignore
|
||||
shakaPlayerRef.current.attach(nativeRef.current);
|
||||
@ -307,6 +301,8 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
|
||||
}
|
||||
if (!shallowEqual(source, currentSource)) {
|
||||
console.log("Making new shaka, Old source: ", currentSource, "New source", source);
|
||||
//@ts-ignore
|
||||
setCurrentSource(source);
|
||||
makeNewShaka()
|
||||
}
|
||||
}, [source, nativeRefDefined, currentSource])
|
||||
|
Loading…
Reference in New Issue
Block a user