修复图片为空时设置歌曲信息出错的问题
parent
2549c5587e
commit
5ddea2b1da
|
@ -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', () => {
|
||||
|
|
Loading…
Reference in New Issue