a1164735 by logesh

dev:changes in player time

1 parent 1b673064
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
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
......
......@@ -404,7 +404,7 @@ define(['jquery', 'core/yui', 'core/str', 'core/config', 'core/notification'], f
// Create basic tab structure
var el = $('<div></div>').append($('<div id="' + CSS.MYNOTES_BASE + '" class="' + CSS.MYNOTES_BASE + '"></div>')
.append('<div class="inputarea"><div class="responsetext"></div><div id="addmynote-label-' + CONFIG.instanceid + '">' + s[1] + ' ' + CONFIG.maxallowedcharacters + '<span class="warning"></span></div>' +
'<div class="textarea"><textarea id="id_mynotecontent-' + CONFIG.instanceid + '" name="mynotecontent" rows="2">' + s[5] + '</textarea></div>' +
'<div class="textarea"><textarea id="id_mynotecontent-' + CONFIG.instanceid + '" name="mynotecontent" rows="3">' + s[5] + '</textarea></div>' +
'<p class="notesavedhint">' + s[4] + '</p>' +
'<p class="mdl-align"><input type="submit" id="addmynote_submit"/></p>' +
'</div>'
......
......@@ -5,31 +5,69 @@ define(['jquery'], function($) {
var url= $(location).attr('href');
$('document').ready(function(){
var str = "You have taken notes at ";
str +=" in this video."
var result = str.fontcolor("green");
alert(result);
if(url.includes('/mod/page/view.php')){
var iframe = document.querySelector('iframe');
console.log(iframe);
var player = new Vimeo.Player(iframe);
console.log(player);
player.on("play", function() {
console.log('played the video!');
alert('played the video!');
});
player.getCurrentTime().then(function(seconds) {
// seconds = the current playback position
console.log(seconds);
player.getVideoId().then(function(id) {
// id = the video id
})
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(){
var str = "<div> You have taken notes at ";
str +=time;
str +=" in this video.</div>"
$("#id_mynotecontent-258").val(time);
}, 1000);
});
player.pause().then(function() {
console.log('the video was paused');
alert('the video was paused');
})
/*.catch(function(error) {
// an error occurred
});*/
console.log("after player");
}
});
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!