Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
91566de67a | ||
|
|
7b8ad10c04 | ||
|
|
47270238cb | ||
|
|
04e950b1eb | ||
|
|
54f9d5dcf9 | ||
|
|
2b6ba28167 | ||
|
|
10ad8cd38d | ||
|
|
adb2cd4ed8 | ||
|
|
f1bc748330 |
@@ -13,7 +13,7 @@ Wow, such a beautiful html5 music player
|
||||
|
||||
UI 参考网易云音乐外链播放器
|
||||
|
||||
[Demo](http://diygod.github.io/APlayer/demo)
|
||||
[Demo](http://aplayer.js.org)
|
||||
|
||||
Screenshot
|
||||

|
||||
|
||||
+18
-18
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "aplayer",
|
||||
"version": "1.4.3",
|
||||
"version": "1.4.5",
|
||||
"description": "Wow, such a beautiful html5 music player",
|
||||
"main": "dist/APlayer.min.js",
|
||||
"scripts": {
|
||||
|
||||
+28
-14
@@ -127,12 +127,12 @@
|
||||
// define APlayer events
|
||||
this.eventTypes = ['play', 'pause', 'canplay', 'playing', 'ended', 'error'];
|
||||
this.event = {};
|
||||
for (let type of this.eventTypes) {
|
||||
this.event[type] = [];
|
||||
for (let i = 0; i < this.eventTypes.length; i++) {
|
||||
this.event[this.eventTypes[i]] = [];
|
||||
}
|
||||
this.trigger = (type) => {
|
||||
for (let func of this.event[type]) {
|
||||
func();
|
||||
for (let i = 0; i < this.event[type].length; i++) {
|
||||
this.event[type][i]();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -230,6 +230,8 @@
|
||||
}
|
||||
this.element.innerHTML = eleHTML;
|
||||
|
||||
this.ptime = this.element.getElementsByClassName('aplayer-ptime')[0];
|
||||
|
||||
if (this.element.getElementsByClassName('aplayer-info')[0].offsetWidth < 200) {
|
||||
this.element.getElementsByClassName('aplayer-time')[0].classList.add('aplayer-time-narrow');
|
||||
}
|
||||
@@ -261,7 +263,12 @@
|
||||
if (musicIndex !== this.playIndex) {
|
||||
this.setMusic(musicIndex);
|
||||
}
|
||||
this.play();
|
||||
if (this.isMobile) {
|
||||
this.pause();
|
||||
}
|
||||
else {
|
||||
this.play();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -478,16 +485,23 @@
|
||||
this.ended = false;
|
||||
if (this.multiple) {
|
||||
this.audio.addEventListener('ended', () => {
|
||||
if (this.playIndex < this.option.music.length - 1) {
|
||||
this.setMusic(++this.playIndex);
|
||||
}
|
||||
else if (this.loop) {
|
||||
this.setMusic(0);
|
||||
}
|
||||
else if (!this.loop) {
|
||||
if (this.isMobile) {
|
||||
this.ended = true;
|
||||
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');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -579,7 +593,7 @@
|
||||
if (this.option.showlrc) {
|
||||
this.updateLrc();
|
||||
}
|
||||
this.element.getElementsByClassName('aplayer-ptime')[0].innerHTML = this.secondToTime(this.audio.currentTime);
|
||||
this.ptime.innerHTML = this.secondToTime(this.audio.currentTime);
|
||||
this.trigger('playing');
|
||||
}, 100);
|
||||
this.trigger('play');
|
||||
|
||||
Reference in New Issue
Block a user