Gitlab CSE Unil

Commit a93d6d3e authored by M. Chardon's avatar M. Chardon
Browse files

add amr format for android

parent 67e2aee5
define(["jquery"],function(a){function b(a,c){return this.controler=a,this.assignpart=c,b.clickAnnotation=0,this}b.controler=null,b.assignpart=-1,b.clickAnnotation=0,b.delayBeforeAnnotation=2,b.options=null,b.prototype.drawAnnotation=function(b,c,d){if(b&&b.duration){var e=c.timeposition/b.duration*100,f=a(b).next(),g=c.displayDiv(e,d);f.find(".audio_annotations").append(g)}},b.prototype.goBeforeAnnotation=function(a,d){a&&(a.currentTime=Math.max(d.timeposition-b.delayBeforeAnnotation,0),c(a),b.clickAnnotation=1)},b.prototype.getWaveOpts=function(c){var d={ajax:"justWave/justwave.ajax.php",width:900,height:100,wave_color:"#909296",prog_color:"#74cdd7",back_color:"#FFFFFF",buttoncolor:"#A47655",buttonsize:0,showname:1,namesize:15,showtimes:1,nowaves:0,nocache:!0};a.isPlainObject(b.options)&&a.extend(d,b.options),c.attr("width")&&(d.width=c.attr("width")),c.attr("height")&&(d.height=c.attr("height")),c.attr("poster")&&(d.poster=c.attr("poster"));var e=c.data();return Object.keys(e).map(function(a){d[a]=e[a]}),d},b.prototype.init=function(h,i){var j='<div class="justwave_wrapper">';j+='<img class="justwave_wave" src="" alt="" ondragstart="return false"/>',j+='<div class="justwave_playhead">',j+='<img class="justwave_progress" src="" alt="" ondragstart="return false"/>',j+='<span class="justwave_curpos">00:00</span>',j+="</div>",j+='<span class="justwave_duration">00:00</span>',j+='<span class="justwave_curfocus">00:00</span>',j+='<span class="justwave_songname"></span>',j+='<button type="button" style="left:2px;" ',j+='class="btn justwave_playpause_btn justwave_playpause_before btn-primary btn-lg">',j+='<i class="fa fa-reply fa-lg"></i>',j+="</button>",j+='<button type="button" style="left:65px;" ',j+='class="btn justwave_playpause_btn justwave_playpause btn-primary btn-lg">',j+='<i class="fa fa-play fa-lg"></i>',j+="</button>",j+='<div class="audio_annotations"></div>',j+="</div>";var k=a("audio");null!==this.assignpart&&(k=a(".justwave"+this.assignpart.assignpartid).find("audio")),"string"==typeof h&&(i=h),"string"==typeof i&&(k=k.filter("."+i));var l=this.controler,m=this.assignpart,n=this.getWaveOpts;k.each(function(){var h=this,i=a(this);h.opts=n(i),h.opts.chained&&i.addClass("justwave_chained"),i.after(j),a(h).on("canplay",function(b){var c=b.target,d=a(c).next();c.xduration=c.duration,c.opts.showtimes&&c.opts.showtimes>0?d.find(".justwave_duration, .justwave_curpos").show():d.find(".justwave_duration, .justwave_curpos").hide()}).on("playing",function(b){var c=b.target,d=a(c).next();d.find(".justwave_playpause i.fa").addClass("fa-pause"),d.find(".justwave_playpause i.fa").removeClass("fa-play"),c.opts.chained&&a("audio.justwave_chained").each(function(){this!==c&&this.pause()}),l.notify("playing","player",c)}).on("pause",function(b){var c=a(b.target).next();c.find(".justwave_playpause i.fa").addClass("fa-play"),c.find(".justwave_playpause i.fa").removeClass("fa-pause")}).on("error",function(b){var c=b.target,d=a(c).next();f(c),d.find(".justwave_playpause").prop("disabled",!0),d.find(".justwave_playpause_before").prop("disabled",!0),d.find(".justwave_songname").text(a(c).attr("src").replace(/.+[\\\/]/,"")),d.find(".justwave_duration").text("00:00"),c.xduration=0,d.find(".justwave_duration, .justwave_curpos, .justwave_curfocus").hide(),l.notify("error","player",c)}).on("timeupdate",function(){c(this)}).on("ended",function(){this.pause()}),f(h),g(h);var k=i.next();k.click(function(d){if(!b.clickAnnotation||0===b.clickAnnotation){d.preventDefault();var e=a(this).prev()[0],f=a(this).offset(),g=d.pageX-f.left;e.currentTime=g*e.xduration/this.offsetWidth,c(e),m.notify("click",e.currentTime)}b.clickAnnotation=0}).mousemove(function(b){var c=a(this).offset(),f=b.pageX-c.left,g=b.pageY-c.top,h=this,i=a(this).prev()[0];a(h).find(".justwave_curfocus").text(d(f/this.offsetWidth*i.xduration)).css({top:g-5+"px",left:f+5+"px"}),i.opts.showname&&i.opts.showname>0&&e(a(h).find(".justwave_songname"))}).mouseleave(function(){a(this).find(".justwave_curfocus").hide(),a(this).find(".justwave_playpause").fadeOut(1e3),a(this).find(".justwave_playpause_before").fadeOut(1e3)}).mouseenter(function(){var b=a(this).prev()[0];a(this).find(".justwave_playpause").stop(!1,!0).fadeIn(500),a(this).find(".justwave_playpause_before").stop(!1,!0).fadeIn(500),b.opts.showtimes&&b.opts.showtimes>0&&a(this).find(".justwave_curfocus").show(),l.notify("mouseenter","player",b)}).dblclick(function(){b.clickAnnotation&&0!==b.clickAnnotation||m.notify("dblclick"),b.clickAnnotation=0}),k.find(".justwave_playpause").on("click touchstart",function(b){b.stopPropagation(),b.preventDefault();var c=a(this).parent(),d=c.prev()[0];d.ended&&(d.currentTime=0),d.paused?d.play():d.pause(),l.notify("pause","player",d)}),k.find(".justwave_playpause_before").on("click touchstart",function(d){d.stopPropagation(),d.preventDefault();var e=a(this).parent(),f=e.prev()[0];f.ended&&(f.currentTime=0),f.currentTime=Math.max(f.currentTime-b.delayBeforeAnnotation,0),c(f)}).on("dblclick",function(a){a.stopPropagation(),a.preventDefault()}),k.find(".justwave_playpause_btn").mouseenter(function(){a(this).siblings(".justwave_curfocus").hide()}).mouseleave(function(){var b=a(this).parent().prev()[0];b.opts.showtimes&&b.opts.showtimes>0&&a(this).siblings(".justwave_curfocus").show()}),l.notify("initeach","player",h)})};var c=function(b){var c=b.currentTime/b.xduration*100,e=a(b).next();c<=100.1&&e.find(".justwave_playhead").width(c+"%"),e.find(".justwave_curpos").text(d(b.currentTime))},d=function(a){var b=Math.floor(a/60),c=Math.floor(a%60);return isNaN(a)?"00:00":(b<10?"0":"")+b+":"+(c<10?"0":"")+c},e=function(a,b){b&&a.stop(!0,!0).hide(),a.is(":visible")||a.fadeIn(300,function(){a.fadeOut(7e3,"swing")})},f=function(b){var c=a(b).next();c.find(".justwave_wave").width(0).attr("src",""),c.find(".justwave_progress").width(0).attr("src",""),c.width(b.opts.width).height(b.opts.height).css("background",b.opts.wave_color),b.opts.poster&&c.css("background-image","url("+b.opts.poster+")"),c.find(".justwave_playhead").css("background",b.opts.prog_color)},g=function(b){var c=a(b).next();c.find(".justwave_playpause i.fa").addClass("fa-play"),c.find(".justwave_playpause i.fa").removeClass("fa-pause")};return b.prototype.drawWaveDisplay=function(b){var c=this.assignpart;b.opts=this.getWaveOpts(b);var h=new Audio;a(h).on("loadedmetadata",function(){var h=a(b).next();f(b),g(b),a(b).attr("src")?b.opts.audio=a(b).attr("src"):b.opts.audio=b.currentSrc;var i=h.find(".justwave_songname").css("font-size",b.opts.namesize+"px").text(decodeURIComponent(b.opts.audio.replace(/.+[\\\/]/,"")));b.opts.showname&&b.opts.showname>0&&e(i,!0),+b.opts.nowaves||a.ajax(b.opts.ajax,{dataType:"json",type:"POST",data:b.opts}).done(function(e){var f=a(b).next(),g=f.find(".justwave_wave"),h=f.find(".justwave_progress");"ok"===e.status&&(g.width(b.opts.width),h.width(b.opts.width),f.css("background",""),f.find(".justwave_playhead").css("background",""),b.opts.poster&&f.css("background-image","url("+b.opts.poster+")"),g.attr("src",e.waveurl),b.opts.wave_color===b.opts.prog_color?h.attr("src",e.waveurl):h.attr("src",e.progressurl)),b.xduration=parseFloat(e.duration),b.xduration||(b.xduration=b.duration),b.xduration&&!b.duration&&(b.duration=e.duration),f.find(".justwave_duration").text(d(b.xduration));var i=a(f).prev()[0];i.xduration=b.xduration,i.duration=b.duration,c&&c.notify("loadedmetadata",b)})}),h.src=a(b).attr("src")},b});
\ No newline at end of file
define(["jquery"],function(a){function b(a,c){return this.controler=a,this.assignpart=c,b.clickAnnotation=0,this}b.controler=null,b.assignpart=-1,b.clickAnnotation=0,b.delayBeforeAnnotation=2,b.options=null,b.prototype.drawAnnotation=function(b,c,d){if(b&&b.duration){var e=c.timeposition/b.duration*100,f=a(b).next(),g=c.displayDiv(e,d);f.find(".audio_annotations").append(g)}},b.prototype.goBeforeAnnotation=function(a,d){a&&(a.currentTime=Math.max(d.timeposition-b.delayBeforeAnnotation,0),c(a),b.clickAnnotation=1)},b.prototype.getWaveOpts=function(c){var d={ajax:"justWave/justwave.ajax.php",width:900,height:100,wave_color:"#909296",prog_color:"#74cdd7",back_color:"#FFFFFF",buttoncolor:"#A47655",buttonsize:0,showname:1,namesize:15,showtimes:1,nowaves:0,nocache:!0};a.isPlainObject(b.options)&&a.extend(d,b.options),c.attr("width")&&(d.width=c.attr("width")),c.attr("height")&&(d.height=c.attr("height")),c.attr("poster")&&(d.poster=c.attr("poster"));var e=c.data();return Object.keys(e).map(function(a){d[a]=e[a]}),d},b.prototype.init=function(h,i){var j='<div class="justwave_wrapper">';j+='<img class="justwave_wave" src="" alt="" ondragstart="return false"/>',j+='<div class="justwave_playhead">',j+='<img class="justwave_progress" src="" alt="" ondragstart="return false"/>',j+='<span class="justwave_curpos">00:00</span>',j+="</div>",j+='<span class="justwave_duration">00:00</span>',j+='<span class="justwave_curfocus">00:00</span>',j+='<span class="justwave_songname"></span>',j+='<button type="button" style="left:2px;" ',j+='class="btn justwave_playpause_btn justwave_playpause_before btn-primary btn-lg">',j+='<i class="fa fa-reply fa-lg"></i>',j+="</button>",j+='<button type="button" style="left:65px;" ',j+='class="btn justwave_playpause_btn justwave_playpause btn-primary btn-lg">',j+='<i class="fa fa-play fa-lg"></i>',j+="</button>",j+='<div class="audio_annotations"></div>',j+="</div>";var k=a("audio");null!==this.assignpart&&(k=a(".justwave"+this.assignpart.assignpartid).find("audio")),"string"==typeof h&&(i=h),"string"==typeof i&&(k=k.filter("."+i));var l=this.controler,m=this.assignpart,n=this.getWaveOpts;k.each(function(){var h=this,i=a(this);h.opts=n(i),h.opts.chained&&i.addClass("justwave_chained"),i.after(j),a(h).on("canplay",function(b){var c=b.target,d=a(c).next();c.xduration=c.duration,c.opts.showtimes&&c.opts.showtimes>0?d.find(".justwave_duration, .justwave_curpos").show():d.find(".justwave_duration, .justwave_curpos").hide()}).on("playing",function(b){var c=b.target,d=a(c).next();d.find(".justwave_playpause i.fa").addClass("fa-pause"),d.find(".justwave_playpause i.fa").removeClass("fa-play"),c.opts.chained&&a("audio.justwave_chained").each(function(){this!==c&&this.pause()}),l.notify("playing","player",c)}).on("pause",function(b){var c=a(b.target).next();c.find(".justwave_playpause i.fa").addClass("fa-play"),c.find(".justwave_playpause i.fa").removeClass("fa-pause")}).on("error",function(b){var c=b.target,d=a(c).next();f(c),d.find(".justwave_playpause").prop("disabled",!0),d.find(".justwave_playpause_before").prop("disabled",!0),d.find(".justwave_songname").text(a(c).attr("src").replace(/.+[\\\/]/,"")),d.find(".justwave_duration").text("00:00"),c.xduration=0,d.find(".justwave_duration, .justwave_curpos, .justwave_curfocus").hide(),l.notify("error","player",c)}).on("timeupdate",function(){c(this)}).on("ended",function(){this.pause()}),f(h),g(h);var k=i.next();k.click(function(d){if(!b.clickAnnotation||0===b.clickAnnotation){d.preventDefault();var e=a(this).prev()[0],f=a(this).offset(),g=d.pageX-f.left;e.currentTime=g*e.xduration/this.offsetWidth,c(e),m.notify("click",e.currentTime)}b.clickAnnotation=0}).mousemove(function(b){var c=a(this).offset(),f=b.pageX-c.left,g=b.pageY-c.top,h=this,i=a(this).prev()[0];a(h).find(".justwave_curfocus").text(d(f/this.offsetWidth*i.xduration)).css({top:g-5+"px",left:f+5+"px"}),i.opts.showname&&i.opts.showname>0&&e(a(h).find(".justwave_songname"))}).mouseleave(function(){a(this).find(".justwave_curfocus").hide(),a(this).find(".justwave_playpause").fadeOut(1e3),a(this).find(".justwave_playpause_before").fadeOut(1e3)}).mouseenter(function(){var b=a(this).prev()[0];a(this).find(".justwave_playpause").stop(!1,!0).fadeIn(500),a(this).find(".justwave_playpause_before").stop(!1,!0).fadeIn(500),b.opts.showtimes&&b.opts.showtimes>0&&a(this).find(".justwave_curfocus").show(),l.notify("mouseenter","player",b)}).dblclick(function(){b.clickAnnotation&&0!==b.clickAnnotation||m.notify("dblclick"),b.clickAnnotation=0}),k.find(".justwave_playpause").on("click touchstart",function(b){b.stopPropagation(),b.preventDefault();var c=a(this).parent(),d=c.prev()[0];d.ended&&(d.currentTime=0),d.paused?d.play():d.pause(),l.notify("pause","player",d)}),k.find(".justwave_playpause_before").on("click touchstart",function(d){d.stopPropagation(),d.preventDefault();var e=a(this).parent(),f=e.prev()[0];f.ended&&(f.currentTime=0),f.currentTime=Math.max(f.currentTime-b.delayBeforeAnnotation,0),c(f)}).on("dblclick",function(a){a.stopPropagation(),a.preventDefault()}),k.find(".justwave_playpause_btn").mouseenter(function(){a(this).siblings(".justwave_curfocus").hide()}).mouseleave(function(){var b=a(this).parent().prev()[0];b.opts.showtimes&&b.opts.showtimes>0&&a(this).siblings(".justwave_curfocus").show()}),k.parents("div.card").keypress(function(b){98===b.which&&a("button.justwave_playpause_before").click()}),l.notify("initeach","player",h)})};var c=function(b){var c=b.currentTime/b.xduration*100,e=a(b).next();c<=100.1&&e.find(".justwave_playhead").width(c+"%"),e.find(".justwave_curpos").text(d(b.currentTime))},d=function(a){var b=Math.floor(a/60),c=Math.floor(a%60);return isNaN(a)?"00:00":(b<10?"0":"")+b+":"+(c<10?"0":"")+c},e=function(a,b){b&&a.stop(!0,!0).hide(),a.is(":visible")||a.fadeIn(300,function(){a.fadeOut(7e3,"swing")})},f=function(b){var c=a(b).next();c.find(".justwave_wave").width(0).attr("src",""),c.find(".justwave_progress").width(0).attr("src",""),c.width(b.opts.width).height(b.opts.height).css("background",b.opts.wave_color),b.opts.poster&&c.css("background-image","url("+b.opts.poster+")"),c.find(".justwave_playhead").css("background",b.opts.prog_color)},g=function(b){var c=a(b).next();c.find(".justwave_playpause i.fa").addClass("fa-play"),c.find(".justwave_playpause i.fa").removeClass("fa-pause")};return b.prototype.drawWaveDisplay=function(b){var c=this.assignpart;b.opts=this.getWaveOpts(b);var h=new Audio;a(h).on("loadedmetadata",function(){var h=a(b).next();f(b),g(b),a(b).attr("src")?b.opts.audio=a(b).attr("src"):b.opts.audio=b.currentSrc;var i=h.find(".justwave_songname").css("font-size",b.opts.namesize+"px").text(decodeURIComponent(b.opts.audio.replace(/.+[\\\/]/,"")));b.opts.showname&&b.opts.showname>0&&e(i,!0),+b.opts.nowaves||a.ajax(b.opts.ajax,{dataType:"json",type:"POST",data:b.opts}).done(function(e){var f=a(b).next(),g=f.find(".justwave_wave"),h=f.find(".justwave_progress");"ok"===e.status&&(g.width(b.opts.width),h.width(b.opts.width),f.css("background",""),f.find(".justwave_playhead").css("background",""),b.opts.poster&&f.css("background-image","url("+b.opts.poster+")"),g.attr("src",e.waveurl),b.opts.wave_color===b.opts.prog_color?h.attr("src",e.waveurl):h.attr("src",e.progressurl)),b.xduration=parseFloat(e.duration),b.xduration||(b.xduration=b.duration),b.xduration&&!b.duration&&(b.duration=e.duration),f.find(".justwave_duration").text(d(b.xduration));var i=a(f).prev()[0];i.xduration=b.xduration,i.duration=b.duration,c&&c.notify("loadedmetadata",b)})}),h.src=a(b).attr("src")},b});
\ No newline at end of file
......@@ -138,7 +138,7 @@ class assignaudio_form extends moodleform {
if ($audioannotation->dragdrop) {
$name = get_string('formassign_recordfile', AUDIOANNOT_MODNAME);
$mform->addElement('filepicker', 'file' . $i, $name, null, array('maxbytes' => $audioannotation->filelimit * 1000, 'accepted_types' => array('.aiff', '.m4a', '.mp3', '.ogg', '.wav', '.wma')));
$mform->addElement('filepicker', 'file' . $i, $name, null, array('maxbytes' => $audioannotation->filelimit * 1000, 'accepted_types' => array('.aiff', '.amr', '.m4a', '.mp3', '.ogg', '.wav', '.wma')));
$mform->setType('file' . $i, PARAM_FILE);
//$mform->disabledIf('file', assignaudio_form::FIELDRECORDFIELD, 'ne', '-1');
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment