2 Replies - 1327 Views - Last Post: 21 August 2011 - 08:59 AM

#1 eZACKe  Icon User is offline

  • Garbage Collector

Reputation: 120
  • View blog
  • Posts: 1,278
  • Joined: 01-June 09

Embed Youtube videos in site with HTML5

Posted 20 August 2011 - 07:43 PM

I don't understand what needs to be done differently to make this work:

<!DOCTYPE html> 
<html lang="en"> 
 
<head> 
  <meta charset="utf-8" /> 
  <meta name="robots" content="noindex" /> 
  <title>My Weblog</title>  
</head> 
 
<body>
<video width="640"  height="360" src="http://www.youtube.com/v/7_6B6vwE83U"  controls autobuffer> </video>
</body>
</html>



I've tried running this in Chrome, FF, and Safari and it doesn't work in either. Is this how you take a video from Youtube and use it within the video element, or am I missing a step?

In Safari and Chrome the video first shows the controls and then they disappear and you clicking on the Play icon does nothing. In FF it just shows a grey scree with a X in it.

Just started experimenting with HTML5 and can't quite understand this. Thanks for the help!

EDIT: Just worth mentioning that if I go the HTML4 approach it works in all 3 browsers:
<object type="application/x-shockwave-flash" style="width:425px; height:350px;" data="http://www.youtube.com/v/7_6B6vwE83U"><param name="movie" value="http://www.youtube.com/v/7_6B6vwE83U" /></object>


This post has been edited by eZACKe: 20 August 2011 - 07:46 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Embed Youtube videos in site with HTML5

#2 Tarkenfire  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 115
  • View blog
  • Posts: 314
  • Joined: 04-May 11

Re: Embed Youtube videos in site with HTML5

Posted 20 August 2011 - 09:33 PM

Eh, well, as far as I know, you just have to put the video into an iframe and let the users browser/YT preferences decide if it uses flash or html5:

http://www.labnol.or...l5-flash/14092/

Edit: Also of note, the html5 video tag supports mp4, ogg, and webM video formats, you have to make sure the YT vid you're testing with is of those formats. IIRC, YT converts "niche" video formats to something else it likes, so in some cases, there might ONLY be a .flv available, and the video tag won't work, hence iframes are the better solution in general.

This post has been edited by Tarkenfire: 20 August 2011 - 09:37 PM

Was This Post Helpful? 1
  • +
  • -

#3 eZACKe  Icon User is offline

  • Garbage Collector

Reputation: 120
  • View blog
  • Posts: 1,278
  • Joined: 01-June 09

Re: Embed Youtube videos in site with HTML5

Posted 21 August 2011 - 08:59 AM

How well is iframe supported in different browsers? From my own experimenting it seems to work just fine in all major browsers, but what about Mobile?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1