Skip to content

feat(plugin): MPRIS 媒体控制插件 — 支持分P、合集与单视频#5

Merged
GrassBlock1 merged 4 commits into
masterfrom
copilot/fix-mpris-video-info
May 18, 2026
Merged

feat(plugin): MPRIS 媒体控制插件 — 支持分P、合集与单视频#5
GrassBlock1 merged 4 commits into
masterfrom
copilot/fix-mpris-video-info

Conversation

Copy link
Copy Markdown

Copilot AI commented May 2, 2026

新增 video/mpris 插件,通过浏览器 Media Session API 将 Bilibili 视频接入系统媒体控制(Linux MPRIS 等)。同时扩展 VideoInfo API 以暴露 ugc_season 数据。

src/components/video/video-info.ts

  • 新增 UgcSeasonEpisodeInfo / UgcSeasonSectionInfo / UgcSeasonInfo 接口
  • VideoInfo 新增 ugcSeason?: UgcSeasonInfo 字段,在现有的 fetchInfo() 调用中从 data.ugc_season 提取,无额外网络请求

registry/lib/plugins/video/mpris

  • 元数据:标题(分P时附 P1 分P名)、UP主名(artist)、视频封面(artwork)

  • 进度同步setPositionState 含 duration / position / playbackRate,每 5s 刷新,play / pause / ratechange 事件即时触发

  • 控制:play / pause / seekforward / seekbackward(默认 ±10s)/ seekto,通过 playerAgent API 操作

  • 上/下一曲(分P 与合集可同时生效,不互斥):

    previoustrack:
      有上一P → 切换至上一P
      无上一P 且在合集中 → 跳转至合集上一集
    
    nexttrack:
      有下一P → 切换至下一P
      无下一P 且在合集中 → 跳转至合集下一集
      单视频/番剧 → 点击播放器内置 next 按钮(不存在或 disabled 则不注册)
    
  • videoChange 回调触发时自动刷新全部 metadata 与 handler,切换前清理旧事件监听与定时器

  • 使用 VideoInfo API 代替裸 getJsonWithCredentials 调用

Copilot AI and others added 4 commits May 2, 2026 11:00
…ogic; add ugcSeason to VideoInfo

Agent-Logs-Url: https://github.com/BlockG-ws/b23-evolved/sessions/062bb310-df3b-4b33-8663-34ca6e9695bc

Co-authored-by: GrassBlock1 <46253950+GrassBlock1@users.noreply.github.com>
@GrassBlock1 GrassBlock1 marked this pull request as ready for review May 2, 2026 11:40
Copilot AI review requested due to automatic review settings May 2, 2026 11:40
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@GrassBlock1
Copy link
Copy Markdown

@copilot 再新建一个这个插件的简化版本,只把 mpris 的专辑封面替换成当前正在播放的视频的封面

Copy link
Copy Markdown
Author

Copilot AI commented May 11, 2026

@GrassBlock1 I've opened a new pull request, #6, to work on those changes. Once the pull request is ready, I'll request review from you.

@GrassBlock1 GrassBlock1 merged commit 0666aab into master May 18, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants