Fix MSE Issues (#4725)

* Don't close mse when pausing video

* Add message about MSE on iOS
This commit is contained in:
Nicolas Mowen 2022-12-17 16:56:26 -07:00 committed by GitHub
parent 7953d131ae
commit c85df9c691
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 10 deletions

View File

@ -64,10 +64,11 @@ export default function MsePlayer({ camera, width, height }) {
} }
}; };
video.onpause = () => { return () => {
const video = document.getElementById('video');
video.srcObject = null;
ws.close(); ws.close();
video.src = null; };
}
}, [url]); }, [url]);
return ( return (

View File

@ -15,6 +15,7 @@ import { useApiHost } from '../api';
import useSWR from 'swr'; import useSWR from 'swr';
import WebRtcPlayer from '../components/WebRtcPlayer'; import WebRtcPlayer from '../components/WebRtcPlayer';
import MsePlayer from '../components/MsePlayer'; import MsePlayer from '../components/MsePlayer';
import videojs from 'video.js';
const emptyObject = Object.freeze({}); const emptyObject = Object.freeze({});
@ -98,13 +99,23 @@ export default function Camera({ camera }) {
let player; let player;
if (viewMode === 'live') { if (viewMode === 'live') {
if (viewSource == 'mse') { if (viewSource == 'mse') {
player = ( if (videojs.browser.IS_IOS) {
<Fragment> player = (
<div className="max-w-5xl"> <Fragment>
<MsePlayer camera={camera} /> <div className="w-5xl text-center text-sm">
</div> MSE is not supported on iOS devices. You'll need to use jsmpeg or webRTC. See the docs for more info.
</Fragment> </div>
); </Fragment>
);
} else {
player = (
<Fragment>
<div className="max-w-5xl">
<MsePlayer camera={camera} />
</div>
</Fragment>
);
}
} else if (viewSource == 'webrtc') { } else if (viewSource == 'webrtc') {
player = ( player = (
<Fragment> <Fragment>