Here's the updated jsfiddle using the new iframe api that works
FYI: if you only use inline HTML iframe code, you can put ?start=30 for start time
<iframe width="640" height="390" src="//www.youtube.com/embed/p2H5YVfZVFw?start=30" frameborder="0" allowfullscreen></iframe>
For the API, you can run the video at a specific time like this. Use the start parameter
function onYouTubePlayerAPIReady() { player = new YT.Player('player', { height: '390', width: '640', videoId: 'p2H5YVfZVFw', playerVars: { 'start': 159, 'autoplay': 1, 'controls': 1 }, events: { 'onReady': onPlayerReady, 'onStateChange': onPlayerStateChange, } });
You can only call seekTo after the player has started playing or does nothing. Check the playerStateChange :
onStateChange': onPlayerStateChange
Add this callback function
function onPlayerStateChange(evt) { if (evt.data==1) { // this will seek to a certain point when video starts // but you're better off using 'start' parameter // player.seekTo(22); } }
jsFiddle has buttons below to search for 30, 60, 90 seconds. It has been tested with all browsers that rhyme with "rome". When it opens, a warning window appears for the player.seekTo function type. If it shows "undefined", you have a problem.
Simon_Weaver
source share