fix(subtitles): normalize local subtitle sentinel to -1 in stream re-negotiation URLs

This commit is contained in:
Gauvain
2026-07-08 18:14:07 +02:00
parent 8219e44b5b
commit b59759638c
3 changed files with 26 additions and 4 deletions

View File

@@ -25,7 +25,10 @@ import { Controls } from "@/components/video-player/controls/Controls";
import { Controls as TVControls } from "@/components/video-player/controls/Controls.tv";
import { PlayerProvider } from "@/components/video-player/controls/contexts/PlayerContext";
import { VideoProvider } from "@/components/video-player/controls/contexts/VideoContext";
import { LOCAL_SUBTITLE_INDEX_START } from "@/components/video-player/controls/types";
import {
LOCAL_SUBTITLE_INDEX_START,
toServerSubtitleIndex,
} from "@/components/video-player/controls/types";
import {
PlaybackSpeedScope,
updatePlaybackSpeedSettings,
@@ -888,7 +891,9 @@ export default function DirectPlayerPage() {
const queryParams = new URLSearchParams({
itemId: item?.Id ?? "",
audioIndex: String(index),
subtitleIndex: String(currentSubtitleIndex),
// A local (client-downloaded) sub only exists in the dying mpv
// instance — the server must be asked for "none" (-1) instead.
subtitleIndex: String(toServerSubtitleIndex(currentSubtitleIndex)),
mediaSourceId: stream?.mediaSource?.Id ?? "",
bitrateValue: bitrateValue?.toString() ?? "",
playbackPosition: msToTicks(progress.get()).toString(),
@@ -954,7 +959,9 @@ export default function DirectPlayerPage() {
const queryParams = new URLSearchParams({
itemId: item?.Id ?? "",
audioIndex: params.audioIndex ?? String(currentAudioIndex ?? ""),
subtitleIndex: params.subtitleIndex ?? String(currentSubtitleIndex),
subtitleIndex:
params.subtitleIndex ??
String(toServerSubtitleIndex(currentSubtitleIndex)),
mediaSourceId: stream?.mediaSource?.Id ?? "",
bitrateValue: bitrateValue?.toString() ?? "",
playbackPosition: msToTicks(progress.get()).toString(),