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