InvalidStateError on IE or Edge (#492)

This commit is contained in:
garniersam 2020-05-23 05:31:07 +02:00 committed by GitHub
parent 337c242536
commit 1efe60189c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 5 deletions

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) {