Add WHIP ingest control component (mirrors WHEP.js pattern)
WHIPControl renders an enable checkbox bound to control.whip_ingest.enable. The Edit/index.js save handler maps this to whip_ingest.enabled in the Core API process config via a _upsertProcess monkey-patch.
This commit is contained in:
parent
5dca8a2d9f
commit
ab8432d372
1 changed files with 47 additions and 0 deletions
47
overlay/src/misc/controls/WHIP.js
Normal file
47
overlay/src/misc/controls/WHIP.js
Normal file
|
|
@ -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 (
|
||||||
|
<Grid container spacing={2}>
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<Checkbox
|
||||||
|
label={<Trans>Enable</Trans>}
|
||||||
|
checked={settings.enable}
|
||||||
|
onChange={handleChange('enable')}
|
||||||
|
/>
|
||||||
|
<Typography variant="caption">
|
||||||
|
<Trans>Allow browsers and OBS to push a WebRTC stream into this channel via WHIP.</Trans>
|
||||||
|
</Typography>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Control.defaultProps = {
|
||||||
|
settings: {},
|
||||||
|
onChange: function (settings, automatic) {},
|
||||||
|
};
|
||||||
Loading…
Reference in a new issue