Repository navigation
feat(android): 重构播放系统,支持移动端频谱与原生队列 - #23
Merged
Merged
Conversation
- 新增Android原生播放队列自治,WebView冻结时仍可自主切歌 - 实现Android端FFT频谱采集,支持移动端音乐频谱显示 - 拆分频谱渲染到桌面端与移动端,修复z-index冲突 - 优化歌词存储逻辑,避免逐字歌词阻塞主线程 - 重构播放进度更新逻辑,适配后台与可见性状态 - 修复动态封面加载问题,优化兼容性与错误兜底
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 变更类型
📝 变更说明
本次 PR 聚焦于 Android 原生播放链路自治化 与 频谱 / 进度 / 封面 等周边性能问题 的修复,主线目标是 WebView 在后台被冻结或主线程长时间繁忙时,Android 端仍能完成自主切歌、续播、媒体会话同步与频谱展示。
1. Android 原生播放队列自治(核心)
PlaybackQueue自主推进:advanceRaw / backRaw跳过skipSong,窗口完整覆盖全局列表(≤201 首)时自治 ALL wrap;窗口边缘耗尽则 emitrequestUrls让 JS 补窗。playFromQueue / load / cleanup入口统一自增resolveTokenCounter,过期 token 回调直接丢弃;清理过期pendingResumeAfterRefill避免补窗误续播。hasNextOutsideWindow=true时拦截 ENDED,等下一次 updateQueueContext 拿到新窗口后立即 advance + playFromQueue,弥补 JS 不主动 play 的链路缺口。radius=0,单首推进语义不破坏。2. Android FFT 频谱采集
RenderersFactory,音频线程只写 snapshot buffer,主线程做 base64 编码 + IPC emit,避免阻塞音频回调。3. 频谱渲染拆分与 z-index 修复
Path2D批绘减少 GPU 状态切换。visibilitychange驱动采集 / 绘制启停,后台与锁屏不再无谓消耗 CPU / 电量。4. 歌词存储优化
music-store的persist.pick收窄到playSong / playPlaylistId / personalFM / dailySongsData,songLyric不再持久化,每次切歌少写 100-500KB 逐字 yrcData JSON。requestIdleCallback推迟JSON.stringify,且只在showDesktopLyric=true时执行。statusStore.$patch合并 7-8 个独立 setter 为一次序列化。5. 播放进度更新重构
6. 动态封面修复
poster / playsinline / preload / disablepictureinpicture,新增error / stalled事件兜底,失败时清理资源避免花屏与原生播放按钮占位。7. 周边
requestIdleCallback调度 + LRU 缓存,切歌时主线程更顺滑。📱 影响范围
✅ 自检清单
devpnpm lint且无 warningpnpm typecheck且无报错🧪 测试方式
requestUrls→ JS 补窗 → Java 续播链路是否无缝。pnpm lint与pnpm typecheck:web在改动文件无新增错误。💬 其他说明 (选填)
WindowTrack字段瘦身或增量 diff 推送。setAudioProcessors传数组而非单元素。pnpm typecheck:web仍残留 58 个旧错误,集中在本 PR 未触及的 19 个文件