From b05b43c12e5fdaa01bab80d2be6d3c21d1fb5447 Mon Sep 17 00:00:00 2001 From: Fredrik Burmester Date: Tue, 13 Aug 2024 13:26:31 +0200 Subject: [PATCH] feat: poster --- components/CurrentlyPlayingBar.tsx | 51 ++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/components/CurrentlyPlayingBar.tsx b/components/CurrentlyPlayingBar.tsx index 42244641..966191b7 100644 --- a/components/CurrentlyPlayingBar.tsx +++ b/components/CurrentlyPlayingBar.tsx @@ -28,6 +28,9 @@ import Animated, { } from "react-native-reanimated"; import { useRouter, useSegments } from "expo-router"; import { BlurView } from "expo-blur"; +import { writeToLog } from "@/utils/log"; +import { getBackdropUrl } from "@/utils/jellyfin/image/getBackdropUrl"; +import { Image } from "expo-image"; export const currentlyPlayingItemAtom = atom<{ item: BaseItemDto; @@ -173,6 +176,17 @@ export const CurrentlyPlayingBar: React.FC = () => { [item], ); + const backdropUrl = useMemo( + () => + getBackdropUrl({ + api, + item, + quality: 70, + width: 200, + }), + [item], + ); + useEffect(() => { if (cp?.playbackUrl) { play(); @@ -203,31 +217,50 @@ export const CurrentlyPlayingBar: React.FC = () => { onPress={() => { videoRef.current?.presentFullscreenPlayer(); }} - className="aspect-video h-full bg-neutral-800 rounded-md overflow-hidden" + className={`relative h-full bg-neutral-800 rounded-md overflow-hidden + ${item?.Type === "Audio" ? "aspect-square" : "aspect-video"} + `} > {cp.playbackUrl && (