fix resume starting from beginning

This commit is contained in:
2026-06-06 21:43:20 +03:00
parent 0700226477
commit 5d12a5edc6
2 changed files with 51 additions and 5 deletions
+8 -1
View File
@@ -616,12 +616,19 @@ export function useSimilarItems(itemId?: string, limit = 12) {
* server uses our DeviceProfile to decide direct-play vs HLS transcoding.
* Without this call, the bare /main.m3u8 endpoint generates a playlist with
* runtimeTicks=0, which makes segment fetches fail with 400.
*
* `enabled` lets callers gate the call on the saved resume position
* being loaded: if a user lands on /play/:id?resume=true, the item
* has to load first so the first PlaybackInfo request includes the
* saved StartTimeTicks - otherwise the video streams from 0 and
* reloads mid-playback when the second query returns.
*/
export function usePlaybackInfo(
itemId?: string,
startTimeTicks?: number,
audioStreamIndex?: number,
maxStreamingBitrate?: number,
enabled: boolean = true,
) {
const api = useApi()
const audioPassthrough = usePreferencesStore(s => s.audioPassthrough)
@@ -659,7 +666,7 @@ export function usePlaybackInfo(
} as any)
return res.data
},
enabled: !!api && !!itemId,
enabled: !!api && !!itemId && enabled,
staleTime: 0,
// Override the global 30-minute gcTime: each PlaybackInfoResponse
// includes full MediaSources with encoding params, audio/video