2 Commits
Author SHA1 Message Date
DIYgod 91566de67a new npm version 2016-05-14 22:38:42 +08:00
DIYgod 7b8ad10c04 Fix bug: multiple ended event in iOS; clicking list error in mobile 2016-05-14 22:37:48 +08:00
4 changed files with 24 additions and 12 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "aplayer", "name": "aplayer",
"version": "1.4.4", "version": "1.4.5",
"description": "Wow, such a beautiful html5 music player", "description": "Wow, such a beautiful html5 music player",
"main": "dist/APlayer.min.js", "main": "dist/APlayer.min.js",
"scripts": { "scripts": {
+21 -9
View File
@@ -263,7 +263,12 @@
if (musicIndex !== this.playIndex) { if (musicIndex !== this.playIndex) {
this.setMusic(musicIndex); this.setMusic(musicIndex);
} }
this.play(); if (this.isMobile) {
this.pause();
}
else {
this.play();
}
}); });
} }
} }
@@ -480,16 +485,23 @@
this.ended = false; this.ended = false;
if (this.multiple) { if (this.multiple) {
this.audio.addEventListener('ended', () => { this.audio.addEventListener('ended', () => {
if (this.playIndex < this.option.music.length - 1) { if (this.isMobile) {
this.setMusic(++this.playIndex);
}
else if (this.loop) {
this.setMusic(0);
}
else if (!this.loop) {
this.ended = true; this.ended = true;
this.pause(); this.pause();
this.trigger('ended'); return;
}
if (this.audio.currentTime !== 0) {
if (this.playIndex < this.option.music.length - 1) {
this.setMusic(++this.playIndex);
}
else if (this.loop) {
this.setMusic(0);
}
else if (!this.loop) {
this.ended = true;
this.pause();
this.trigger('ended');
}
} }
}); });
} }