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

HTML HTML Objects Embedded Elements

Emma Stuart
Emma Stuart
3,693 Points

Issues embedding video

Hi guys,

I tried to embed a YouTube video into my HTML document as it's done in the video, but the only thing displaying is an empty frame where the video would sit. I've tried previewing the page in both Firefox and Chrome. I also added some other content (h1 tags) either side of the video and these are displaying fine.

Does anyone have any idea why this didn't work?

2 Answers

Are you testing it locally? If yes you should add http:// to value attribute in param element and src attribute in embed element. Please check the below code snippet.

Video URL should look like this http://www.youtube.com/v/zuhzWKbRq6s?version=3&hl=en_US&rel=0

By default they are without http:// protocol.

Something this.

<object width="560" height="315">
    <param name="movie" value="http://www.youtube.com/v/zuhzWKbRq6s?version=3&amp;hl=en_US&amp;rel=0"></param>
    <param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param>
    <embed src="http://www.youtube.com/v/zuhzWKbRq6s?version=3&amp;hl=en_US&amp;rel=0" type="application/x-shockwave-flash" width="560" height="315" allowscriptaccess="always" allowfullscreen="true">
</embed>

</object>
Emma Stuart
Emma Stuart
3,693 Points

Yes, that worked perfectly! Thank you very much, Karthikeyan - really appreciate that.

Welcome. Have fun!