Fix playback not working for offline content

This commit is contained in:
Alex Kim
2025-07-15 00:44:06 +10:00
parent 270c12c2f2
commit c010e73097
4 changed files with 14 additions and 15 deletions

View File

@@ -1,12 +1,10 @@
import generateDeviceProfile from "@/utils/profiles/native";
import type { Api } from "@jellyfin/sdk";
import type {
BaseItemDto,
MediaSourceInfo,
PlaybackInfoResponse,
} from "@jellyfin/sdk/lib/generated-client/models";
import { getMediaInfoApi } from "@jellyfin/sdk/lib/utils/api";
import { Alert } from "react-native";
import generateDeviceProfile from "@/utils/profiles/native";
export const getStreamUrl = async ({
api,
@@ -33,7 +31,7 @@ export const getStreamUrl = async ({
subtitleStreamIndex?: number;
height?: number;
mediaSourceId?: string | null;
download?: bool;
download?: boolean;
deviceId?: string | null;
}): Promise<{
url: string | null;
@@ -73,8 +71,8 @@ export const getStreamUrl = async ({
}
sessionId = res.data.PlaySessionId || null;
mediaSource = res.data.MediaSources[0];
let transcodeUrl = mediaSource.TranscodingUrl;
mediaSource = res.data.MediaSources?.[0];
let transcodeUrl = mediaSource?.TranscodingUrl;
if (transcodeUrl) {
if (download) {
@@ -125,7 +123,7 @@ export const getStreamUrl = async ({
return {
url: directPlayUrl,
sessionId: sessionId || playSessionId,
sessionId: sessionId || playSessionId || null,
mediaSource,
};
};

View File

@@ -62,7 +62,7 @@ export const generateDeviceProfile = async () => {
DirectPlayProfiles: [
{
Type: MediaTypes.Video,
Container: "mp4,mkv,avi,mov,flv,ts,m2ts,webm,ogv,3gp,hls",
Container: "mkv,avi,mov,flv,ts,m2ts,webm,ogv,3gp,hls",
VideoCodec:
"h264,hevc,mpeg4,divx,xvid,wmv,vc1,vp8,vp9,av1,avi,mpeg,mpeg2video",
AudioCodec: "aac,ac3,eac3,mp3,flac,alac,opus,vorbis,wma,dts",