change in vimeo player events
Showing
2 changed files
with
18 additions
and
10 deletions
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 |
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 n=document.querySelector("iframe"),t=new Vimeo.Player(n);t.on("play",function(){console.log("played the video!"),setTimeout(function(){t.getCurrentTime().then(function(e){console.log("time video played"),console.log(e)})},1500)}),t.getVideoId().then(function(e){console.log("video id"),console.log(e),console.log("*******")}),setTimeout(function(){t.getCurrentTime().then(function(e){console.log("time out function"),console.log(e)})},1500),e("#mynotepencil").click(function(){var o;t.getCurrentTime().then(function(e){o=e}),setTimeout(function(){console.log(o);var n="<div> You have taken notes at ";n+=o;var t=(n+=" in this video.</div>").fontcolor("green");e("#id_mynotecontent-258").val(t)},1e3)}),t.pause().then(function(){alert("the video was paused")})}})}}}); | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -6,12 +6,6 @@ define(['jquery'], function($) { | ... | @@ -6,12 +6,6 @@ define(['jquery'], function($) { |
6 | 6 | ||
7 | $('document').ready(function(){ | 7 | $('document').ready(function(){ |
8 | 8 | ||
9 | var str = "You have taken notes at "; | ||
10 | str +=" in this video." | ||
11 | |||
12 | var result = str.fontcolor("green"); | ||
13 | alert(result); | ||
14 | |||
15 | if(url.includes('/mod/page/view.php')){ | 9 | if(url.includes('/mod/page/view.php')){ |
16 | 10 | ||
17 | var iframe = document.querySelector('iframe'); | 11 | var iframe = document.querySelector('iframe'); |
... | @@ -19,11 +13,22 @@ define(['jquery'], function($) { | ... | @@ -19,11 +13,22 @@ define(['jquery'], function($) { |
19 | var player = new Vimeo.Player(iframe); | 13 | var player = new Vimeo.Player(iframe); |
20 | 14 | ||
21 | player.on("play", function() { | 15 | player.on("play", function() { |
22 | alert('played the video!'); | 16 | console.log('played the video!'); |
17 | setTimeout(function(){ | ||
18 | |||
19 | player.getCurrentTime().then(function(seconds) { | ||
20 | console.log("time video played"); | ||
21 | console.log(seconds); | ||
22 | }) | ||
23 | |||
24 | }, 1500); | ||
23 | }); | 25 | }); |
24 | 26 | ||
25 | player.getVideoId().then(function(id) { | 27 | player.getVideoId().then(function(id) { |
26 | // id = the video id | 28 | // id = the video id |
29 | console.log("video id"); | ||
30 | console.log(id); | ||
31 | console.log("*******") | ||
27 | }) | 32 | }) |
28 | 33 | ||
29 | 34 | ||
... | @@ -47,11 +52,14 @@ define(['jquery'], function($) { | ... | @@ -47,11 +52,14 @@ define(['jquery'], function($) { |
47 | }) | 52 | }) |
48 | setTimeout(function(){ | 53 | setTimeout(function(){ |
49 | 54 | ||
55 | console.log(time); | ||
56 | |||
57 | |||
50 | var str = "<div> You have taken notes at "; | 58 | var str = "<div> You have taken notes at "; |
51 | str +=time; | 59 | str +=time; |
52 | str +=" in this video.</div>" | 60 | str +=" in this video.</div>" |
53 | 61 | var result = str.fontcolor("green"); | |
54 | $("#id_mynotecontent-258").val(time); | 62 | $("#id_mynotecontent-258").val(result); |
55 | 63 | ||
56 | }, 1000); | 64 | }, 1000); |
57 | 65 | ... | ... |
-
Please register or sign in to post a comment