Skip to content

🐞 fix: 修复延迟补偿在playback模式意外丢失补偿值的逻辑bug#991

Merged
imsyy merged 1 commit into
SPlayer-Dev:devfrom
ITManCHINA:web-audio-optimization
Mar 13, 2026
Merged

🐞 fix: 修复延迟补偿在playback模式意外丢失补偿值的逻辑bug#991
imsyy merged 1 commit into
SPlayer-Dev:devfrom
ITManCHINA:web-audio-optimization

Conversation

@ITManCHINA
Copy link
Copy Markdown
Member

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求旨在解决音频播放器中延迟补偿机制的两个关键逻辑错误。它通过根据当前的音频延迟提示模式(playbackinteractive)动态调整自动和手动延迟补偿的计算方式,确保在不同模式下都能正确应用补偿值,从而提升歌词同步的准确性和用户体验。

Highlights

  • 修复延迟补偿模式混淆问题: 解决了 playback 模式下的手动延迟补偿值被错误地应用于 interactive 模式,导致歌词与歌词进度不一致的问题。
  • 优化自动延迟补偿逻辑: 修正了从 interactive 切换到 playback 模式时,自动计算的延迟补偿值被错误重置为0,导致自动补偿失效的问题。
  • 引入设置存储: 通过 useSettingStore 动态判断当前音频延迟提示模式,以确保延迟补偿逻辑的正确应用。
Changelog
  • src/core/audio-player/AudioElementPlayer.ts
    • 引入 useSettingStore 以获取音频延迟提示模式。
    • 修改 currentTime 的计算逻辑,使其根据当前模式(playbackinteractive)有条件地应用自动和手动延迟补偿。
    • 修复了 playback 模式下的手动补偿值在 interactive 模式下被错误使用的问题。
    • 修复了从 interactive 切换到 playback 模式时自动补偿失效的问题。
Activity
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

此 PR 修复了与音频延迟补偿相关的逻辑错误。修改的核心是在 currentTime getter 中动态地从 settingStore 获取当前的 audioLatencyHint,以确保只在 playback 模式下应用自动和手动的延迟补偿。这解决了在 interactive 模式下补偿被错误应用,以及模式切换后自动补偿失效的问题。代码改动是正确的,但有一个性能相关的建议:为了避免在 currentTime 这个高频调用的函数中重复获取 store 实例,建议将其缓存。

Comment thread src/core/audio-player/AudioElementPlayer.ts
@imsyy imsyy merged commit a94e505 into SPlayer-Dev:dev Mar 13, 2026
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