File size: 715 Bytes
6996634
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
var tag = document.createElement('script');
tag.src = 'https://www.youtube.com/iframe_api';
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

function onYouTubeIframeAPIReady() {
    var iframe = document.getElementById('player');
    player = new YT.Player(iframe, {
        events: {
          'onReady': onPlayerReady
        }
      });
}
function onPlayerReady(event) {
    event.target.playVideo();
}
var iframe = document.getElementById('player');
player = new YT.Player(iframe, {
        events: {
          'onReady': onPlayerReady
        }
      });
function seek(sec){
    if(player){
        player.seekTo(sec, true);
    }
}