From ef8dfbc23ab0b6c2f82e0c17803328c957236c33 Mon Sep 17 00:00:00 2001 From: --remove-section Date: Sun, 21 Dec 2025 14:10:27 +0530 Subject: [PATCH] fix: mediaSegment not being loaded properly --- src/components/buttons/playButton.tsx | 12 +++++++----- src/utils/methods/playback.ts | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/buttons/playButton.tsx b/src/components/buttons/playButton.tsx index 8576e6e..7fba060 100644 --- a/src/components/buttons/playButton.tsx +++ b/src/components/buttons/playButton.tsx @@ -278,12 +278,14 @@ const PlayButton = ({ enable: subtitle?.enable ?? false, }, audio: audio, - bitrate: result.mediaSource.MediaSources?.[0].Bitrate, - videoCodec: videoTrack?.[0]?.Codec, - audioCodec: audio.allTracks?.find((t) => t.Index === audio.track) - ?.Codec, + bitrate: result.mediaSource.MediaSources?.[0].Bitrate ?? 0, + videoCodec: videoTrack?.[0]?.Codec ?? "", + audioCodec: + audio.allTracks?.find((t) => t.Index === audio.track)?.Codec ?? + "", isDirectPlay: isDirectPlay, - transcodingUrl: result.mediaSource.MediaSources?.[0].TranscodingUrl, + transcodingUrl: + result.mediaSource.MediaSources?.[0].TranscodingUrl ?? "", }, playbackStream: playbackUrl, playsessionId: result.mediaSource.PlaySessionId, diff --git a/src/utils/methods/playback.ts b/src/utils/methods/playback.ts index 4912106..9736983 100644 --- a/src/utils/methods/playback.ts +++ b/src/utils/methods/playback.ts @@ -232,7 +232,7 @@ export async function getPlaybackInfo( }, }); - const segmentsPromise = getMediaSegmentsApi(api).getItemSegments({ + const segmentsPromise = await getMediaSegmentsApi(api).getItemSegments({ itemId: targetItem.Id, });