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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(useMediaControls): better representation for "waiting" value #3072

Merged
merged 1 commit into from May 9, 2023
Merged

fix(useMediaControls): better representation for "waiting" value #3072

merged 1 commit into from May 9, 2023

Conversation

ferferga
Copy link
Contributor

@ferferga ferferga commented May 7, 2023

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

Description

"waiting" only fires when there's a lack of data in the middle of the playback. However, it doesn't take into account the lack of data when the source is attached to the element, as "loadeddata" does. I think it's safe to assume people want from "waiting" all possible buffering states. In the probably scarce cases where the user wants more control over the native event handlers, native event handlers can still be used.

"playing" also represents when a current playback is happening now.


馃 Generated by Copilot at b092cfe

Improved media controls state handling by useMediaControls. Added support for more media events and states, such as waiting and playing.

馃 Generated by Copilot at b092cfe

  • Update useMediaControls function to handle more media events and states (link)

waiting only fires when there's a lack of data in the middle of the playback. However, it doesn't take into account the lack of data when the source is attached to the element, as loadeddata does

"playing" also represents when a current playback is happening now
@antfu antfu merged commit 0b253bb into vueuse:main May 9, 2023
3 checks passed
@emmanuelgeoffray
Copy link

@ferferga thank you for working on this !
I agree with you, we just want that 'waiting' represents all buffering state.

I'm having similar issues with waiting not returning to false. Even with your fix.
From what I debugged, clearing waiting on the seeked event, fixes the issue.
I think it is safe, but I may not know all the details behind the seeked and waiting events.

@ferferga
Copy link
Contributor Author

@emmanuelgeoffray Can you give a playground I can test? Something with a large enough audio file would be enough I guess, given with DevTools I can mimick slow network conditions.

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.

None yet

3 participants