mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 10:23:33 +00:00
provide transcoding support
This commit is contained in:
parent
da95a644c8
commit
528bef01f0
24 changed files with 347 additions and 69 deletions
|
|
@ -0,0 +1,89 @@
|
|||
import { NumberInput, Switch, TextInput } from '/@/renderer/components';
|
||||
import { usePlaybackSettings, useSettingsStoreActions } from '/@/renderer/store/settings.store';
|
||||
import { SettingOption, SettingsSection } from '../settings-section';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
export const TranscodeSettings = () => {
|
||||
const { t } = useTranslation();
|
||||
const { transcode } = usePlaybackSettings();
|
||||
const { setTranscodingConfig } = useSettingsStoreActions();
|
||||
const note = t('setting.transcodeNote', { postProcess: 'sentenceCase' });
|
||||
|
||||
const transcodeOptions: SettingOption[] = [
|
||||
{
|
||||
control: (
|
||||
<Switch
|
||||
aria-label="Toggle transcode"
|
||||
defaultChecked={transcode.enabled}
|
||||
onChange={(e) => {
|
||||
setTranscodingConfig({
|
||||
...transcode,
|
||||
enabled: e.currentTarget.checked,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
),
|
||||
description: t('setting.transcode', {
|
||||
context: 'description',
|
||||
postProcess: 'sentenceCase',
|
||||
}),
|
||||
note,
|
||||
title: t('setting.transcode', { postProcess: 'sentenceCase' }),
|
||||
},
|
||||
{
|
||||
control: (
|
||||
<NumberInput
|
||||
aria-label="Transcode bitrate"
|
||||
defaultValue={transcode.bitrate}
|
||||
min={0}
|
||||
placeholder="mp3, opus"
|
||||
w={100}
|
||||
onBlur={(e) => {
|
||||
setTranscodingConfig({
|
||||
...transcode,
|
||||
bitrate: e.currentTarget.value
|
||||
? Number(e.currentTarget.value)
|
||||
: undefined,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
),
|
||||
description: t('setting.transcodeBitrate', {
|
||||
context: 'description',
|
||||
postProcess: 'sentenceCase',
|
||||
}),
|
||||
isHidden: !transcode.enabled,
|
||||
note,
|
||||
title: t('setting.transcodeBitrate', { postProcess: 'sentenceCase' }),
|
||||
},
|
||||
{
|
||||
control: (
|
||||
<TextInput
|
||||
aria-label="transcoding format"
|
||||
defaultValue={transcode.format}
|
||||
width={100}
|
||||
onBlur={(e) => {
|
||||
setTranscodingConfig({
|
||||
...transcode,
|
||||
format: e.currentTarget.value || undefined,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
),
|
||||
description: t('setting.transcodeFormat', {
|
||||
context: 'description',
|
||||
postProcess: 'sentenceCase',
|
||||
}),
|
||||
isHidden: !transcode.enabled,
|
||||
note,
|
||||
title: t('setting.transcodeFormat', { postProcess: 'sentenceCase' }),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<SettingsSection
|
||||
divider
|
||||
options={transcodeOptions}
|
||||
/>
|
||||
);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue