修复图片为空时设置歌曲信息出错的问题

pull/590/head
lyswhut 2021-08-07 19:35:13 +08:00
parent 2549c5587e
commit 5ddea2b1da
1 changed files with 4 additions and 5 deletions

View File

@ -918,14 +918,13 @@ export default {
if (this.setting.player.togglePlayMethod == 'random') this.setPlayedList(this.playMusicInfo)
},
updateMediaSessionInfo() {
navigator.mediaSession.metadata = new window.MediaMetadata({
const mediaMetadata = {
title: this.targetSong.name,
artist: this.targetSong.singer,
album: this.targetSong.albumName,
artwork: [
{ src: this.targetSong.img },
],
})
}
if (this.targetSong.img) mediaMetadata.artwork = [{ src: this.targetSong.img }]
navigator.mediaSession.metadata = new window.MediaMetadata(mediaMetadata)
},
registerMediaSessionHandler() {
// navigator.mediaSession.setActionHandler('play', () => {