From 90aad45e2d3162f5376b2c7741fb4606b16020f2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 11 May 2026 13:27:04 +0000 Subject: [PATCH 1/3] Initial plan From 8a4a1e4635b3c8623be817958a90c9e124dc6359 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 11 May 2026 13:30:59 +0000 Subject: [PATCH 2/3] =?UTF-8?q?feat(plugin):=20add=20video.mpris-cover=20?= =?UTF-8?q?=E2=80=94=20simplified=20MPRIS=20plugin=20that=20only=20syncs?= =?UTF-8?q?=20video=20cover=20artwork?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Agent-Logs-Url: https://github.com/BlockG-ws/b23-evolved/sessions/e1791125-b6e5-42e1-869c-7d92440d8e43 Co-authored-by: GrassBlock1 <46253950+GrassBlock1@users.noreply.github.com> --- .../lib/plugins/video/mpris-cover/index.ts | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 registry/lib/plugins/video/mpris-cover/index.ts diff --git a/registry/lib/plugins/video/mpris-cover/index.ts b/registry/lib/plugins/video/mpris-cover/index.ts new file mode 100644 index 0000000000..346cef0658 --- /dev/null +++ b/registry/lib/plugins/video/mpris-cover/index.ts @@ -0,0 +1,40 @@ +import type { PluginMetadata } from '@/plugins/plugin' +import { videoChange } from '@/core/observer' +import { VideoInfo } from '@/components/video/video-info' + +const COVER_SIZES = '480x270' +const COVER_TYPE = 'image/jpeg' + +export const plugin: PluginMetadata = { + name: 'video.mpris-cover', + displayName: 'MPRIS 封面同步', + description: `将系统媒体控制(MPRIS)的专辑封面替换为当前正在播放的 Bilibili 视频封面。`, + setup: () => { + if (!('mediaSession' in navigator)) { + return + } + + const ms = navigator.mediaSession + + videoChange(async ({ aid }) => { + let info: VideoInfo + try { + info = await new VideoInfo(String(aid)).fetchInfo() + } catch { + return + } + + if (!info.coverUrl) { + return + } + + const artwork: MediaImage[] = [{ src: info.coverUrl, sizes: COVER_SIZES, type: COVER_TYPE }] + + if (ms.metadata) { + ms.metadata.artwork = artwork + } else { + ms.metadata = new MediaMetadata({ artwork }) + } + }) + }, +} From fa3b64aeab4632e4524b25d10361bac4c2c5801b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 14 May 2026 00:47:37 +0000 Subject: [PATCH 3/3] fix(mpris-cover): add requestId to prevent stale artwork on fast video switch Agent-Logs-Url: https://github.com/BlockG-ws/b23-evolved/sessions/1af2cb60-a33a-447e-8eb6-217e53b05ddb Co-authored-by: GrassBlock1 <46253950+GrassBlock1@users.noreply.github.com> --- registry/lib/plugins/video/mpris-cover/index.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/registry/lib/plugins/video/mpris-cover/index.ts b/registry/lib/plugins/video/mpris-cover/index.ts index 346cef0658..94508f0dc8 100644 --- a/registry/lib/plugins/video/mpris-cover/index.ts +++ b/registry/lib/plugins/video/mpris-cover/index.ts @@ -15,8 +15,10 @@ export const plugin: PluginMetadata = { } const ms = navigator.mediaSession + let requestId = 0 videoChange(async ({ aid }) => { + const currentId = ++requestId let info: VideoInfo try { info = await new VideoInfo(String(aid)).fetchInfo() @@ -24,6 +26,10 @@ export const plugin: PluginMetadata = { return } + if (currentId !== requestId) { + return + } + if (!info.coverUrl) { return }