mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 05:38:04 +00:00
refactor: Adjusting music initialization logic
1. Initial music loads twice on app start, a second load is triggered as soon as the page is clicked. So I close autounlock 2. Unplayable music can’t be play
This commit is contained in:
parent
ddebec9de9
commit
200c49e8c9
5 changed files with 33 additions and 42 deletions
|
|
@ -144,7 +144,7 @@ export default {
|
|||
mounted() {
|
||||
setInterval(() => {
|
||||
// fix 歌曲播放完还设置进度的问题,及 _id 不存在的问题
|
||||
if (this.howler && this.howler._sounds[0]._id) {
|
||||
if (this.howler && this.howler._sounds?.[0]?._id) {
|
||||
this.progress = ~~this.howler.seek();
|
||||
}
|
||||
}, 1000);
|
||||
|
|
@ -169,13 +169,17 @@ export default {
|
|||
},
|
||||
},
|
||||
playing() {
|
||||
if (this.howler.state() === "loading") {
|
||||
this.updatePlayerState({ key: "playing", value: true });
|
||||
return true;
|
||||
if (this.howler) {
|
||||
if (this.howler.state() === "loading") {
|
||||
this.updatePlayerState({ key: "playing", value: true });
|
||||
return true;
|
||||
}
|
||||
const status = this.howler.playing();
|
||||
this.updatePlayerState({ key: "playing", value: status });
|
||||
return status;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
const status = this.howler.playing();
|
||||
this.updatePlayerState({ key: "playing", value: status });
|
||||
return status;
|
||||
},
|
||||
progressMax() {
|
||||
let max = ~~(this.currentTrack.dt / 1000);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue