Compare commits

..

3 commits

Author SHA1 Message Date
8bc45cda3b
Update README.md
Some checks failed
Test / lint (push) Has been cancelled
2025-11-18 14:28:19 +00:00
e154810b21
Merge branch 'jeffvli:development' into development 2025-11-17 09:51:22 +02:00
0f22b9fbd7 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
2025-11-16 18:21:25 +02:00
3 changed files with 20 additions and 14 deletions

View file

@ -224,16 +224,22 @@ export const RightControls = () => {
icon={
playbackSettings.mpvProperties.audioChannels === 'mono'
? 'volumeNormal'
: 'volumeMax'
: playbackSettings.mpvProperties.audioChannels === 'stereo'
? 'volumeMax'
: 'volumeMute'
}
iconProps={{
size: 'lg',
}}
onClick={(e) => {
e.stopPropagation();
const current =
playbackSettings.mpvProperties.audioChannels || 'stereo';
const next = current === 'mono' ? 'stereo' : 'mono';
const current = playbackSettings.mpvProperties.audioChannels || 'auto';
const next =
current === 'auto'
? 'mono'
: current === 'mono'
? 'stereo'
: 'auto';
setSettings({
playback: {
...playbackSettings,
@ -245,15 +251,15 @@ export const RightControls = () => {
});
// Apply to MPV immediately
mpvPlayer?.setProperties({
'audio-channels': next,
'audio-channels': next === 'auto' ? undefined : next,
});
}}
size="sm"
tooltip={{
label:
playbackType === PlaybackType.WEB
? `Audio: ${playbackSettings.mpvProperties.audioChannels || 'stereo'} (MPV only)`
: `Audio: ${playbackSettings.mpvProperties.audioChannels || 'stereo'}`,
? `Audio: ${playbackSettings.mpvProperties.audioChannels || 'auto'} (MPV only)`
: `Audio: ${playbackSettings.mpvProperties.audioChannels || 'auto'}`,
openDelay: 0,
}}
variant="subtle"

View file

@ -33,7 +33,7 @@ export const getMpvSetting = (
) => {
switch (key) {
case 'audioChannels':
return { 'audio-channels': value };
return { 'audio-channels': value === 'auto' ? undefined : value };
case 'audioExclusiveMode':
return { 'audio-exclusive': value || 'no' };
case 'audioSampleRateHz':
@ -55,7 +55,7 @@ export const getMpvSetting = (
export const getMpvProperties = (settings: SettingsState['playback']['mpvProperties']) => {
const properties: Record<string, any> = {
'audio-channels': settings.audioChannels || 'stereo',
'audio-channels': settings.audioChannels === 'auto' ? undefined : settings.audioChannels,
'audio-exclusive': settings.audioExclusiveMode || 'no',
'audio-samplerate':
settings.audioSampleRateHz === 0 ? undefined : settings.audioSampleRateHz,
@ -278,15 +278,15 @@ export const MpvSettings = () => {
control: (
<Select
data={[
{ label: 'Auto', value: 'auto' },
{ label: 'Mono', value: 'mono' },
{ label: 'Stereo', value: 'stereo' },
]}
defaultValue={settings.mpvProperties.audioChannels || 'stereo'}
defaultValue={settings.mpvProperties.audioChannels || 'auto'}
onChange={(e) => handleSetMpvProperty('audioChannels', e)}
/>
),
description:
'Select the audio channel mode. Stereo is the default, mono downmixes to a single channel.',
description: 'Select the audio channel mode. Auto lets MPV decide based on the source.',
isHidden: settings.type !== PlaybackType.LOCAL,
title: 'Audio Channels',
},

View file

@ -124,7 +124,7 @@ const TranscodingConfigSchema = z.object({
});
const MpvSettingsSchema = z.object({
audioChannels: z.enum(['mono', 'stereo']).optional(),
audioChannels: z.enum(['auto', 'mono', 'stereo']).optional(),
audioExclusiveMode: z.enum(['no', 'yes']),
audioFormat: z.enum(['float', 's16', 's32']).optional(),
audioSampleRateHz: z.number().optional(),
@ -658,7 +658,7 @@ const initialState: SettingsState = {
mediaSession: false,
mpvExtraParameters: [],
mpvProperties: {
audioChannels: 'stereo',
audioChannels: 'auto',
audioExclusiveMode: 'no',
audioFormat: undefined,
audioSampleRateHz: 48000,