mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 13:48:02 +00:00
parent
a00d27d0c9
commit
0d610c45a7
1 changed files with 5 additions and 10 deletions
|
|
@ -147,19 +147,12 @@ export default class {
|
||||||
// 恢复当前播放歌曲
|
// 恢复当前播放歌曲
|
||||||
this._replaceCurrentTrack(this._currentTrack.id, false).then(() => {
|
this._replaceCurrentTrack(this._currentTrack.id, false).then(() => {
|
||||||
this._howler?.seek(localStorage.getItem('playerCurrentTrackTime') ?? 0);
|
this._howler?.seek(localStorage.getItem('playerCurrentTrackTime') ?? 0);
|
||||||
setInterval(
|
|
||||||
() =>
|
|
||||||
localStorage.setItem(
|
|
||||||
'playerCurrentTrackTime',
|
|
||||||
this._howler?.seek()
|
|
||||||
),
|
|
||||||
1000
|
|
||||||
);
|
|
||||||
}); // update audio source and init howler
|
}); // update audio source and init howler
|
||||||
this._initMediaSession();
|
this._initMediaSession();
|
||||||
this._setIntervals();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._setIntervals();
|
||||||
|
|
||||||
// 初始化私人FM
|
// 初始化私人FM
|
||||||
if (this._personalFMTrack.id === 0 || this._personalFMNextTrack.id === 0) {
|
if (this._personalFMTrack.id === 0 || this._personalFMNextTrack.id === 0) {
|
||||||
personalFM().then(result => {
|
personalFM().then(result => {
|
||||||
|
|
@ -173,7 +166,9 @@ export default class {
|
||||||
// 同步播放进度
|
// 同步播放进度
|
||||||
// TODO: 如果 _progress 在别的地方被改变了,这个定时器会覆盖之前改变的值,是bug
|
// TODO: 如果 _progress 在别的地方被改变了,这个定时器会覆盖之前改变的值,是bug
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
this._progress = this._howler === null ? 0 : this._howler.seek();
|
if (this._howler === null) return;
|
||||||
|
this._progress = this._howler.seek();
|
||||||
|
localStorage.setItem('playerCurrentTrackTime', this._progress);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
_getNextTrack() {
|
_getNextTrack() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue