fix: 修复失败 CL——队列持久化被覆盖、续播位置失效、均衡器会话兜底 - #1
Merged
Merged
Conversation
原失败 CL(8a8a3b9) 仅被修掉编译错误后重引入(787df56),但仍有三处运行时缺陷使 「队列持久化 / 续播」功能不可用: 1. 曲库加载会覆盖播放队列 - LibraryFragment.applySongs 原每次都 playlist.clear()+填入 allSongs+saveQueue, 把 restoreQueue 恢复的自定义队列/续播位置悄悄覆盖,导致续播落错歌曲。 - 改为:播放队列仅由「用户点歌」与「续播恢复」维护,曲库展示列表(allSongs) 与播放队列(PlayerManager.playlist)彻底解耦。 2. 续播位置被清零 - PlayerService.playAt 在 prepare 前把 progress 置 0,onPrepared 再读它, 导致「续播到上次位置」永远不触发。 - 改为:restoreQueue 写入 pendingResumePosition/resumeSongKey,仅当重播的歌曲 与恢复出的同一首一致时才 seek 到上次位置,随后清零,避免误续播到其它歌曲。 3. 均衡器会话兜底 - 若服务创建时音频会话尚未就绪(sessionId==0)导致 Equalizer 未初始化, 在 onPrepared(会话此刻一定有效)补初始化,保证均衡器功能可用。 附带借鉴 Auxio 的轻量改进:曲库「歌曲/收藏」列表高亮正在播放的歌曲, 其不可见时自动滚动到该曲。保持零额外依赖、安装包 <10MB。
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.
背景
原失败 CL
8a8a3b9(队列持久化 / 异步扫描 / 均衡器 / 分组增强)因编译错误被回退,787df56仅修掉编译错误后重引入,但仍有三处 运行时缺陷 使「队列持久化 / 续播」功能不可用。改动
曲库加载不再覆盖播放队列(
LibraryFragment.applySongs)playlist.clear() + 填入 allSongs + saveQueue(),使restoreQueue恢复的自定义队列 / 续播位置不再被悄悄覆盖,续播落错歌曲的问题消失。
曲库展示列表
allSongs与播放队列PlayerManager.playlist解耦。续播位置不再被清零(
PlayerService+PlayerManager)restoreQueue写入pendingResumePosition/resumeSongKey;onPrepared曾读取已被playAt清零的progress,改为读取独立的resumePosition,且仅当重播歌曲与恢复出的同一首一致时才 seek,随后清零,避免误续播到其它歌曲。
均衡器会话兜底(
PlayerService.onPrepared+EqualizerHelper.isInitialized)Equalizer未初始化,在
onPrepared(会话此刻一定有效)补初始化,保证均衡器可用。借鉴其他项目的轻量改进
约束
🤖 Generated with WorkBuddy