Sync subtitle and audio indexes between server and offline

This commit is contained in:
Alex Kim
2026-02-19 18:23:45 +11:00
parent 9f9d949891
commit af50b023ef
6 changed files with 131 additions and 36 deletions

View File

@@ -1,6 +1,7 @@
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import { useCallback } from "react";
import useRouter from "@/hooks/useAppRouter";
import { getDownloadedItemById } from "@/providers/Downloads/database";
import { usePlaySettings } from "@/providers/PlaySettingsProvider";
import { writeToLog } from "@/utils/log";
@@ -15,9 +16,14 @@ export const useDownloadedFileOpener = () => {
console.error("Attempted to open a file without an ID.");
return;
}
const downloadedItem = getDownloadedItemById(item.Id);
const queryParams = new URLSearchParams({
itemId: item.Id,
offline: "true",
audioIndex:
downloadedItem?.userData?.audioStreamIndex?.toString() ?? "",
subtitleIndex:
downloadedItem?.userData?.subtitleStreamIndex?.toString() ?? "-1",
playbackPosition:
item.UserData?.PlaybackPositionTicks?.toString() ?? "0",
});