mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-02-19 10:32:25 +00:00
refactor(player): consolidate subtitle settings to use mpvSubtitleScale only
This commit is contained in:
@@ -284,26 +284,10 @@ export default function SettingsTV() {
|
||||
/>
|
||||
<TVSettingsStepper
|
||||
label={t("home.settings.subtitles.subtitle_size")}
|
||||
value={settings.subtitleSize / 100}
|
||||
onDecrease={() => {
|
||||
const newValue = Math.max(0.3, settings.subtitleSize / 100 - 0.1);
|
||||
updateSettings({ subtitleSize: Math.round(newValue * 100) });
|
||||
}}
|
||||
onIncrease={() => {
|
||||
const newValue = Math.min(1.5, settings.subtitleSize / 100 + 0.1);
|
||||
updateSettings({ subtitleSize: Math.round(newValue * 100) });
|
||||
}}
|
||||
formatValue={(v) => `${v.toFixed(1)}x`}
|
||||
/>
|
||||
|
||||
{/* MPV Subtitles Section */}
|
||||
<TVSectionHeader title='MPV Subtitle Settings' />
|
||||
<TVSettingsStepper
|
||||
label='Subtitle Scale'
|
||||
value={settings.mpvSubtitleScale ?? 1.0}
|
||||
onDecrease={() => {
|
||||
const newValue = Math.max(
|
||||
0.5,
|
||||
0.1,
|
||||
(settings.mpvSubtitleScale ?? 1.0) - 0.1,
|
||||
);
|
||||
updateSettings({
|
||||
@@ -312,7 +296,7 @@ export default function SettingsTV() {
|
||||
}}
|
||||
onIncrease={() => {
|
||||
const newValue = Math.min(
|
||||
2.0,
|
||||
3.0,
|
||||
(settings.mpvSubtitleScale ?? 1.0) + 0.1,
|
||||
);
|
||||
updateSettings({
|
||||
|
||||
@@ -1039,15 +1039,6 @@ export default function page() {
|
||||
if (settings.mpvSubtitleAlignY !== undefined) {
|
||||
await videoRef.current?.setSubtitleAlignY?.(settings.mpvSubtitleAlignY);
|
||||
}
|
||||
if (settings.mpvSubtitleFontSize !== undefined) {
|
||||
await videoRef.current?.setSubtitleFontSize?.(
|
||||
settings.mpvSubtitleFontSize,
|
||||
);
|
||||
}
|
||||
// Apply subtitle size from general settings
|
||||
if (settings.subtitleSize) {
|
||||
await videoRef.current?.setSubtitleFontSize?.(settings.subtitleSize);
|
||||
}
|
||||
};
|
||||
|
||||
applySubtitleSettings();
|
||||
|
||||
@@ -905,8 +905,8 @@ export default function TVSubtitleModal() {
|
||||
<View style={styles.settingRow}>
|
||||
<TVStepperControl
|
||||
value={settings.mpvSubtitleScale ?? 1.0}
|
||||
min={0.5}
|
||||
max={2.0}
|
||||
min={0.1}
|
||||
max={3.0}
|
||||
step={0.1}
|
||||
formatValue={(v) => `${v.toFixed(1)}x`}
|
||||
onChange={(newValue) => {
|
||||
|
||||
@@ -68,18 +68,6 @@ export const MpvSubtitleSettings: React.FC<Props> = ({ ...props }) => {
|
||||
</Text>
|
||||
}
|
||||
>
|
||||
<ListItem title='Subtitle Scale'>
|
||||
<Stepper
|
||||
value={settings.mpvSubtitleScale ?? 1.0}
|
||||
step={0.1}
|
||||
min={0.5}
|
||||
max={2.0}
|
||||
onUpdate={(value) =>
|
||||
updateSettings({ mpvSubtitleScale: Math.round(value * 10) / 10 })
|
||||
}
|
||||
/>
|
||||
</ListItem>
|
||||
|
||||
<ListItem title='Vertical Margin'>
|
||||
<Stepper
|
||||
value={settings.mpvSubtitleMarginY ?? 0}
|
||||
|
||||
@@ -166,13 +166,13 @@ export const SubtitleToggles: React.FC<Props> = ({ ...props }) => {
|
||||
disabled={pluginSettings?.subtitleSize?.locked}
|
||||
>
|
||||
<Stepper
|
||||
value={settings.subtitleSize / 100}
|
||||
value={settings.mpvSubtitleScale ?? 1.0}
|
||||
disabled={pluginSettings?.subtitleSize?.locked}
|
||||
step={0.1}
|
||||
min={0.3}
|
||||
max={1.5}
|
||||
min={0.1}
|
||||
max={3.0}
|
||||
onUpdate={(value) =>
|
||||
updateSettings({ subtitleSize: Math.round(value * 100) })
|
||||
updateSettings({ mpvSubtitleScale: Math.round(value * 10) / 10 })
|
||||
}
|
||||
/>
|
||||
</ListItem>
|
||||
|
||||
@@ -15,16 +15,18 @@ import { usePlayerContext } from "../contexts/PlayerContext";
|
||||
import { useVideoContext } from "../contexts/VideoContext";
|
||||
import { PlaybackSpeedScope } from "../utils/playback-speed-settings";
|
||||
|
||||
// Subtitle size presets (stored as scale * 100, so 1.0 = 100)
|
||||
const SUBTITLE_SIZE_PRESETS = [
|
||||
{ label: "0.5", value: 50 },
|
||||
{ label: "0.6", value: 60 },
|
||||
{ label: "0.7", value: 70 },
|
||||
{ label: "0.8", value: 80 },
|
||||
{ label: "0.9", value: 90 },
|
||||
{ label: "1.0", value: 100 },
|
||||
{ label: "1.1", value: 110 },
|
||||
{ label: "1.2", value: 120 },
|
||||
// Subtitle scale presets (direct multiplier values)
|
||||
const SUBTITLE_SCALE_PRESETS = [
|
||||
{ label: "0.1x", value: 0.1 },
|
||||
{ label: "0.25x", value: 0.25 },
|
||||
{ label: "0.5x", value: 0.5 },
|
||||
{ label: "0.75x", value: 0.75 },
|
||||
{ label: "1.0x", value: 1.0 },
|
||||
{ label: "1.25x", value: 1.25 },
|
||||
{ label: "1.5x", value: 1.5 },
|
||||
{ label: "2.0x", value: 2.0 },
|
||||
{ label: "2.5x", value: 2.5 },
|
||||
{ label: "3.0x", value: 3.0 },
|
||||
] as const;
|
||||
|
||||
interface DropdownViewProps {
|
||||
@@ -124,15 +126,15 @@ const DropdownView = ({
|
||||
})),
|
||||
});
|
||||
|
||||
// Subtitle Size Section
|
||||
// Subtitle Scale Section
|
||||
groups.push({
|
||||
title: "Subtitle Size",
|
||||
options: SUBTITLE_SIZE_PRESETS.map((preset) => ({
|
||||
title: "Subtitle Scale",
|
||||
options: SUBTITLE_SCALE_PRESETS.map((preset) => ({
|
||||
type: "radio" as const,
|
||||
label: preset.label,
|
||||
value: preset.value.toString(),
|
||||
selected: settings.subtitleSize === preset.value,
|
||||
onPress: () => updateSettings({ subtitleSize: preset.value }),
|
||||
selected: (settings.mpvSubtitleScale ?? 1.0) === preset.value,
|
||||
onPress: () => updateSettings({ mpvSubtitleScale: preset.value }),
|
||||
})),
|
||||
});
|
||||
}
|
||||
@@ -190,7 +192,7 @@ const DropdownView = ({
|
||||
audioTracksKey,
|
||||
subtitleIndex,
|
||||
audioIndex,
|
||||
settings.subtitleSize,
|
||||
settings.mpvSubtitleScale,
|
||||
updateSettings,
|
||||
playbackSpeed,
|
||||
setPlaybackSpeed,
|
||||
|
||||
Reference in New Issue
Block a user