将 MediaSession 播放状态绑定在播放器上#164
Merged
Merged
Conversation
Contributor
Greptile Summary此 PR 将 MediaSession 的播放状态与位置信息同步逻辑从外部迁移到 audio 元素的原生事件上,解决了播放 MV 时播放状态与媒体信息不一致的问题。同时新增了
Confidence Score: 5/5改动范围局限于 MediaSession 绑定逻辑,不影响核心音频播放流程,可安全合并。 本次改动将 MediaSession 状态同步从外部逻辑移入 audio 元素事件监听,逻辑路径清晰,NaN/Infinity duration 防护正确,seek 动作处理器的空值处理也已通过 ?? 运算符覆盖。唯一值得关注的是 seekto 对 Infinity 的防护缺失,但实际 OS 发出非有限 seekTime 的概率极低,不构成现实风险。 无需特别关注,所有改动均在 src/preload/audioplayer.ts 中,且变更范围可控。
|
| Filename | Overview |
|---|---|
| src/preload/audioplayer.ts | 将 MediaSession 播放状态及位置同步绑定到 audio 元素事件,新增 seekto/seekforward/seekbackward 动作处理,重构 stopProgressRaf 并提取事件名常量。NaN/Infinity duration 防护已到位,seekto 对非有限数(如 Infinity)的防护略有不足。 |
Reviews (2): Last reviewed commit: "fix/player: mediaSession complicant" | Re-trigger Greptile
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
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.
避免在播放 MV 的时候播放状态和媒体信息不一致