diff --git a/overlay/src/misc/controls/WHEP.js b/overlay/src/misc/controls/WHEP.js new file mode 100644 index 0000000..81b2c8e --- /dev/null +++ b/overlay/src/misc/controls/WHEP.js @@ -0,0 +1,47 @@ +import React from 'react'; + +import { Trans } from '@lingui/macro'; +import Grid from '@mui/material/Grid'; +import Typography from '@mui/material/Typography'; + +import Checkbox from '../Checkbox'; + +function init(settings) { + return { enable: false, ...settings }; +} + +export default function Control(props) { + const settings = init(props.settings); + + React.useEffect(() => { + props.onChange(settings, true); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + + const handleChange = (what) => () => { + if (what === 'enable') { + settings[what] = !settings[what]; + } + props.onChange(settings, false); + }; + + return ( + + + Enable} + checked={settings.enable} + onChange={handleChange('enable')} + /> + + Make the channel available as a low-latency WebRTC stream via WHEP. + + + + ); +} + +Control.defaultProps = { + settings: {}, + onChange: function (settings, automatic) {}, +};