Changed channel to playlist

This commit is contained in:
cdricms
2025-02-13 12:27:13 +01:00
parent f96d25e31f
commit 3974e428aa
3 changed files with 21 additions and 6 deletions

View File

@@ -18,6 +18,13 @@ export default function YouTubeEmbed({
}) {
const [isIframeLoaded, setIframeLoaded] = useState(loadIframe);
const id =
typeof video === "string"
? video
: typeof video.id === "string"
? video.snippet.resourceId.videoId
: video.id.videoId;
const isString = typeof video === "string";
const _loadIframe = () => setIframeLoaded(true);
@@ -36,7 +43,7 @@ export default function YouTubeEmbed({
className="rounded-md shadow-current aspect-video"
width={width === "full" ? "100%" : width}
height={height === "full" ? "100%" : height}
src={`https://www.youtube-nocookie.com/embed/${isString ? video : video.id.videoId}?rel=0&modestbranding=1&autoplay=${autoPlay ? 1 : 0}`}
src={`https://www.youtube-nocookie.com/embed/${id}?rel=0&modestbranding=1&autoplay=${autoPlay ? 1 : 0}`}
title={
isString ? "YouTube video player" : video.snippet.title
}
@@ -50,7 +57,7 @@ export default function YouTubeEmbed({
width="100%"
height="100%"
className="w-full h-full object-cover rounded-md shadow-current"
src={`https://img.youtube.com/vi/${isString ? video : video.id.videoId}/hqdefault.jpg`}
src={`https://img.youtube.com/vi/${id}/hqdefault.jpg`}
alt={
isString
? "YouTube video player"
@@ -62,7 +69,7 @@ export default function YouTubeEmbed({
width={width}
height={height}
className="w-full h-full object-cover rounded-md shadow-current"
src={`https://img.youtube.com/vi/${isString ? video : video.id.videoId}/hqdefault.jpg`}
src={`https://img.youtube.com/vi/${id}/hqdefault.jpg`}
alt={
isString
? "YouTube video player"