Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

YouTube video iframe causes error in NextJs app

$
0
0

I am trying to embed a YT video via iframe to my NextJS 15.1.7. The code is dead simple -

<iframe        className="col-span-12 aspect-video max-w-3xl"        width='100%'        src={`https://www.youtube.com/embed/${code}`}        allowFullScreen></iframe>

The video works just fine but I am getting an error in console that comes from https://www.youtube.com/s/player/69f581a5/player_ias.vflset/en_GB/base.js:

base.js:187 Uncaught TypeError: Cannot read properties of undefined (reading 'call')    at Yxu (base.js:187:30)    at WL.Z (base.js:8556:118)    at g.or.Z (base.js:9391:443)    at g.V.create (embed.js:92:130)    at SZ (base.js:6311:199)    at xzu.H (base.js:6311:113)    at xzu.<anonymous> (base.js:6337:80)    at T (base.js:6339:24)    at CJi.z.port1.onmessage (base.js:720:169)

I tried making it a client component instead of server, load it dynamicaly with ssr:false, but this weird error still persists.The official NextJS code is exactly the same with what I use:https://nextjs.org/docs/app/building-your-application/optimizing/videos#using-video-and-iframe


Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>