fix: play state VOD

This commit is contained in:
kieran 2024-05-13 15:29:22 +01:00
parent 65c3c4ca4e
commit 459db5b9c2
No known key found for this signature in database
GPG Key ID: DE71CEB3925BE941

View File

@ -36,12 +36,17 @@ export default function LiveVideoPlayer({
const [src, setSrc] = useState<string>();
const [levels, setLevels] = useState<Array<{ level: number; height: number }>>();
const [level, setLevel] = useState<number>(-1);
const [playState, setPlayState] = useState<"loading" | "playing" | "paused">("playing");
const [playState, iSetPlayState] = useState<"loading" | "playing" | "paused">("paused");
const [volume, setVolume] = useState(1);
const [muted, setMuted] = useState(pMuted ?? false);
const [position, setPosition] = useState<number>();
const [maxPosition, setMaxPosition] = useState<number>();
function setPlayState(s: typeof playState) {
console.debug("PLAY STATE", s);
iSetPlayState(s);
}
useEffect(() => {
if (streamCached && video.current) {
if (Hls.isSupported() && streamCached.endsWith(".m3u8")) {
@ -120,7 +125,7 @@ export default function LiveVideoPlayer({
video.current.onvolumechange = () => setVolume(video.current?.volume ?? 1);
video.current.ontimeupdate = () => setPosition(video.current?.currentTime);
}
}, [video]);
}, [video.current]);
useEffect(() => {
if (video.current) {