Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed: player duration error Infinity:NaN #24

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

LacLic
Copy link

@LacLic LacLic commented Mar 11, 2024

为了修复这个 bug,添加了一个新的 State,考量如下:

原先 PlayerState 就是一个独立的 State,但是由于 HTTPAudioElement 中的 duration 在流媒体播放时总是 Infinity(除了最后三秒外)

这个 duration 应该和 PlayerState 有同等地位(绑在一起了),但是考虑到原有的代码可能需要直接调用它,所以并没有将其直接并入 PlayerState,而是另外加了个 PlayerDurationState

当然最主要原因是,直接弄一个回调函数给 usePlayer 是没有用的,因为这个 duration 只在调用 play() 的时候更新,但是此时 usePlayerTime 并不会执行 play(),想不到其他办法了

这个问题解决后,anniw 的进度条也能拖动了

@Last-Order
Copy link
Member

LGTM
@Yesterday17

@Last-Order Last-Order requested a review from Yesterday17 March 11, 2024 16:53
Copy link
Member

@Yesterday17 Yesterday17 left a comment

Choose a reason for hiding this comment

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

LGTM

@Yesterday17 Yesterday17 merged commit 98f70b5 into ProjectAnni:master Mar 13, 2024
1 check 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