mirror of
https://github.com/movie-web/native-app.git
synced 2025-09-13 16:43:25 +00:00
chore: cleanup
This commit is contained in:
28
apps/expo/src/app/videoPlayer.tsx
Normal file
28
apps/expo/src/app/videoPlayer.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
import { useLocalSearchParams, useRouter } from "expo-router";
|
||||
|
||||
import type { ItemData } from "~/components/item/item";
|
||||
import { ScraperProcess } from "~/components/player/ScraperProcess";
|
||||
import { VideoPlayer } from "~/components/player/VideoPlayer";
|
||||
import { usePlayer } from "~/hooks/player/usePlayer";
|
||||
import { PlayerStatus } from "~/stores/player/slices/interface";
|
||||
import { usePlayerStore } from "~/stores/player/store";
|
||||
|
||||
export default function VideoPlayerWrapper() {
|
||||
const playerStatus = usePlayerStore((state) => state.interface.playerStatus);
|
||||
const { presentFullscreenPlayer } = usePlayer();
|
||||
|
||||
const router = useRouter();
|
||||
const params = useLocalSearchParams();
|
||||
const data = params.data
|
||||
? (JSON.parse(params.data as string) as ItemData)
|
||||
: null;
|
||||
|
||||
if (!data) return router.back();
|
||||
|
||||
void presentFullscreenPlayer();
|
||||
|
||||
if (playerStatus === PlayerStatus.SCRAPING)
|
||||
return <ScraperProcess data={data} />;
|
||||
|
||||
if (playerStatus === PlayerStatus.READY) return <VideoPlayer />;
|
||||
}
|
Reference in New Issue
Block a user