Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Shaun Kelly
35,560 PointsWhy is the youtube video not playing on my website?
Hi guys,
I have put a youtube video on my website, however it doesn't load or play! It just displays an empty square! Any ideas what I am doing wrong?
Here is the url: www.thepowderhub.pe.hu
Here is the html:
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<h1>The Powder Hub</h1>
<iframe width="420" height="315"
src="https://www.youtube.com/watch? v=Q5691RGDUJ4">
</iframe>
<a href="about.html"><p>See more videos like this</p></a>
</body>
</html>
1 Answer
Marcus Parsons
15,719 PointsYou're using the wrong type of URL (but right video ID) for the src of the iframe. If you take a look at the embed code on Youtube, it doesn't use the "watch" page for embeds. It uses "http://www.youtube.com/embed/VIDEO_ID" so your iframe should look like this:
<iframe width="420" height="315"
src="https://www.youtube.com/embed/Q5691RGDUJ4">
</iframe>