Spaces:
Sleeping
Sleeping
File size: 707 Bytes
375924d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | import type { RefObject } from "react";
interface Props {
videoRef: RefObject<HTMLVideoElement | null>;
active: boolean;
error: string | null;
}
export function WebcamSensing({ videoRef, active, error }: Props) {
return (
<div className="webcam-container">
<video
ref={videoRef}
autoPlay
playsInline
muted
style={{
width: "100%",
borderRadius: 8,
display: active ? "block" : "none",
transform: "scaleX(-1)",
}}
/>
{!active && !error && (
<div className="webcam-placeholder">Camera off</div>
)}
{error && <div className="webcam-error">{error}</div>}
</div>
);
}
|