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 17:34:37 +02:00
|
|
|
import { PlayerHoverState } from "@/stores/player/slices/interface";
|
2023-09-30 20:57:00 +02:00
|
|
|
import { playerStatus } from "@/stores/player/slices/source";
|
2023-10-01 17:34:37 +02:00
|
|
|
import { usePlayerStore } from "@/stores/player/store";
|
2023-07-23 15:00:08 +02:00
|
|
|
|
|
|
|
export function PlayerView() {
|
2023-10-01 17:34:37 +02:00
|
|
|
const { status, playMedia, setScrapeStatus } = usePlayer();
|
|
|
|
const hovering = usePlayerStore((s) => s.interface.hovering);
|
2023-09-30 20:57:00 +02:00
|
|
|
|
|
|
|
function scrape() {
|
|
|
|
playMedia({
|
|
|
|
type: MWStreamType.MP4,
|
2023-10-01 17:34:37 +02:00
|
|
|
// url: "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
|
|
|
|
url: "http://95.111.247.180/darude.mp4",
|
2023-09-30 20:57:00 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-10-01 17:34:37 +02:00
|
|
|
const showControlElements = hovering !== PlayerHoverState.NOT_HOVERING;
|
|
|
|
|
2023-07-23 15:00:08 +02:00
|
|
|
return (
|
2023-10-01 17:34:37 +02:00
|
|
|
<Player.Container onLoad={setScrapeStatus}>
|
|
|
|
<Player.BottomControls show={showControlElements}>
|
|
|
|
<Player.Pause />
|
|
|
|
<Player.Fullscreen />
|
|
|
|
</Player.BottomControls>
|
2023-09-30 20:57:00 +02:00
|
|
|
|
2023-10-01 17:34:37 +02:00
|
|
|
{status === playerStatus.SCRAPING ? (
|
|
|
|
<div className="w-full h-screen">
|
2023-09-30 20:57:00 +02:00
|
|
|
<p>Its now scraping</p>
|
|
|
|
<button type="button" onClick={scrape}>
|
|
|
|
Finish scraping
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
) : null}
|
2023-07-23 15:00:08 +02:00
|
|
|
</Player.Container>
|
|
|
|
);
|
|
|
|
}
|