I am just starting up a site that will host a fair bit of YouTube videos. I would like to future proof it as much as possible. From what I understand the new code will try to use HTML5 and failover to flash if it needs to.

How can I start the video at a specific time using the new embedded code? I can use the old code and it works great. I am stumped with the new embedded code, and I can't seem to make it work. What is more troubling is I can't seem to find anything on Google dealing with the new embedded code. The closest I can find is the link from goole below, however it doesn't say specifically how to use it.

Google API page

link|improve this question
feedback

1 Answer

Easiest way to do this would be in an iframe as in the following:

<iframe src="http://www.youtube.com/embed/JW5meKfy3fY?start=60&autoplay=1" width="100%" height="100%"></iframe>

Or the more advanced way using their YT.Player object:

function onYouTubePlayerAPIReady() {
  var player;
  player = new YT.Player('player', {
    videoId: 'JW5meKfy3fY',
    playerVars: { 'autoplay': 1, 'controls': 0, 'start': 60 },
    events: {
      'onReady': onPlayerReady,
      'onPlaybackQualityChange': onPlayerPlaybackQualityChange,
      'onStateChange': onPlayerStateChange,
      'onError': onPlayerError
    }
  });
}

I haven't tested that out, but it matches their example but I added the start parameter in there. Good luck!

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.