From cedc987509e0d9d3f353dee69abd363b30e250c6 Mon Sep 17 00:00:00 2001 From: mrjvs Date: Wed, 22 Feb 2023 19:02:23 +0100 Subject: [PATCH] Add developer video testing page --- src/setup/App.tsx | 9 +++ src/views/developer/DeveloperView.tsx | 21 ++++++ src/views/developer/VideoTesterView.tsx | 85 +++++++++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 src/views/developer/DeveloperView.tsx create mode 100644 src/views/developer/VideoTesterView.tsx diff --git a/src/setup/App.tsx b/src/setup/App.tsx index 50c89f97..375f5d6d 100644 --- a/src/setup/App.tsx +++ b/src/setup/App.tsx @@ -7,16 +7,21 @@ import { MediaView } from "@/views/media/MediaView"; import { SearchView } from "@/views/search/SearchView"; import { MWMediaType } from "@/backend/metadata/types"; import { V2MigrationView } from "@/views/other/v2Migration"; +import { DeveloperView } from "@/views/developer/DeveloperView"; +import { VideoTesterView } from "@/views/developer/VideoTesterView"; function App() { return ( + {/* functional routes */} + + {/* pages */} + + {/* other */} + + diff --git a/src/views/developer/DeveloperView.tsx b/src/views/developer/DeveloperView.tsx new file mode 100644 index 00000000..f2a9d30d --- /dev/null +++ b/src/views/developer/DeveloperView.tsx @@ -0,0 +1,21 @@ +import { Navigation } from "@/components/layout/Navigation"; +import { ThinContainer } from "@/components/layout/ThinContainer"; +import { ArrowLink } from "@/components/text/ArrowLink"; +import { Title } from "@/components/text/Title"; + +export function DeveloperView() { + return ( +
+ + + Developer tools + + + +
+ ); +} diff --git a/src/views/developer/VideoTesterView.tsx b/src/views/developer/VideoTesterView.tsx new file mode 100644 index 00000000..6bf34719 --- /dev/null +++ b/src/views/developer/VideoTesterView.tsx @@ -0,0 +1,85 @@ +import { MWStreamQuality, MWStreamType } from "@/backend/helpers/streams"; +import { DetailedMeta } from "@/backend/metadata/getmeta"; +import { MWMediaType } from "@/backend/metadata/types"; +import { Button } from "@/components/Button"; +import { Navigation } from "@/components/layout/Navigation"; +import { ThinContainer } from "@/components/layout/ThinContainer"; +import { MetaController } from "@/video/components/controllers/MetaController"; +import { SourceController } from "@/video/components/controllers/SourceController"; +import { VideoPlayer } from "@/video/components/VideoPlayer"; +import { useCallback, useState } from "react"; +import { Helmet } from "react-helmet"; + +interface VideoData { + streamUrl: string; +} + +const testData: VideoData = { + streamUrl: + "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4", +}; +const testMeta: DetailedMeta = { + imdbId: "", + tmdbId: "", + meta: { + id: "hello-world", + title: "Big Buck Bunny", + type: MWMediaType.MOVIE, + seasons: undefined, + year: "2000", + }, +}; + +export function VideoTesterView() { + const [video, setVideo] = useState(null); + const [url, setUrl] = useState(""); + + const playVideo = useCallback((streamUrl: string) => { + setVideo({ + streamUrl, + }); + }, []); + + if (video) { + return ( +
+ + + + setVideo(null)}> + + + +
+ ); + } + + return ( +
+ + +
+ setUrl(e.target.value)} + /> + +
+ +
+
+ ); +}