Compare commits

..

3 commits

Author SHA1 Message Date
21e5a4dfd2
Merge branch 'jeffvli:development' into development
Some checks failed
Test / lint (push) Has been cancelled
2025-11-27 18:37:18 +00:00
4193dd36a1 Update README.md 2025-11-27 20:36:51 +02:00
59e94318bb 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-27 20:16:06 +02:00
3 changed files with 14 additions and 20 deletions

View file

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

View file

@ -33,7 +33,7 @@ export const getMpvSetting = (
) => {
switch (key) {
case 'audioChannels':
return { 'audio-channels': value === 'auto' ? undefined : value };
return { 'audio-channels': 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 === 'auto' ? undefined : settings.audioChannels,
'audio-channels': settings.audioChannels || 'stereo',
'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 || 'auto'}
defaultValue={settings.mpvProperties.audioChannels || 'stereo'}
onChange={(e) => handleSetMpvProperty('audioChannels', e)}
/>
),
description: 'Select the audio channel mode. Auto lets MPV decide based on the source.',
description:
'Select the audio channel mode. Stereo is the default, mono downmixes to a single channel.',
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(['auto', 'mono', 'stereo']).optional(),
audioChannels: z.enum(['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: 'auto',
audioChannels: 'stereo',
audioExclusiveMode: 'no',
audioFormat: undefined,
audioSampleRateHz: 48000,