mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-03-06 17:56:17 +00:00
Fix playback not working for offline content
This commit is contained in:
@@ -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,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user