mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
video block misses UIs
This commit is contained in:
@@ -181,9 +181,9 @@ export function AudioBlock({ content, onUpdate, readOnly = false }) {
|
|||||||
{!readOnly && <Label>Audio</Label>}
|
{!readOnly && <Label>Audio</Label>}
|
||||||
|
|
||||||
{isS3 && tokenLoading ? (
|
{isS3 && tokenLoading ? (
|
||||||
<MediaFallback className="w-full max-w-lg h-28 rounded-xl border border-border" />
|
<MediaFallback className="w-full h-28 rounded-xl border border-border" />
|
||||||
) : src ? (
|
) : src ? (
|
||||||
<div className="w-full max-w-lg rounded-xl overflow-hidden border border-border bg-card text-card-foreground shadow-sm">
|
<div className="w-full rounded-xl overflow-hidden border border-border bg-card text-card-foreground shadow-sm">
|
||||||
<audio
|
<audio
|
||||||
ref={audioRef}
|
ref={audioRef}
|
||||||
src={src}
|
src={src}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import {
|
|||||||
Volume2,
|
Volume2,
|
||||||
VolumeX,
|
VolumeX,
|
||||||
Maximize2,
|
Maximize2,
|
||||||
|
Minimize2,
|
||||||
VideoIcon,
|
VideoIcon,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import { Label } from "@/components/ui/label";
|
import { Label } from "@/components/ui/label";
|
||||||
@@ -37,6 +38,7 @@ export function VideoBlock({ content, onUpdate, readOnly = false }) {
|
|||||||
const [muted, setMuted] = useState(false);
|
const [muted, setMuted] = useState(false);
|
||||||
const [volume, setVolume] = useState(1);
|
const [volume, setVolume] = useState(1);
|
||||||
const [overlayVisible,setOverlayVisible]= useState(true);
|
const [overlayVisible,setOverlayVisible]= useState(true);
|
||||||
|
const [isFullscreen, setIsFullscreen] = useState(false);
|
||||||
// True from the moment `src` is set until the browser has actually
|
// True from the moment `src` is set until the browser has actually
|
||||||
// buffered enough to render a frame (or stalls mid-playback) — closes the
|
// buffered enough to render a frame (or stalls mid-playback) — closes the
|
||||||
// gap between "token resolved" (the `loading` from useAssetPreviewSrc
|
// gap between "token resolved" (the `loading` from useAssetPreviewSrc
|
||||||
@@ -136,6 +138,16 @@ export function VideoBlock({ content, onUpdate, readOnly = false }) {
|
|||||||
else el.requestFullscreen?.();
|
else el.requestFullscreen?.();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// #video-block-wrap now wraps both the video area and the controls bar
|
||||||
|
// below it (previously just the video), so fullscreen no longer drops the
|
||||||
|
// seek bar / volume / fullscreen button. isFullscreen also relaxes the
|
||||||
|
// 16/9 + max-height constraints so the video fills the screen properly.
|
||||||
|
useEffect(() => {
|
||||||
|
const onChange = () => setIsFullscreen(!!document.fullscreenElement);
|
||||||
|
document.addEventListener("fullscreenchange", onChange);
|
||||||
|
return () => document.removeEventListener("fullscreenchange", onChange);
|
||||||
|
}, []);
|
||||||
|
|
||||||
// ── Asset picker handler ──────────────────────────────────────────────────
|
// ── Asset picker handler ──────────────────────────────────────────────────
|
||||||
//
|
//
|
||||||
// Saves all metadata needed by the client VideoBlock at render time.
|
// Saves all metadata needed by the client VideoBlock at render time.
|
||||||
@@ -175,13 +187,15 @@ export function VideoBlock({ content, onUpdate, readOnly = false }) {
|
|||||||
{loading ? (
|
{loading ? (
|
||||||
<MediaFallback className="w-full aspect-video rounded-lg" />
|
<MediaFallback className="w-full aspect-video rounded-lg" />
|
||||||
) : src ? (
|
) : src ? (
|
||||||
<div className="rounded-lg overflow-hidden bg-card">
|
<div
|
||||||
|
id="video-block-wrap"
|
||||||
|
className={`overflow-hidden bg-card ${isFullscreen ? "fixed inset-0 flex flex-col" : "rounded-lg border"}`}
|
||||||
|
>
|
||||||
|
|
||||||
{/* ── Video area ── */}
|
{/* ── Video area ── */}
|
||||||
<div
|
<div
|
||||||
id="video-block-wrap"
|
className={`relative w-full bg-black cursor-pointer group ${isFullscreen ? "flex-1 min-h-0" : ""}`}
|
||||||
className="relative w-full bg-black cursor-pointer group"
|
style={isFullscreen ? undefined : { aspectRatio: "16/9", maxHeight: "calc(100vh - 260px)" }}
|
||||||
style={{ aspectRatio: "16/9" }}
|
|
||||||
onClick={togglePlay}
|
onClick={togglePlay}
|
||||||
>
|
>
|
||||||
<video
|
<video
|
||||||
@@ -276,8 +290,8 @@ export function VideoBlock({ content, onUpdate, readOnly = false }) {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button onClick={toggleFullscreen} aria-label="Fullscreen" className="text-muted-foreground hover:text-foreground transition-colors ml-1">
|
<button onClick={toggleFullscreen} aria-label={isFullscreen ? "Exit fullscreen" : "Fullscreen"} className="text-muted-foreground hover:text-foreground transition-colors ml-1">
|
||||||
<Maximize2 className="size-4" />
|
{isFullscreen ? <Minimize2 className="size-4" /> : <Maximize2 className="size-4" />}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user