diff --git a/src/components/MobileFeed.tsx b/src/components/MobileFeed.tsx index 0e9661c..344f88d 100644 --- a/src/components/MobileFeed.tsx +++ b/src/components/MobileFeed.tsx @@ -54,7 +54,7 @@ function SlideMedia({ media, author }: { media: CardMedia; author: string }) { return (
- +
{started ? null : ( <> @@ -85,9 +85,19 @@ function SlideMedia({ media, author }: { media: CardMedia; author: string }) { function PostSlide({ post, index, current, p }: { post: CardPost; index: number; current: boolean; p: FeedViewProps }) { const media = post.media.find((m) => m.kind === "video" || m.src) ?? null; const own = canDelete(post, p.feedUserId) && !!p.onDelete; - const cls = `slide ${media ? "slide-on-media" : "slide-on-text"}${current ? " is-cur" : ""}`; + // While a video plays, the author and text step aside so the native controls stay clear. + const [playing, setPlaying] = useState(false); + const cls = `slide ${media ? "slide-on-media" : "slide-on-text"}${current ? " is-cur" : ""}${playing ? " slide-playing" : ""}`; return ( -
+
setPlaying(true)} + onPauseCapture={() => setPlaying(false)} + onEndedCapture={() => setPlaying(false)} + > {media ? ( <> diff --git a/src/components/VideoPlayer.tsx b/src/components/VideoPlayer.tsx index 8c2c73e..ff2220a 100644 --- a/src/components/VideoPlayer.tsx +++ b/src/components/VideoPlayer.tsx @@ -8,6 +8,8 @@ export interface VideoPlayerProps { hlsUrl?: string | null; poster: string | null; label: string; + /** Native controls; off until the caller's own play button starts the video. Default on. */ + controls?: boolean; } const UNPLAYABLE = "Video can't be played here."; @@ -18,7 +20,7 @@ const UNPLAYABLE = "Video can't be played here."; * unsupported), else thumbnail only. Never * autoplays. Any failure falls back to the thumbnail with a short note. */ -export function VideoPlayer({ mp4Url, hlsUrl, poster, label }: VideoPlayerProps) { +export function VideoPlayer({ mp4Url, hlsUrl, poster, label, controls = true }: VideoPlayerProps) { const ref = useRef(null); const [failed, setFailed] = useState(false); @@ -77,7 +79,7 @@ export function VideoPlayer({ mp4Url, hlsUrl, poster, label }: VideoPlayerProps)