Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
loeasy68
GitHub Repository: loeasy68/loeasy68.github.io
Path: blob/main/website/Youtube/player_control.js
2940 views
1
var player;
2
// Callback for when the YouTube iFrame player is ready
3
function onYouTubeIframeAPIReady() {
4
player = new YT.Player('player', {
5
// Set Player height and width
6
height: '390',
7
width: '640',
8
// Set the id of the video to be played
9
videoId: 'M7lc1UVf-VE',
10
// Setup event listeners
11
// These are covered in the next section
12
events: {
13
'onReady': onPlayerReady
14
}
15
});
16
};
17
18
function onPlayerReady (){
19
player.playVideo();
20
setTimeout(pauseVideo, 4000);
21
setTimeout(loadNewVideo, 6000);
22
setTimeout(stopVideo, 8500);
23
setInterval(getContent, 1000);
24
};
25
26
function pauseVideo(){
27
player.pauseVideo();
28
}
29
30
function loadNewVideo(){
31
player.loadVideoById("me91AGSVsyo");
32
}
33
34
function stopVideo(){
35
player.stopVideo();
36
}
37
38
function getContent(){
39
var content
40
content = player.INSERT_METHOD_HERE;
41
document.getElementById('content').innerText = content
42
}
43