Files
copilotkit__copilotkit/docs/components/react/youtube-video.tsx
2026-02-13 11:01:44 +01:00

36 lines
762 B
TypeScript

"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>
);
}