a1164735 by logesh

dev:changes in player time

1 parent 1b673064
1 define(["jquery"],function(e){return{init:function(){var o=e(location).attr("href");e("document").ready(function(){if(o.includes("/mod/page/view.php")){var e=document.querySelector("iframe");console.log(e);var n=new Vimeo.Player(e);console.log(n),n.on("play",function(){console.log("played the video!")}),n.getCurrentTime().then(function(e){console.log(e)}),n.pause().then(function(){console.log("the video was paused")}),console.log("after player")}})}}});
...\ No newline at end of file ...\ No newline at end of file
1 define(["jquery"],function(e){return{init:function(){var n=e(location).attr("href");e("document").ready(function(){var t="You have taken notes at ",o=(t+=" in this video.").fontcolor("green");if(alert(o),n.includes("/mod/page/view.php")){var i=document.querySelector("iframe"),u=new Vimeo.Player(i);u.on("play",function(){alert("played the video!")}),u.getVideoId().then(function(e){}),setTimeout(function(){u.getCurrentTime().then(function(e){console.log("time out function"),console.log(e)})},1500),e("#mynotepencil").click(function(){var n;u.getCurrentTime().then(function(e){n=e}),setTimeout(function(){e("#id_mynotecontent-258").val(n)},1e3)}),u.pause().then(function(){alert("the video was paused")})}})}}});
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -404,7 +404,7 @@ define(['jquery', 'core/yui', 'core/str', 'core/config', 'core/notification'], f ...@@ -404,7 +404,7 @@ define(['jquery', 'core/yui', 'core/str', 'core/config', 'core/notification'], f
404 // Create basic tab structure 404 // Create basic tab structure
405 var el = $('<div></div>').append($('<div id="' + CSS.MYNOTES_BASE + '" class="' + CSS.MYNOTES_BASE + '"></div>') 405 var el = $('<div></div>').append($('<div id="' + CSS.MYNOTES_BASE + '" class="' + CSS.MYNOTES_BASE + '"></div>')
406 .append('<div class="inputarea"><div class="responsetext"></div><div id="addmynote-label-' + CONFIG.instanceid + '">' + s[1] + ' ' + CONFIG.maxallowedcharacters + '<span class="warning"></span></div>' + 406 .append('<div class="inputarea"><div class="responsetext"></div><div id="addmynote-label-' + CONFIG.instanceid + '">' + s[1] + ' ' + CONFIG.maxallowedcharacters + '<span class="warning"></span></div>' +
407 '<div class="textarea"><textarea id="id_mynotecontent-' + CONFIG.instanceid + '" name="mynotecontent" rows="2">' + s[5] + '</textarea></div>' + 407 '<div class="textarea"><textarea id="id_mynotecontent-' + CONFIG.instanceid + '" name="mynotecontent" rows="3">' + s[5] + '</textarea></div>' +
408 '<p class="notesavedhint">' + s[4] + '</p>' + 408 '<p class="notesavedhint">' + s[4] + '</p>' +
409 '<p class="mdl-align"><input type="submit" id="addmynote_submit"/></p>' + 409 '<p class="mdl-align"><input type="submit" id="addmynote_submit"/></p>' +
410 '</div>' 410 '</div>'
......
...@@ -5,31 +5,69 @@ define(['jquery'], function($) { ...@@ -5,31 +5,69 @@ define(['jquery'], function($) {
5 var url= $(location).attr('href'); 5 var url= $(location).attr('href');
6 6
7 $('document').ready(function(){ 7 $('document').ready(function(){
8
9 var str = "You have taken notes at ";
10 str +=" in this video."
11
12 var result = str.fontcolor("green");
13 alert(result);
8 14
9 if(url.includes('/mod/page/view.php')){ 15 if(url.includes('/mod/page/view.php')){
10 16
11 var iframe = document.querySelector('iframe'); 17 var iframe = document.querySelector('iframe');
12 console.log(iframe); 18
13 var player = new Vimeo.Player(iframe); 19 var player = new Vimeo.Player(iframe);
14 console.log(player);
15 20
16 player.on("play", function() { 21 player.on("play", function() {
17 console.log('played the video!'); 22 alert('played the video!');
18 }); 23 });
19 24
20 player.getCurrentTime().then(function(seconds) { 25 player.getVideoId().then(function(id) {
21 // seconds = the current playback position 26 // id = the video id
22 console.log(seconds);
23 }) 27 })
28
29
30 setTimeout(function(){
31
32 player.getCurrentTime().then(function(seconds) {
33 console.log("time out function");
34 console.log(seconds);
35 })
36
37 }, 1500);
38
39
40 $('#mynotepencil').click(function(){
41
42 var time;
43
44 player.getCurrentTime().then(function(seconds) {
45
46 time=seconds;
47 })
48 setTimeout(function(){
49
50 var str = "<div> You have taken notes at ";
51 str +=time;
52 str +=" in this video.</div>"
53
54 $("#id_mynotecontent-258").val(time);
55
56 }, 1000);
57
58 });
59
60
61
24 player.pause().then(function() { 62 player.pause().then(function() {
25 console.log('the video was paused'); 63 alert('the video was paused');
26 }) 64 })
27 65
28 66
29 /*.catch(function(error) { 67 /*.catch(function(error) {
30 // an error occurred 68 // an error occurred
31 });*/ 69 });*/
32 console.log("after player"); 70
33 71
34 } 72 }
35 }); 73 });
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!