Changed channel to playlist
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user