2023-10-01 21:08:26 +02:00
|
|
|
import { useCallback } from "react";
|
|
|
|
|
2023-09-30 20:57:00 +02:00
|
|
|
import { MWStreamType } from "@/backend/helpers/streams";
|
2023-07-23 15:00:08 +02:00
|
|
|
import { Player } from "@/components/player";
|
2023-09-30 20:57:00 +02:00
|
|
|
import { usePlayer } from "@/components/player/hooks/usePlayer";
|
2023-10-01 21:08:26 +02:00
|
|
|
import { ScrapingPart } from "@/pages/parts/player/ScrapingPart";
|
2023-09-30 20:57:00 +02:00
|
|
|
import { playerStatus } from "@/stores/player/slices/source";
|
2023-07-23 15:00:08 +02:00
|
|
|
|
|
|
|
export function PlayerView() {
|
2023-10-01 17:34:37 +02:00
|
|
|
const { status, playMedia, setScrapeStatus } = usePlayer();
|
2023-09-30 20:57:00 +02:00
|
|
|
|
2023-10-01 21:08:26 +02:00
|
|
|
const startStream = useCallback(() => {
|
2023-09-30 20:57:00 +02:00
|
|
|
playMedia({
|
|
|
|
type: MWStreamType.MP4,
|
2023-10-01 17:34:37 +02:00
|
|
|
// url: "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
|
2023-10-01 21:08:26 +02:00
|
|
|
// url: "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/WhatCarCanYouGetForAGrand.mp4",
|
|
|
|
url: "http://95.111.247.180/frog.mp4",
|
2023-09-30 20:57:00 +02:00
|
|
|
});
|
2023-10-01 21:08:26 +02:00
|
|
|
}, [playMedia]);
|
2023-10-01 17:34:37 +02:00
|
|
|
|
2023-07-23 15:00:08 +02:00
|
|
|
return (
|
2023-10-01 17:34:37 +02:00
|
|
|
<Player.Container onLoad={setScrapeStatus}>
|
2023-10-01 21:08:26 +02:00
|
|
|
<Player.BottomControls>
|
|
|
|
<Player.ProgressBar />
|
|
|
|
<div className="flex justify-between">
|
|
|
|
<div className="flex space-x-3 items-center">
|
|
|
|
<Player.Pause />
|
|
|
|
<Player.SkipBackward />
|
|
|
|
<Player.SkipForward />
|
|
|
|
<Player.Time />
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<Player.Fullscreen />
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-10-01 17:34:37 +02:00
|
|
|
</Player.BottomControls>
|
2023-09-30 20:57:00 +02:00
|
|
|
|
2023-10-01 17:34:37 +02:00
|
|
|
{status === playerStatus.SCRAPING ? (
|
2023-10-01 21:08:26 +02:00
|
|
|
<ScrapingPart
|
|
|
|
onGetStream={startStream}
|
|
|
|
media={{
|
|
|
|
type: "movie",
|
|
|
|
title: "Hamilton",
|
|
|
|
tmdbId: "556574",
|
|
|
|
releaseYear: 2020,
|
|
|
|
}}
|
|
|
|
/>
|
2023-09-30 20:57:00 +02:00
|
|
|
) : null}
|
2023-07-23 15:00:08 +02:00
|
|
|
</Player.Container>
|
|
|
|
);
|
|
|
|
}
|