From 88dc7ff0d0e7dde6e68e9c427c3c08a66cc00e40 Mon Sep 17 00:00:00 2001 From: slashtechno <77907286+slashtechno@users.noreply.github.com> Date: Sun, 25 Aug 2024 00:16:27 -0500 Subject: [PATCH] Update YoutubeRenderer component to fallback to playing from URL --- .../arcade/showcase/youtube-renderer.js | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/components/arcade/showcase/youtube-renderer.js b/components/arcade/showcase/youtube-renderer.js index 6b070e2b0..1344c7ff1 100644 --- a/components/arcade/showcase/youtube-renderer.js +++ b/components/arcade/showcase/youtube-renderer.js @@ -2,17 +2,28 @@ import LiteYouTubeEmbed from 'react-lite-youtube-embed'; import 'react-lite-youtube-embed/dist/LiteYouTubeEmbed.css' const YoutubeRenderer = ({ youtubeLink }) => { - if (!youtubeLink) return null - const youtubeID = youtubeLink.split('v=')[1] - if (!youtubeID) return

Invalid YouTube link: "{youtubeLink}"

+ if (!youtubeLink) return null; + const isYouTubeLink = youtubeLink.includes('youtube.com') || youtubeLink.includes('youtu.be'); + if (isYouTubeLink) { + const youtubeID = youtubeLink.split('v=')[1]; + if (!youtubeID) return

Invalid YouTube link: "{youtubeLink}"

; + + return ( + + ); + } return ( - - ) -} + + ); +}; + export default YoutubeRenderer \ No newline at end of file