forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathyoutube-video.tsx
More file actions
35 lines (30 loc) · 762 Bytes
/
Copy pathyoutube-video.tsx
File metadata and controls
35 lines (30 loc) · 762 Bytes
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
"use client";
import YouTube from "react-youtube";
export function YouTubeVideo({
videoId,
defaultPlaybackRate = 1.0,
}: {
videoId: string;
defaultPlaybackRate?: number;
}) {
const onPlayerReady: YouTube["props"]["onReady"] = (event) => {
const player = event.target;
if (defaultPlaybackRate) {
player.setPlaybackRate(defaultPlaybackRate);
}
};
const opts: YouTube["props"]["opts"] = {
playerVars: {},
};
return (
<div className="w-full aspect-video rounded-lg overflow-hidden">
<YouTube
videoId={videoId}
className="w-full h-full rounded-lg"
iframeClassName="rounded-2xl w-full h-full shadow-xl border"
opts={opts}
onReady={onPlayerReady}
/>
</div>
);
}