From 351b35ef98e3ac8e54fe8c5c631d36db3689f26a Mon Sep 17 00:00:00 2001 From: Jelle van Snik Date: Tue, 10 Jan 2023 00:27:04 +0100 Subject: [PATCH] add top bar and improve ui feel --- src/components/video/DecoratedVideoPlayer.tsx | 10 +++++-- .../video/controls/BackdropControl.tsx | 6 ++-- .../video/controls/ProgressControl.tsx | 4 +-- .../video/controls/VolumeControl.tsx | 4 +-- .../video/parts/VideoPlayerHeader.tsx | 28 +++++++++++++++++++ src/views/TestView.tsx | 11 ++++++-- 6 files changed, 52 insertions(+), 11 deletions(-) create mode 100644 src/components/video/parts/VideoPlayerHeader.tsx diff --git a/src/components/video/DecoratedVideoPlayer.tsx b/src/components/video/DecoratedVideoPlayer.tsx index 3731c5a6..01891a26 100644 --- a/src/components/video/DecoratedVideoPlayer.tsx +++ b/src/components/video/DecoratedVideoPlayer.tsx @@ -5,8 +5,11 @@ import { PauseControl } from "./controls/PauseControl"; import { ProgressControl } from "./controls/ProgressControl"; import { TimeControl } from "./controls/TimeControl"; import { VolumeControl } from "./controls/VolumeControl"; +import { VideoPlayerHeader } from "./parts/VideoPlayerHeader"; import { VideoPlayer, VideoPlayerProps } from "./VideoPlayer"; +// TODO animate items away when hidden + export function DecoratedVideoPlayer(props: VideoPlayerProps) { return ( @@ -14,9 +17,9 @@ export function DecoratedVideoPlayer(props: VideoPlayerProps) {
-
+
-
+
@@ -24,6 +27,9 @@ export function DecoratedVideoPlayer(props: VideoPlayerProps) {
+
+ +
{props.children} diff --git a/src/components/video/controls/BackdropControl.tsx b/src/components/video/controls/BackdropControl.tsx index d232d579..4026884f 100644 --- a/src/components/video/controls/BackdropControl.tsx +++ b/src/components/video/controls/BackdropControl.tsx @@ -5,6 +5,8 @@ interface BackdropControlProps { children?: React.ReactNode; } +// TODO add double click to toggle fullscreen + export function BackdropControl(props: BackdropControlProps) { const { videoState } = useVideoPlayerState(); const [moved, setMoved] = useState(false); @@ -50,12 +52,12 @@ export function BackdropControl(props: BackdropControlProps) { }`} />
diff --git a/src/components/video/controls/ProgressControl.tsx b/src/components/video/controls/ProgressControl.tsx index 2b6c6777..ec1cae1d 100644 --- a/src/components/video/controls/ProgressControl.tsx +++ b/src/components/video/controls/ProgressControl.tsx @@ -44,13 +44,13 @@ export function ProgressControl() { }`} >
diff --git a/src/components/video/parts/VideoPlayerHeader.tsx b/src/components/video/parts/VideoPlayerHeader.tsx new file mode 100644 index 00000000..d0cf55f2 --- /dev/null +++ b/src/components/video/parts/VideoPlayerHeader.tsx @@ -0,0 +1,28 @@ +import { Icon, Icons } from "@/components/Icon"; +import { BrandPill } from "@/components/layout/BrandPill"; + +interface VideoPlayerHeaderProps { + title: string; + onClick?: () => void; +} + +export function VideoPlayerHeader(props: VideoPlayerHeaderProps) { + return ( +
+
+

+ + + Back to home + + + {props.title} +

+
+ +
+ ); +} diff --git a/src/views/TestView.tsx b/src/views/TestView.tsx index 8c43c08b..5fe1db5c 100644 --- a/src/views/TestView.tsx +++ b/src/views/TestView.tsx @@ -5,13 +5,18 @@ import { useCallback, useState } from "react"; // test videos: https://gist.github.com/jsturgis/3b19447b304616f18657 // TODO video todos: -// - make pretty -// - improve seekables +// - improve seekables (if possible) // - error handling // - middle pause button +// - double click backdrop to toggle fullscreen +// - make volume bar collapse when hovering away from left control section +// - animate UI when showing/hiding +// - shortcuts when player is active +// - save volume in localstorage so persists between page reloads // - improve pausing while seeking/buffering +// - volume control flashes old value when updating +// - progress control flashes old value when updating // - captions -// - backdrop better click handling // - IOS support: (no volume, fullscreen video element instead of wrapper) // - IpadOS support: (fullscreen video wrapper should work, see (lookmovie.io) ) // - HLS support: feature detection otherwise use HLS.js