diff --git a/web/components/config/video-codec-selector.tsx b/web/components/config/video-codec-selector.tsx index bce3c681f..db7dbc399 100644 --- a/web/components/config/video-codec-selector.tsx +++ b/web/components/config/video-codec-selector.tsx @@ -25,6 +25,8 @@ export default function CodecSelector() { const [submitStatus, setSubmitStatus] = useState(null); const { setMessage } = useContext(AlertMessageContext); const [selectedCodec, setSelectedCodec] = useState(videoCodec); + const [pendingSaveCodec, setPendingSavecodec] = useState(videoCodec); + const [confirmPopupVisible, setConfirmPopupVisible] = React.useState(false); let resetTimer = null; @@ -38,17 +40,23 @@ export default function CodecSelector() { clearTimeout(resetTimer); }; - async function handleChange(value) { - console.log(`selected ${value}`); - setSelectedCodec(value); + function handleChange(value) { + setPendingSavecodec(value); + setConfirmPopupVisible(true); + } + + async function save() { + setSelectedCodec(pendingSaveCodec); + setPendingSavecodec(''); + setConfirmPopupVisible(false); await postConfigUpdateToAPI({ apiPath: API_VIDEO_CODEC, - data: { value: value }, + data: { value: pendingSaveCodec }, onSuccess: () => { setFieldInConfigState({ fieldName: 'videoCodec', - value: value, + value: pendingSaveCodec, path: 'videoSettings', }); setSubmitStatus(createInputStatus(STATUS_SUCCESS, 'Video codec updated.')); @@ -113,29 +121,39 @@ export default function CodecSelector() { Video Codec

- If you have access to specific hardware with the drivers and software installed for them, you - may be able to improve your video encoding performance. + If you have access to specific hardware with the drivers and software installed for them, + you may be able to improve your video encoding performance.

- - Read the documentation about this setting before changing it or you may make your stream - unplayable. - + + Read the documentation about this setting before changing it or you may make your stream + unplayable. +

- + + +

{description}