-
Notifications
You must be signed in to change notification settings - Fork 3k
/
player_control.js
42 lines (37 loc) · 901 Bytes
/
player_control.js
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
var player;
// Callback for when the YouTube iFrame player is ready
function onYouTubeIframeAPIReady() {
player = new YT.Player('player', {
// Set Player height and width
height: '390',
width: '640',
// Set the id of the video to be played
videoId: 'M7lc1UVf-VE',
// Setup event listeners
// These are covered in the next section
events: {
'onReady': onPlayerReady
}
});
};
function onPlayerReady (){
player.playVideo();
setTimeout(pauseVideo, 4000);
setTimeout(loadNewVideo, 6000);
setTimeout(stopVideo, 8500);
setInterval(getContent, 1000);
};
function pauseVideo(){
player.pauseVideo();
}
function loadNewVideo(){
player.loadVideoById("me91AGSVsyo");
}
function stopVideo(){
player.stopVideo();
}
function getContent(){
var content
content = player.INSERT_METHOD_HERE;
document.getElementById('content').innerText = content
}