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: (Record) setTimeout instead of requestAnimationFrame #3827

Merged
merged 2 commits into from
Aug 17, 2024
Merged

Conversation

katspaugh
Copy link
Owner

Short description

requestAnimationFrame has a different delay depending on the screen's FPS, so it results in a different continuous waveform speed. Changing it to setTimeout gives a more predictable result.

I've also optimized the performance of the continuousWaveform rendering:

  • The smallest FFT size (32) because we only need one value per frame
  • Math.max -> a loop

Copy link

cloudflare-workers-and-pages bot commented Aug 17, 2024

Deploying wavesurfer-js with  Cloudflare Pages  Cloudflare Pages

Latest commit: 26157c0
Status: ✅  Deploy successful!
Preview URL: https://be186c24.wavesurfer-js.pages.dev
Branch Preview URL: https://fix-rec.wavesurfer-js.pages.dev

View logs

@katspaugh katspaugh merged commit be50827 into main Aug 17, 2024
4 checks passed
@katspaugh katspaugh deleted the fix-rec branch August 17, 2024 11:54
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.

1 participant