diff --git a/frontend/src/components/VideoDemo.tsx b/frontend/src/components/VideoDemo.tsx new file mode 100644 index 00000000..22b9bfe6 --- /dev/null +++ b/frontend/src/components/VideoDemo.tsx @@ -0,0 +1,53 @@ +import React from "react"; + +interface VideoDemoProps { + src: string; + type: "youtube" | "local"; + title?: string; + autoplay?: boolean; +} + +export const VideoDemo: React.FC = ({ + src, + type, + title, + autoplay = false, +}) => { + if (type === "youtube") { + const youtubeParams = new URLSearchParams({ + autoplay: autoplay ? "1" : "0", + controls: "0", + showinfo: "0", + rel: "0", + loop: "1", + playlist: src.split("/").pop() || "", + }).toString(); + + const embedUrl = `${src}?${youtubeParams}`; + + return ( + + ); + } else { + return ( + + ); + } +}; diff --git a/frontend/src/components/home/KLangDemo.tsx b/frontend/src/components/home/KLangDemo.tsx index 4fcfab4e..bc565957 100644 --- a/frontend/src/components/home/KLangDemo.tsx +++ b/frontend/src/components/home/KLangDemo.tsx @@ -1,5 +1,6 @@ import { useState } from "react"; +import { VideoDemo } from "@/components/VideoDemo"; import { Button } from "@/components/ui/button"; export default function KLangDemo() { @@ -35,16 +36,12 @@ speakPhrase("Hello, I am a robot.");`,
- +