|
|
|
@ -30,7 +30,8 @@ export default function YoutubeEmbeddedPlayer({ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function initPlayer() { |
|
|
|
function initPlayer() { |
|
|
|
if (!videoId || !containerRef.current) return |
|
|
|
try { |
|
|
|
|
|
|
|
if (!videoId || !containerRef.current || !window.YT.Player) return |
|
|
|
playerRef.current = new window.YT.Player(containerRef.current, { |
|
|
|
playerRef.current = new window.YT.Player(containerRef.current, { |
|
|
|
videoId: videoId, |
|
|
|
videoId: videoId, |
|
|
|
events: { |
|
|
|
events: { |
|
|
|
@ -43,6 +44,10 @@ export default function YoutubeEmbeddedPlayer({ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
|
|
console.error('Failed to initialize YouTube player:', error) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return () => { |
|
|
|
return () => { |
|
|
|
|