mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-01-15 23:59:08 +00:00
fix(downloads): preserve audio track selection for offline playback
This commit is contained in:
@@ -235,6 +235,9 @@ export function useDownloadEventHandlers({
|
||||
trickPlayData,
|
||||
introSegments,
|
||||
creditSegments,
|
||||
audioStreamIndex,
|
||||
subtitleStreamIndex,
|
||||
isTranscoding,
|
||||
} = process;
|
||||
const videoFile = new File(filePathToUri(event.filePath));
|
||||
const fileInfo = videoFile.info();
|
||||
@@ -258,8 +261,9 @@ export function useDownloadEventHandlers({
|
||||
introSegments,
|
||||
creditSegments,
|
||||
userData: {
|
||||
audioStreamIndex: 0,
|
||||
subtitleStreamIndex: 0,
|
||||
audioStreamIndex: audioStreamIndex ?? 0,
|
||||
subtitleStreamIndex: subtitleStreamIndex ?? -1,
|
||||
isTranscoded: isTranscoding ?? false,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -58,6 +58,8 @@ export function useDownloadOperations({
|
||||
item: BaseItemDto,
|
||||
mediaSource: MediaSourceInfo,
|
||||
maxBitrate: Bitrate,
|
||||
audioStreamIndex?: number,
|
||||
subtitleStreamIndex?: number,
|
||||
) => {
|
||||
if (!api || !item.Id || !authHeader) {
|
||||
console.warn("startBackgroundDownload ~ Missing required params");
|
||||
@@ -114,6 +116,8 @@ export function useDownloadOperations({
|
||||
trickPlayData: additionalAssets.trickPlayData,
|
||||
introSegments: additionalAssets.introSegments,
|
||||
creditSegments: additionalAssets.creditSegments,
|
||||
audioStreamIndex,
|
||||
subtitleStreamIndex,
|
||||
};
|
||||
|
||||
// Add to processes
|
||||
|
||||
@@ -21,6 +21,8 @@ interface UserData {
|
||||
subtitleStreamIndex: number;
|
||||
/** The last known audio stream index. */
|
||||
audioStreamIndex: number;
|
||||
/** Whether the downloaded file was transcoded (has only one audio track). */
|
||||
isTranscoded: boolean;
|
||||
}
|
||||
|
||||
/** Represents a segment of time in a media item, used for intro/credit skipping. */
|
||||
@@ -142,4 +144,8 @@ export type JobStatus = {
|
||||
introSegments?: MediaTimeSegment[];
|
||||
/** Pre-downloaded credit segments (optional) - downloaded before video starts */
|
||||
creditSegments?: MediaTimeSegment[];
|
||||
/** The audio stream index selected for this download */
|
||||
audioStreamIndex?: number;
|
||||
/** The subtitle stream index selected for this download */
|
||||
subtitleStreamIndex?: number;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user