File size: 1,468 Bytes
c5b101c
 
 
 
 
f42b4a1
ac7030c
c5b101c
 
ac7030c
c5b101c
 
 
 
ac7030c
c5b101c
 
 
 
ac7030c
 
 
 
 
 
 
 
 
 
 
 
 
c5b101c
 
ac7030c
 
 
c5b101c
 
 
 
 
 
 
 
 
 
 
 
 
ac7030c
 
 
 
c5b101c
 
 
 
 
 
 
ac7030c
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
"use client"

import { Player } from "react-tuby"
import "react-tuby/css/main.css"

import { cn } from "@/lib/utils/cn"
import { MediaInfo } from "@/types/general"

export function CartesianVideoPlayer({
  media,
  enableShortcuts = true,
  className = "",
  // currentTime,
 }: {
  media: MediaInfo
  enableShortcuts?: boolean
  className?: string
  // currentTime?: number
}) {

  const assetUrl = media.assetUrlHd || media.assetUrl

  if (!assetUrl) {
    return (
      <div className={cn(
        `w-full`,
        `flex flex-col items-center justify-center`,
        className
      )}>
    </div>
  )}

  return (
    <div className={cn(
        `w-full`,
        `flex flex-col items-center justify-center`,
        className
      )}>
      <div className={cn(
        `w-[calc(100%+16px)]`,
        `-ml-2 -mr-2`,
        `flex flex-col items-center justify-center`,
        )}>
        <Player
        
          // playerRef={ref}

          src={[
            {
              quality: "Full HD",

              // TODO: separate the media asset URLs into separate source channels,
              // one for each resolution
              url: media.assetUrlHd || media.assetUrl,
            }
          ]}

          keyboardShortcut={enableShortcuts}

          subtitles={[]}
          poster={
            `https://huggingface.co/datasets/jbilcke-hf/ai-tube-index/resolve/main/videos/${media.id}.webp`
          }
        />
      </div>
    </div>
  )
}