feat: add audio channel configuration for MPV player

- Add audio channels setting (auto/mono/stereo) to MPV properties
- Implement UI controls in settings panel and player right controls
- Enable immediate MPV property application when setting changes
- Update default playback type to LOCAL and sample rate to 48kHz
This commit is contained in:
Ante Budimir 2025-11-16 16:10:20 +02:00
parent bf5e7bc774
commit 59e94318bb
6 changed files with 94 additions and 25 deletions

View file

@ -32,6 +32,8 @@ export const getMpvSetting = (
value: any,
) => {
switch (key) {
case 'audioChannels':
return { 'audio-channels': value };
case 'audioExclusiveMode':
return { 'audio-exclusive': value || 'no' };
case 'audioSampleRateHz':
@ -53,6 +55,7 @@ export const getMpvSetting = (
export const getMpvProperties = (settings: SettingsState['playback']['mpvProperties']) => {
const properties: Record<string, any> = {
'audio-channels': settings.audioChannels || 'stereo',
'audio-exclusive': settings.audioExclusiveMode || 'no',
'audio-samplerate':
settings.audioSampleRateHz === 0 ? undefined : settings.audioSampleRateHz,
@ -271,6 +274,22 @@ export const MpvSettings = () => {
isHidden: settings.type !== PlaybackType.LOCAL,
title: t('setting.gaplessAudio', { postProcess: 'sentenceCase' }),
},
{
control: (
<Select
data={[
{ label: 'Mono', value: 'mono' },
{ label: 'Stereo', value: 'stereo' },
]}
defaultValue={settings.mpvProperties.audioChannels || 'stereo'}
onChange={(e) => handleSetMpvProperty('audioChannels', e)}
/>
),
description:
'Select the audio channel mode. Stereo is the default, mono downmixes to a single channel.',
isHidden: settings.type !== PlaybackType.LOCAL,
title: 'Audio Channels',
},
{
control: (
<NumberInput