script.js
1.81 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
define(['jquery'], function($) {
return {
init: function() {
var url= $(location).attr('href');
$('document').ready(function(){
if(url.includes('/mod/page/view.php')){
var iframe = document.querySelector('iframe');
var player = new Vimeo.Player(iframe);
player.on("play", function() {
console.log('played the video!');
setTimeout(function(){
player.getCurrentTime().then(function(seconds) {
console.log("time video played");
console.log(seconds);
})
}, 1500);
});
player.getVideoId().then(function(id) {
// id = the video id
console.log("video id");
console.log(id);
console.log("*******")
})
setTimeout(function(){
player.getCurrentTime().then(function(seconds) {
console.log("time out function");
console.log(seconds);
})
}, 1500);
$('#mynotepencil').click(function(){
var time;
player.getCurrentTime().then(function(seconds) {
time=seconds;
})
setTimeout(function(){
console.log(time);
var str = "<div> You have taken notes at ";
str +=time;
str +=" in this video.</div>"
var result = str.fontcolor("green");
$("#id_mynotecontent-258").val(result);
}, 1000);
});
player.pause().then(function() {
alert('the video was paused');
})
/*.catch(function(error) {
// an error occurred
});*/
}
});
}
};
});