mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-13 15:53:18 +02:00
decouple audio device setting property depending on player type (#1617)
This commit is contained in:
@@ -5,6 +5,7 @@ import { useTranslation } from 'react-i18next';
|
||||
import { useAudioDevices } from '/@/renderer/features/settings/components/playback/audio-settings';
|
||||
import { ListConfigTable } from '/@/renderer/features/shared/components/list-config-menu';
|
||||
import {
|
||||
usePlaybackType,
|
||||
usePlayerActions,
|
||||
usePlayerProperties,
|
||||
usePlayerSongProperties,
|
||||
@@ -233,23 +234,30 @@ const AudioPlayerTypeConfig = () => {
|
||||
|
||||
const AudioDeviceConfig = () => {
|
||||
const status = usePlayerStatus();
|
||||
const playbackType = usePlaybackType();
|
||||
const playbackSettings = usePlaybackSettings();
|
||||
const { setSettings } = useSettingsStoreActions();
|
||||
|
||||
const audioDevices = useAudioDevices();
|
||||
const audioDevices = useAudioDevices(playbackType);
|
||||
const audioDeviceId =
|
||||
playbackType === PlayerType.LOCAL
|
||||
? playbackSettings.mpvAudioDeviceId
|
||||
: playbackSettings.audioDeviceId;
|
||||
|
||||
return (
|
||||
<Select
|
||||
clearable
|
||||
comboboxProps={{ withinPortal: false }}
|
||||
data={audioDevices}
|
||||
defaultValue={playbackSettings.audioDeviceId}
|
||||
defaultValue={audioDeviceId}
|
||||
disabled={status === PlayerStatus.PLAYING}
|
||||
onChange={(e) => {
|
||||
setSettings({
|
||||
playback: {
|
||||
...playbackSettings,
|
||||
audioDeviceId: e,
|
||||
...(playbackType === PlayerType.LOCAL
|
||||
? { mpvAudioDeviceId: e }
|
||||
: { audioDeviceId: e }),
|
||||
},
|
||||
});
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user