InvalidStateError on IE or Edge (#492)

This commit is contained in:
garniersam
2020-05-23 11:31:07 +08:00
committed by GitHub
parent 337c242536
commit 1efe60189c
+8 -5
View File
@@ -148,6 +148,14 @@ class APlayer {
}
});
// Can seek now
this.on('loadedmetadata', () => {
this.seek(0);
if (!this.paused) {
this.audio.play();
}
});
// show audio loaded bar: to inform interested parties of progress downloading the media
this.on('canplay', () => {
const percentage = this.audio.buffered.length ? this.audio.buffered.end(this.audio.buffered.length - 1) / this.duration : 0;
@@ -241,11 +249,6 @@ class APlayer {
this.audio.src = audio.url;
}
}
this.seek(0);
if (!this.paused) {
this.audio.play();
}
}
theme(color = this.list.audios[this.list.index].theme || this.options.theme, index = this.list.index, isReset = true) {