/* Copyright 2022-2024 New Vector Ltd. SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial Please see LICENSE in the repository root for full details. */ import { type FC, type ReactNode, useState } from "react"; import { useTranslation } from "react-i18next"; import { FieldRow, InputField } from "../input/Input"; import { type Setting, useSetting, type VideoCodec } from "./settings"; import settingsStyles from "./SettingsModal.module.css"; import { Slider } from "../Slider"; export const MediaQualitySettings: FC<{ id: string; header: string; toggleLabel: string; description: string; toggleSetting: Setting; resolutionSetting: Setting; framerateSetting: Setting; bitrateSetting: Setting; codecSetting: Setting; resolutionOptions: { value: string; label: string }[]; bitrateRange: { min: number; max: number; step: number }; }> = ({ id, header, toggleLabel, description, toggleSetting, resolutionSetting, framerateSetting, bitrateSetting, codecSetting, resolutionOptions, bitrateRange, }): ReactNode => { const { t } = useTranslation(); const [advancedEnabled, setAdvancedEnabled] = useSetting(toggleSetting); const [resolution, setResolution] = useSetting(resolutionSetting); const [framerate, setFramerate] = useSetting(framerateSetting); const [framerateRaw, setFramerateRaw] = useState(framerate); const [bitrate, setBitrate] = useSetting(bitrateSetting); const [bitrateRaw, setBitrateRaw] = useState(bitrate); const [codec, setCodec] = useSetting(codecSetting); return ( <>

{header}

setAdvancedEnabled(e.target.checked)} /> {advancedEnabled && ( <>
`${v} fps`} />
`${(v / 1_000_000).toFixed(1)} Mbps` } />
{/* Only list codecs the SFU actually accepts right now (confirmed live via matrix-rtc-sfu negotiation logs, 2026-07-28 - enabledPublishCodecs was [VP8, H264, H265]). VP9/AV1 are not currently negotiated by the SFU - selecting them silently falls back to VP8 via the client's backupCodec, so leaving them out avoids offering a choice that has no real effect. */}
)} ); };