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