File size: 884 Bytes
c5b101c
 
 
 
f42b4a1
ac7030c
c5b101c
 
 
 
 
 
 
ac7030c
c5b101c
 
d5b583f
 
c5b101c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"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>
  )
}