2

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

0

2 Answers 2

3

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!

1
  • I added the pattern I use all the time.
    – Val
    Jan 13, 2014 at 10:57
1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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