diff --git a/web/src/components/player/MsePlayer.tsx b/web/src/components/player/MsePlayer.tsx index 317520f57..ad2c10e24 100644 --- a/web/src/components/player/MsePlayer.tsx +++ b/web/src/components/player/MsePlayer.tsx @@ -45,7 +45,7 @@ function MSEPlayer({ ]; const visibilityCheck: boolean = !pip; - const [safariPlaying, setSafariPlaying] = useState(false); + const [isPlaying, setIsPlaying] = useState(false); const [wsState, setWsState] = useState(WebSocket.CLOSED); const [connectTS, setConnectTS] = useState(0); @@ -124,16 +124,14 @@ function MSEPlayer({ setBufferTimeout(undefined); } - if ((isSafari || isIOS) && safariPlaying) { - setSafariPlaying(false); - } + setIsPlaying(false); if (wsRef.current) { setWsState(WebSocket.CLOSED); wsRef.current.close(); wsRef.current = null; } - }, [bufferTimeout, safariPlaying]); + }, [bufferTimeout]); const onOpen = () => { setWsState(WebSocket.OPEN); @@ -382,12 +380,14 @@ function MSEPlayer({ onLoadedData={() => { handleLoadedMetadata?.(); onPlaying?.(); + setIsPlaying(true); }} muted={!audioEnabled} onPause={() => videoRef.current?.play()} onProgress={() => { - if ((isSafari || isIOS) && !safariPlaying) { - setSafariPlaying(true); + if (!isPlaying) { + setIsPlaying(true); + handleLoadedMetadata?.(); onPlaying?.(); } if (onError != undefined) {