This commit is contained in:
2018-09-13 12:01:42 +02:00
parent a079425b7f
commit f5ae8b6532
4 changed files with 20 additions and 5 deletions
@@ -889,6 +889,8 @@
this.$container.appendTo(this.$container_parent);
// record timeline width
this.timeline_w = parseInt(this.$timeline.width());
// init seeking
this.$loader.on('click', this.seek.bind(this));
// init audio events
var fn = '';
for (var i = 0; i < this.audio_events.length; i++) {
@@ -1016,6 +1018,7 @@
// need to trigger play right now to prevent safari blocking auto-play
this.play();
},
// audio is ready to play
onLoadedmetadata(){
var rem = parseInt(this.audio.duration, 10),
mins = Math.floor(rem/60,10),
@@ -1103,6 +1106,11 @@
this.timeOutToHide();
}
},
seek(e){
var seek = e.originalEvent.layerX / this.timeline_w * this.audio.duration
console.log("Audio seeking : seek", seek);
this.audio.currentTime = seek;
},
// audio events
onPlaying(){
this.$btns.addClass('is-playing');