-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
No onReady event firing in React when using pre-computed peaks #3744
Comments
I believe this was fixed in wavesurfer.js, the react package just needs to be updated. |
The React package seems to do very little other than pulling in the wavesurfer.js core library and then React-ifying it. I wonder if there's a way to wrap the wavesurfer Looking at the wavesurfer.js API, I don't see a good place for useEffect to hook into. If you have any suggestions, I would be happy to take a stab at a PR to address this. Thanks. |
AFAIR this event is already promisified, even with predecoded peaks. Probably use effect is still being triggered too late. |
@njbair a fix is now live in 7.8.1. Cheers! |
Bug description
When using
@wavesurfer/react
with pre-computed peaks, the onReady event is never triggered, so there's presumably no occasion to bind the wavesurfer object to state, and thus no opportunity to initialize other controls.Environment
Minimal code snippet
Clone this demo repo https://github.com/njbair/wavesurfer-react.git then run
npm start
and browse to localhost:3000. Open dev tools to monitor the JS console.Expected result
We should get a
ready
event when the file loads.Obtained result
ready
event when the file loads.ready
event is triggered.ready
event is triggered.useWavesurfer
hook instead of theWavesurferPlayer
component. This makes sense to me, since the component is just a basic wrapper around the hook.Screenshots
Here is a screenshot of the console only displaying
redraw
andredrawcomplete
events:The text was updated successfully, but these errors were encountered: