Spaces:
Running
Running
File size: 1,319 Bytes
f27679f c5b101c f27679f 1185ec1 c5b101c f27679f 38d787b bde82a3 f27679f 38d787b f27679f bde82a3 f27679f c5b101c f27679f c5b101c bde82a3 c5b101c f27679f c5b101c f27679f |
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
"use client"
import AutoSizer from "react-virtualized-auto-sizer"
import { cn } from "@/lib/utils"
import { VideoInfo } from "@/types/general"
import { parseProjectionFromLoRA } from "@/app/server/actions/utils/parseProjectionFromLoRA"
import { EquirectangularVideoPlayer } from "./equirectangular"
import { CartesianVideoPlayer } from "./cartesian"
export function VideoPlayer({
video,
enableShortcuts = true,
className = "",
// currentTime,
}: {
video?: VideoInfo
enableShortcuts?: boolean
className?: string
// currentTime?: number
}) {
// we should our video players from misssing data
if (!video?.assetUrl) { return null }
const isEquirectangular = (
video.projection === "equirectangular" ||
parseProjectionFromLoRA(video.lora) === "equirectangular"
)
if (isEquirectangular) {
// note: for AutoSizer to work properly it needs to be inside a normal div with no display: "flex"
return (
<div className={cn(`w-full aspect-video`, className)}>
<AutoSizer>{({ height, width }) => (
<EquirectangularVideoPlayer video={video} className={className} width={width} height={height} />
)}</AutoSizer>
</div>
)
}
return (
<CartesianVideoPlayer video={video} enableShortcuts={enableShortcuts} className={className} />
)
} |