fix: bugs

This commit is contained in:
qier222 2021-01-31 00:52:02 +08:00
parent 6a64e73a2c
commit d6be72f5ce
9 changed files with 27 additions and 29 deletions

View file

@ -157,7 +157,10 @@ export default class {
html5: true,
format: ["mp3", "flac"],
});
if (autoplay) this.play();
if (autoplay) {
this.play();
document.title = `${this._currentTrack.name} · ${this._currentTrack.ar[0].name} - YesPlayMusic`;
}
this._howler.once("end", () => {
this._nextTrackCallback();
});
@ -214,7 +217,6 @@ export default class {
let track = data.songs[0];
this._currentTrack = track;
this._updateMediaSessionMetaData(track);
document.title = `${track.name} · ${track.ar[0].name} - YesPlayMusic`;
return this._getAudioSource(track).then((source) => {
if (source) {
this._playAudioSource(source, autoplay);
@ -319,10 +321,12 @@ export default class {
pause() {
this._howler.pause();
this._playing = false;
document.title = "YesPlayMusic";
}
play() {
this._howler.play();
this._playing = true;
document.title = `${this._currentTrack.name} · ${this._currentTrack.ar[0].name} - YesPlayMusic`;
}
seek(time = null) {
if (time !== null) this._howler.seek(time);