mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-06-30 09:32:50 +01:00
fix(subtitles): order detail-page & TV subtitle menus like jellyfin-web
The detail-page selector (MediaSourceButton, the #1176 replacement for TrackSheet) and the TV detail/refresh paths (ItemContent.tv, Controls.tv refreshSubtitleTracks) still listed subtitles in raw MediaStreams order (externals first). Apply compareTracksForMenu there too so every menu matches web. The in-player TV modal was already covered (fed from the sorted VideoContext tracks).
This commit is contained in:
@@ -51,6 +51,7 @@ import { useOfflineMode } from "@/providers/OfflineModeProvider";
|
||||
import { useSettings } from "@/utils/atoms/settings";
|
||||
import type { TVOptionItem } from "@/utils/atoms/tvOptionModal";
|
||||
import { getDefaultPlaySettings } from "@/utils/jellyfin/getDefaultPlaySettings";
|
||||
import { compareTracksForMenu } from "@/utils/jellyfin/subtitleUtils";
|
||||
import { formatTimeString, msToTicks, ticksToMs } from "@/utils/time";
|
||||
import { CONTROLS_CONSTANTS } from "./constants";
|
||||
import { useVideoContext } from "./contexts/VideoContext";
|
||||
@@ -317,8 +318,10 @@ export const Controls: FC<Props> = ({
|
||||
try {
|
||||
const streams = (await onRefreshSubtitleTracks?.()) ?? [];
|
||||
// Skip streams without a real index: `?? -1` would alias them to the
|
||||
// "disable subtitles" sentinel and mis-route selection.
|
||||
return streams
|
||||
// "disable subtitles" sentinel and mis-route selection. Order like
|
||||
// jellyfin-web (embedded first, externals last, forced/default up).
|
||||
return [...streams]
|
||||
.sort(compareTracksForMenu)
|
||||
.filter((stream) => typeof stream.Index === "number")
|
||||
.map((stream) => {
|
||||
const index = stream.Index as number;
|
||||
|
||||
Reference in New Issue
Block a user