[bugfix]: Validate audio sample range, catch AudioContext error (#470)

This commit is contained in:
Kendall Garner 2024-01-25 04:36:20 +00:00 committed by GitHub
parent 3bca85b3a8
commit 5f1d0a3b5e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 32 additions and 8 deletions

View file

@ -206,11 +206,16 @@ export const MpvSettings = () => {
{
control: (
<NumberInput
defaultValue={settings.mpvProperties.audioSampleRateHz}
defaultValue={settings.mpvProperties.audioSampleRateHz || undefined}
max={192000}
min={0}
placeholder="48000"
rightSection="Hz"
width={100}
onBlur={(e) => {
const value = Number(e.currentTarget.value);
handleSetMpvProperty('audioSampleRateHz', value > 0 ? value : undefined);
// Setting a value of `undefined` causes an error for MPV. Use 0 instead
handleSetMpvProperty('audioSampleRateHz', value >= 8000 ? value : value);
}}
/>
),