refactor: improve the playback experience

This commit is contained in:
--remove-section committed 2025-12-19 02:26:03 +05:30
1 parent 64c5b7570b
commit 50de0b7b51
5 files changed
+334 -268

No files matched your search

+12 -7
View File
@@ -4,7 +4,6 @@ import {
BaseItemKind,
ItemFields,
ItemFilter,
ItemSortBy,
LocationType,
SortOrder,
} from "@jellyfin/sdk/lib/generated-client";
@@ -221,7 +220,7 @@ export async function getPlaybackInfo(
targetItem.MediaSources?.[0].DefaultAudioStreamIndex ?? 0;
}
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
const playbackInfoPromise = getMediaInfoApi(api).getPostedPlaybackInfo({
audioStreamIndex: Number(audioStreamIndex),
subtitleStreamIndex: currentSubTrack === "nosub" ? -1 : currentSubTrack,
itemId: targetItem.Id,
@@ -233,11 +232,17 @@ export async function getPlaybackInfo(
},
});
mediaSegments = (
await getMediaSegmentsApi(api).getItemSegments({
itemId: targetItem.Id,
})
)?.data;
const segmentsPromise = getMediaSegmentsApi(api).getItemSegments({
itemId: targetItem.Id,
});
const [playbackInfoResponse, segmentsResponse] = await Promise.all([
playbackInfoPromise,
segmentsPromise,
]);
mediaSource = playbackInfoResponse;
mediaSegments = segmentsResponse?.data;
}
}