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

fix(web): Avoid stutter when starting playback #1476

Merged
merged 2 commits into from
Apr 20, 2023

Conversation

blaugold
Copy link
Contributor

@blaugold blaugold commented Apr 17, 2023

Description

Setting currentTime of AudioElement after calling play can cause a stutter, if the browser is able to start playback of the audio immediately and execution after play is delayed by other tasks in the event loop.

By setting currentTime before calling play this issue can be avoided.

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs:, chore: etc).
  • I have read the Contributor Guide and followed the process outlined for submitting PRs.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation and added dartdoc comments with ///, where necessary.
  • I have updated/added relevant examples in example.

Breaking Change

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

Related Issues

@Gustl22
Copy link
Collaborator

Gustl22 commented Apr 17, 2023

I wonder if it's also solved with #1469. Because there it waits for the onLoad operation to finish. But could be another case :) Maybe you can try :D

@blaugold
Copy link
Contributor Author

I'll try it out :)

@blaugold
Copy link
Contributor Author

OK, I've tried #1469, and while it does make the issue I'm having less likely it still happens sometimes.

@blaugold
Copy link
Contributor Author

@Gustl22 Friendly ping. Is there anything else I need to do?

@Gustl22
Copy link
Collaborator

Gustl22 commented Apr 20, 2023

I'll also try your branch ;) But I also wonder, what is the technical reason to avoid stutter, when setting the position before playing.

Edit: never mind, I get your point. Will test and merge ASAP. Thx ;)

@Gustl22 Gustl22 changed the title fix: avoid stutter when starting playback on web fix(web): Avoid stutter when starting playback Apr 20, 2023
@Gustl22 Gustl22 merged commit a28eed0 into bluefireteam:main Apr 20, 2023
@Gustl22
Copy link
Collaborator

Gustl22 commented Apr 20, 2023

@blaugold Thank you very much for your contribution!

@blaugold blaugold deleted the fix/web-currentTime branch April 21, 2023 07:53
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.

2 participants