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

Sean Flanagan
Sean Flanagan
33,235 Points

Video won't play in browser

Hi guys and girls.

I've copied the code from the YouTube link into my HTML code but the video won't play in my browser. I tick the option to embed old code.

Here it is:

<!doctype html>

<html lang="en">
<head>
    <meta charset="utf-8">
    <title>My Page</title>
</head>

<body>

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

</body>
</html>

As always, thanks for any help you can offer.

3 Answers

Adam Moore
Adam Moore
21,956 Points

Might you need to add the "http:" before the YouTube link? Otherwise, I'm pretty sure it looks for the video as a local file.

Sean Flanagan
Sean Flanagan
33,235 Points

Something like this?

<!doctype html>

<html lang="en">
<head>
    <meta charset="utf-8">
    <title>My Page</title>
</head>

<body>

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

</body>
</html>

Apparently it's restricted from certain sites and it wouldn't work in any of the browsers, but the fact that it showed up at all must mean that the code you gave me is right. Thanks Adam.

Adam Moore
Adam Moore
21,956 Points

Well, you're welcome, and sorry about that :/

Sean Flanagan
Sean Flanagan
33,235 Points

Don't worry about it. It's not your fault the movie is restricted. You weren't to know. The important thing is you helped me and I appreciate it.

Adam Moore
Adam Moore
21,956 Points

Yeah, I'm just sorry that it isn't working for you; that's all. :)