diff --git a/publish/changeLog.md b/publish/changeLog.md index 1d24dce9..04ccd3b0 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -3,6 +3,7 @@ - 优化我的列表、下载列表等列表的滚动流畅度 - 优化下载功能的批量添加、删除、暂停任务时的流畅度,现在进行这些操作应该不会再觉得卡顿了 - 支持启动软件时恢复播放下载列表里的歌曲 +- 添加媒体播放进度条的信息设置 ### 修复 diff --git a/src/renderer/components/core/Player.vue b/src/renderer/components/core/Player.vue index 611e6c14..5ee46b86 100644 --- a/src/renderer/components/core/Player.vue +++ b/src/renderer/components/core/Player.vue @@ -417,6 +417,8 @@ export default { if (!this.targetSong.interval && this.listId != 'download') { this.updateMusicInfo({ listId: this.listId, id: this.targetSong.songmid, musicInfo: this.targetSong, data: { interval: formatPlayTime2(this.maxPlayTime) } }) } + + this.updatePositionState() }) audio.addEventListener('loadstart', () => { console.log('loadstart') @@ -431,6 +433,7 @@ export default { audio.currentTime = playTime } this.clearBufferTimeout() + this.updatePositionState() // if (this.musicInfo.lrc) window.lrc.play(audio.currentTime * 1000) this.status = this.statusText = '' @@ -484,7 +487,6 @@ export default { }, async play() { this.clearDelayNextTimeout() - this.updateMediaSessionInfo() let targetSong = this.targetSong @@ -514,6 +516,8 @@ export default { this.musicInfo.album = targetSong.albumName this.setUrl(targetSong) } + + this.updateMediaSessionInfo() this.setImg(targetSong) this.setLrc(targetSong) this.handleUpdateWinLyricInfo('music_info', { @@ -972,6 +976,13 @@ export default { if (this.currentMusicInfo.img) mediaMetadata.artwork = [{ src: this.currentMusicInfo.img }] navigator.mediaSession.metadata = new window.MediaMetadata(mediaMetadata) }, + updatePositionState() { + navigator.mediaSession.setPositionState({ + duration: audio.duration, + playbackRate: audio.playbackRate, + position: audio.currentTime, + }) + }, registerMediaSessionHandler() { // navigator.mediaSession.setActionHandler('play', () => { // if (this.isPlay || !this.playMusicInfo) return