Question

I have a slight problem with a webpage : when I try to load a youtube video it shows a white rectangle ( I'm on firefox with win 8.1 x 64 and Yes, I did a flash player update ) Here's the code :

<object type="application/x-shockwave-flash" width="800"   height="600"data="https://www.youtube.com/watch?v=jRXQsQKGqIU"><param name="movie" value="https://www.youtube.com/watch?v=jRXQsQKGqIU" /></object>

Can somebody tell me what's wrong with it ? The other parts of the HTML code are just fine but this youtube code keeps showing me this white rectangle in my webpage instead of the video.

Was it helpful?

Solution

According to Google, the best way to embed is to use iframes:

Best practice: IFrame embeds are the recommended method for embedding a YouTube player because the IFrame will select the appropriate player based on the client's capabilities and available YouTube file formats.

That would look like this:

<iframe width="420" height="315" src="//www.youtube.com/embed/jRXQsQKGqIU" frameborder="0" allowfullscreen></iframe>

However, if you wish to use the Object tag, here's a working example:

<object width="640" height="390">
  <param name="movie"
         value="https://www.youtube.com/v/jRXQsQKGqIU?version=3&autoplay=1"></param>
  <param name="allowScriptAccess" value="always"></param>
  <embed src="https://www.youtube.com/v/M7lc1UVf-VE?version=3&autoplay=1"
         type="application/x-shockwave-flash"
         allowscriptaccess="always"
         width="640" height="390"></embed>
</object>

Working JS Fiddle: http://jsfiddle.net/RAZC4/2/

https://developers.google.com/youtube/player_parameters

OTHER TIPS

Maybe you can use the new code..

<iframe width="800" height="600" src="//www.youtube.com/embed/jRXQsQKGqIU" frameborder="0" allowfullscreen></iframe>

Have you made sure that your browser supports flash?

Otherwise I would suggest using the new embed code

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top