Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers 2

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, if you do not want the autoplay

<iframe src="http://www.youtube.com/embed/rPS1y81b1Bw?start=1995" width="683" height="384"></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!

share|improve this answer
    
I added the pattern I use all the time. –  Val Jan 13 at 10:57
add comment

Since it seems that Youtube has dropped the start time for embedded videos, I use http://www.tubechop.com. You can use it also.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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