Spaces:
Sleeping
Sleeping
| "use client" | |
| import AutoSizer from "react-virtualized-auto-sizer" | |
| import { cn } from "@/lib/utils/cn" | |
| import { MediaInfo } from "@/types/general" | |
| import { VideoSphereViewer } from "./viewer" | |
| export function EquirectangularVideoPlayer({ | |
| video, | |
| className = "", | |
| }: { | |
| video?: MediaInfo | |
| className?: string | |
| }) { | |
| // we shield the VideeoSphere viewer from bad data | |
| if (!video?.assetUrl) { return null } | |
| return ( | |
| <div | |
| className={cn( | |
| `w-full`, | |
| // note: for AutoSizer to work properly it needs to be inside a normal div with no display: "flex" | |
| `aspect-video`, | |
| className | |
| )}> | |
| <AutoSizer> | |
| {({ height, width }) => ( | |
| <VideoSphereViewer | |
| video={video} | |
| className={className} | |
| width={width} | |
| height={height} | |
| /> | |
| )} | |
| </AutoSizer> | |
| </div> | |
| ) | |
| } |