使用默认图像

This commit is contained in:
2023-10-26 03:18:58 +08:00
parent a232ece058
commit 662db2a75b
1 changed files with 3 additions and 4 deletions

View File

@ -379,10 +379,9 @@ export default class MusicList {
}) })
} }
} else { } else {
const default_picture = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'
this.标题.textContent = item.name this.标题.textContent = item.name
if (item.picture) { this.封面.style.backgroundImage = `url(${item.picture || default_picture})`
this.封面.style.backgroundImage = `url(${item.picture})`
}
// 替换浏览器媒体信息(使系统通知栏显示歌曲信息) // 替换浏览器媒体信息(使系统通知栏显示歌曲信息)
if ('mediaSession' in navigator) { if ('mediaSession' in navigator) {
navigator.mediaSession.metadata = new MediaMetadata({ navigator.mediaSession.metadata = new MediaMetadata({
@ -390,7 +389,7 @@ export default class MusicList {
artist: '艺术家名', artist: '艺术家名',
album: '专辑名', album: '专辑名',
artwork: [ artwork: [
{ src: item.picture, sizes: '96x96', type: 'image/jpeg' }, { src: item.picture || default_picture, sizes: '96x96', type: 'image/jpeg' },
] ]
}) })
} }