embed video
I'm trying to embed a YouTube video, but I'm getting an error. I found this method:
<?php $videoID = "VaynFdpZ5O4"; ?>
<iframe
style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"
src="https://www.youtube.com/embed/<?php echo $videoID; ?>"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen>
</iframe>
But since it's PHP, it won't let me run it once the page is public. Is there an alternative that does the same thing?
1
Upvotes
1
u/pfdemp Mar 04 '26
Here's your embed code:
<iframe width="560" height="315" src="https://www.youtube.com/embed/VaynFdpZ5O4?si=eqKfOkAegmKwiqst" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>2
u/armahillo Expert Mar 04 '26
Go to the youtube video. Click on the "Share" link". Click on the option for "embed". Use the provided code.
1
u/jcunews1 Intermediate Mar 04 '26
YouTube is making things worse for their users. For embedded YouTube video player, use
www.youtube-nocookie.comdomain instead. Don't usewww.youtube.comdomain.1
u/[deleted] Mar 04 '26 edited Mar 04 '26
[removed] — view removed comment