mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-06-23 14:20:25 +01:00
Compare commits
2 Commits
renovate/s
...
fix/subtit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6980cfc8e | ||
|
|
b256e99fc8 |
@@ -305,6 +305,8 @@ export default function SearchPage() {
|
||||
},
|
||||
hideWhenScrolling: false,
|
||||
autoFocus: false,
|
||||
// Android: color of the user-typed text (was dark and unreadable on the dark header)
|
||||
textColor: "#fff",
|
||||
// Android: placeholder and icon color
|
||||
hintTextColor: "#fff",
|
||||
headerIconColor: "#fff",
|
||||
|
||||
4
bun.lock
4
bun.lock
@@ -93,7 +93,7 @@
|
||||
"react-native-volume-manager": "^2.0.8",
|
||||
"react-native-web": "^0.21.0",
|
||||
"react-native-worklets": "0.8.3",
|
||||
"sonner-native": "0.26.2",
|
||||
"sonner-native": "0.21.2",
|
||||
"tailwindcss": "3.3.2",
|
||||
"use-debounce": "^10.0.4",
|
||||
"zod": "4.4.3",
|
||||
@@ -1710,7 +1710,7 @@
|
||||
|
||||
"slugify": ["slugify@1.6.9", "", {}, "sha512-vZ7rfeehZui7wQs438JXBckYLkIIdfHOXsaVEUMyS5fHo1483l1bMdo0EDSWYclY0yZKFOipDy4KHuKs6ssvdg=="],
|
||||
|
||||
"sonner-native": ["sonner-native@0.26.2", "", { "peerDependencies": { "react": "*", "react-native": "*", "react-native-gesture-handler": ">=2.28.0", "react-native-reanimated": "^4.1.1", "react-native-safe-area-context": "^5.6.0", "react-native-screens": "^4.16.0", "react-native-svg": "^15.12.1", "react-native-worklets": ">=0.6.1" } }, "sha512-duK937iN8RKzcz7lyCHBCGTGhfZzRzcuLA+brEdC7UL4yXcSh/h6Y073PnRrGBEy7ApEtRDMijgIpUUVtzjuOA=="],
|
||||
"sonner-native": ["sonner-native@0.21.2", "", { "peerDependencies": { "react": "*", "react-native": "*", "react-native-gesture-handler": ">=2.16.1", "react-native-reanimated": ">=3.10.1", "react-native-safe-area-context": ">=4.10.5", "react-native-screens": ">=3.31.1", "react-native-svg": ">=15.6.0" } }, "sha512-LnGPmfgzrNIwcc+FvcLJqx8aH1dEHePRzvNR8aIR4kl9spySRkXK160GmQIazjfm6mSMlPqZwRa5eycvrzg/eQ=="],
|
||||
|
||||
"source-map": ["source-map@0.5.7", "", {}, "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ=="],
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
"react-native-volume-manager": "^2.0.8",
|
||||
"react-native-web": "^0.21.0",
|
||||
"react-native-worklets": "0.8.3",
|
||||
"sonner-native": "0.26.2",
|
||||
"sonner-native": "0.21.2",
|
||||
"tailwindcss": "3.3.2",
|
||||
"use-debounce": "^10.0.4",
|
||||
"zod": "4.4.3"
|
||||
|
||||
@@ -44,9 +44,22 @@ export const isSubtitleInMpv = (
|
||||
/**
|
||||
* Calculate the MPV track ID for a given Jellyfin subtitle index.
|
||||
*
|
||||
* MPV track IDs are 1-based and only count subtitles that are actually in MPV.
|
||||
* We iterate through all subtitles, counting only those in MPV, until we find
|
||||
* the one matching the Jellyfin index.
|
||||
* MPV track IDs are 1-based, but MPV's track list is NOT in MediaStreams order:
|
||||
* 1. Embedded/HLS subs are enumerated from the container (or HLS playlist)
|
||||
* first, in MediaStreams order.
|
||||
* 2. External subs are appended via `sub-add` AFTER the file loads, in the
|
||||
* order they are passed to MPV (here, also MediaStreams order — see
|
||||
* direct-player.tsx where the externalSubtitles array is built by
|
||||
* filtering MediaStreams).
|
||||
*
|
||||
* Iterating in pure MediaStreams order produces the wrong MPV ID whenever an
|
||||
* External sub is listed before an Embed sub in MediaStreams (common when
|
||||
* Jellyfin prepends a converted SRT/VTT ahead of an original PGS/ASS track),
|
||||
* causing e.g. English to select Spanish. We therefore count in two phases
|
||||
* that mirror MPV's actual ordering.
|
||||
*
|
||||
* Image-based subs (PGS/VOBSUB) during transcoding are burned into the video
|
||||
* and absent from MPV's track list; they are skipped in both phases.
|
||||
*
|
||||
* @param mediaSource - The media source containing subtitle streams
|
||||
* @param jellyfinSubtitleIndex - The Jellyfin server-side subtitle index (-1 = disabled)
|
||||
@@ -74,14 +87,30 @@ export const getMpvSubtitleId = (
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Count MPV track position (1-based)
|
||||
const isExternal = (sub: MediaStream) =>
|
||||
sub.DeliveryMethod === SubtitleDeliveryMethod.External;
|
||||
|
||||
let mpvIndex = 0;
|
||||
|
||||
// Phase 1: embedded / HLS subs — these occupy MPV track IDs first because
|
||||
// they come from the container or HLS playlist.
|
||||
for (const sub of allSubs) {
|
||||
if (isSubtitleInMpv(sub, isTranscoding)) {
|
||||
mpvIndex++;
|
||||
if (sub.Index === jellyfinSubtitleIndex) {
|
||||
return mpvIndex;
|
||||
}
|
||||
if (isExternal(sub)) continue;
|
||||
if (!isSubtitleInMpv(sub, isTranscoding)) continue;
|
||||
mpvIndex++;
|
||||
if (sub.Index === jellyfinSubtitleIndex) {
|
||||
return mpvIndex;
|
||||
}
|
||||
}
|
||||
|
||||
// Phase 2: external subs — appended via `sub-add` after the file loads,
|
||||
// so they come last in MPV's track list.
|
||||
for (const sub of allSubs) {
|
||||
if (!isExternal(sub)) continue;
|
||||
if (!isSubtitleInMpv(sub, isTranscoding)) continue;
|
||||
mpvIndex++;
|
||||
if (sub.Index === jellyfinSubtitleIndex) {
|
||||
return mpvIndex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user