I’m trying to make a YouTube video autoplay with sound as soon as the page loads.Here’s my current code:
<iframe id="yt-video" width="100%" height="100%" src="https://www.youtube.com/embed/DqCXbJ7mr5E?autoplay=1&mute=0&loop=1&playlist=DqCXbJ7mr5E&rel=0&playsinline=1&controls=0&modestbranding=1&enablejsapi=1" frameborder="0" allow="autoplay; encrypted-media; picture-in-picture" allowfullscreen></iframe>I’ve tried setting mute=0, allow="autoplay", and enabling the YouTube JS API, but the video still won’t start with sound unless I interact with the page (like clicking or scrolling).
- Is there any way to make YouTube autoplay with audio right when the page loads?
- Or is this something blocked by browsers now?
- Are there any workarounds (e.g., through JavaScript or YouTube API)?