fix(player): 系统媒体控件(SMTC)封面尺寸上限提升至 1024

artwork 增加 1024x1024 档位并改用 getImgUrl 生成 URL,正确处理
data:/local:// 封面与已带参数的图片地址,提升 AMLL 等 SMTC 监听端的封面清晰度。

Closes #595
This commit is contained in:
alger
2026-07-05 14:51:57 +08:00
parent 97209e9053
commit 5c45134909
+5 -3
View File
@@ -1,6 +1,6 @@
import type { AudioOutputDevice } from '@/types/audio';
import type { SongResult } from '@/types/music';
import { isElectron } from '@/utils';
import { getImgUrl, isElectron } from '@/utils';
class AudioService {
private audio: HTMLAudioElement;
@@ -145,8 +145,10 @@ class AudioService {
? track.ar.map((a) => a.name)
: track.song.artists?.map((a) => a.name);
const album = track.al ? track.al.name : track.song.album.name;
const artwork = ['96', '128', '192', '256', '384', '512'].map((size) => ({
src: `${track.picUrl}?param=${size}y${size}`,
// 上限提到 1024 提升 SMTC/AMLL 等系统媒体控件的封面清晰度(#595);
// 走 getImgUrl 以正确处理 data:/local:// 封面与已带参数的 URL
const artwork = ['96', '128', '192', '256', '384', '512', '1024'].map((size) => ({
src: getImgUrl(track.picUrl, `${size}y${size}`),
type: 'image/jpg',
sizes: `${size}x${size}`
}));