File size: 3,233 Bytes
1f122c3
1185ec1
9cea1bb
1f122c3
3d4392e
761239a
ff82110
 
761239a
 
 
 
 
 
 
 
 
 
 
ac7030c
761239a
 
 
 
ac7030c
761239a
ac7030c
761239a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ac7030c
761239a
 
 
 
 
 
ac7030c
761239a
 
 
d5b583f
761239a
 
 
 
 
 
 
ac7030c
761239a
 
 
 
ac7030c
761239a
ac7030c
761239a
 
 
 
 
 
 
1f122c3
9cea1bb
 
 
3d4392e
8f2b05f
 
 
1f122c3
ff82110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
03644bc
 
 
 
 
ff82110
5cc7f12
1c60115
 
1f122c3
 
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111

import { AppQueryProps } from "@/types/general"

import { Main } from "./main"
import { getVideo } from "./api/actions/ai-tube-hf/getVideo"
import { Metadata, ResolvingMetadata } from "next"
import { arvo, signika } from './fonts'
import { cn } from "@/lib/utils/cn"

export async function generateMetadata(
  { params, searchParams: { v: videoId } }: AppQueryProps,
  parent: ResolvingMetadata
): Promise<Metadata> {
  // read route params

  const metadataBase = new URL('https://huggingface.co/spaces/jbilcke-hf/ai-tube')

  if (!videoId) {
    return {
      title: `🍿 AiTube`,
      metadataBase,
      openGraph: {
        type: "website",
        // url: "https://example.com",
        title: "AiTube",
        description: "The first fully AI generated video platform",
        siteName: "🍿 AiTube",

        videos: [],
        images: [],
      },
    }
  }

  try {
    const video = await getVideo({ videoId, neverThrow: true })

    if (!video) {
      throw new Error("Video not found")
    }

    return {
      title: `${video.label} - AiTube`,
      metadataBase,
      openGraph: {
        type: "website",
        // url: "https://example.com",
        title: video.label || "", // put the video title here
        description: video.description || "", // put the vide description here
        siteName: "AiTube",
  
        videos: [
          {
            "url": video.assetUrlHd || video.assetUrl
          }
        ],
        // images: ['/some-specific-page-image.jpg', ...previousImages],
      },
    }
  } catch (err) {
    return {
      title: "AiTube",
      metadataBase,
      openGraph: {
        type: "website",
        // url: "https://example.com",
        title: "AiTube", // put the video title here
        description: "", // put the vide description here
        siteName: "AiTube",
  
        videos: [],
        images: [],
      },
    }
  }
}

// we have routes but on Hugging Face we don't see them
// so.. let's use the work around
export default async function Page({ searchParams: { v: videoId } }: AppQueryProps) {
  const publicMedia = await getVideo({
    videoId,
    neverThrow: true
  })
  return (
    <div
      className={cn(
        `flex flex-col items-center justify-center h-screen v-screen bg-stone-800`,
        signika.className
      )}
      style={{
        background: `
          repeating-radial-gradient(#0c0a09 0 0.0001%,#393534 0 0.0002%) 50% 0/2500px 2500px,
          repeating-conic-gradient(#0c0a09 0 0.0001%,#393534 0 0.0002%) 60% 60%/2500px 2500px;
        `,
        backgroundBlendMode: 'difference',
        animation: 'staticnoise .2s infinite alternate',
        boxShadow: "inset 0 0 10vh 0 rgb(0 0 0 / 50%)" 
      }}
      >
      <div className="
      flex flex-col items-center justify-center text-center
      w-3/4 h-full
   
      ">
      <h1 className="text-yellow-400/90 text-6xl font-thin">Say goodbye to static videos.</h1>
      <p className="mt-6 text-white/80 text-xl font-thin">Coming in 2025. Follow <a href="https://x.com/@flngr" className="font-normal font-mono text-stone-50/60 hover:text-stone-50/80 hover:underline hover:underline-offset-2" target="_blank">@flngr</a> for updates.</p>
      </div>
    </div>
  )
}