From b25cdce702d97d05882924cbe65d752d64243f4d Mon Sep 17 00:00:00 2001 From: Fredrik Burmester Date: Fri, 4 Oct 2024 12:08:45 +0200 Subject: [PATCH 01/10] first commit --- app/(auth)/play-video.tsx | 104 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 app/(auth)/play-video.tsx diff --git a/app/(auth)/play-video.tsx b/app/(auth)/play-video.tsx new file mode 100644 index 00000000..66050da7 --- /dev/null +++ b/app/(auth)/play-video.tsx @@ -0,0 +1,104 @@ +import { apiAtom, userAtom } from "@/providers/JellyfinProvider"; +import { useSettings } from "@/utils/atoms/settings"; +import { getBackdropUrl } from "@/utils/jellyfin/image/getBackdropUrl"; +import { getAuthHeaders } from "@/utils/jellyfin/jellyfin"; +import { Api } from "@jellyfin/sdk"; +import { BaseItemDto } from "@jellyfin/sdk/lib/generated-client"; +import { useRouter } from "expo-router"; +import { atom, useAtom } from "jotai"; +import { useMemo, useRef, useState } from "react"; +import Video, { VideoRef } from "react-native-video"; + +type PlaybackType = { + item: BaseItemDto; + mediaSourceId: string; + subtitleIndex: number; + audioIndex: number; + url: string; + quality: any; +}; + +export const playInfoAtom = atom(null); + +export default function page() { + const [playInfo, setPlayInfo] = useAtom(playInfoAtom); + const [api] = useAtom(apiAtom); + const [user] = useAtom(userAtom); + const [settings] = useSettings(); + const router = useRouter(); + const videoRef = useRef(null); + const poster = usePoster(playInfo, api); + const videoSource = useVideoSource(playInfo, api, poster); + + const [ignoreSafeArea, setIgnoreSafeArea] = useState(false); + + if (!playInfo || !api || !videoSource) return null; + + return ( +