mirror of
https://github.com/Jellify-Music/App.git
synced 2026-01-27 13:38:40 -06:00
60 lines
2.2 KiB
TypeScript
60 lines
2.2 KiB
TypeScript
import { Event, useTrackPlayerEvents } from "react-native-track-player";
|
|
import { handlePlayerError } from "./helpers/error-handlers";
|
|
import { usePlayerContext } from "../../player/provider";
|
|
import { Stack as HStack, YStack } from "tamagui";
|
|
import { CachedImage } from "@georstat/react-native-image-cache";
|
|
import { useApiClientContext } from "../jellyfin-api-provider";
|
|
import { getImageApi } from "@jellyfin/sdk/lib/utils/api";
|
|
import { ImageType } from "@jellyfin/sdk/lib/generated-client/models";
|
|
import { queryConfig } from "../../api/queries/query.config";
|
|
import { Text } from "../Global/text";
|
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
|
|
export default function Player(): React.JSX.Element {
|
|
|
|
const { apiClient } = useApiClientContext();
|
|
const { queue, playbackState, nowPlaying } = usePlayerContext();
|
|
|
|
return (
|
|
<SafeAreaView>
|
|
{ nowPlaying && (
|
|
<YStack alignItems="center">
|
|
|
|
<HStack alignItems="center">
|
|
|
|
<CachedImage
|
|
source={getImageApi(apiClient!)
|
|
.getItemImageUrlById(
|
|
nowPlaying!.AlbumId,
|
|
ImageType.Primary,
|
|
{ ...queryConfig.playerArtwork }
|
|
)
|
|
}
|
|
imageStyle={{
|
|
width: 400,
|
|
height: 400,
|
|
borderRadius: 2
|
|
}}
|
|
/>
|
|
</HStack>
|
|
|
|
<HStack>
|
|
|
|
<YStack>
|
|
<Text>{nowPlaying?.title ?? "Untitled Track"}</Text>
|
|
<Text bold>{nowPlaying?.artist ?? "Unknown Artist"}</Text>
|
|
</YStack>
|
|
|
|
<HStack>
|
|
{/* Buttons for favorites, song menu go here */}
|
|
|
|
</HStack>
|
|
|
|
</HStack>
|
|
|
|
|
|
</YStack>
|
|
)}
|
|
</SafeAreaView>
|
|
);
|
|
} |