-
Notifications
You must be signed in to change notification settings - Fork 23
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
stopping propagation on click event for a Region to WaveForm #104
Comments
Is anyone there? |
When you place on click on region you use special region event listener, wavesurfer listens for the whole waveform, thus you should decide on your own how to structure your application and how to use existing wavesurfer.js API. If events are called in the same order, i.e. if region is called first and waveform's level listener is called next, then you can use some temporal variable to disable waveform's listener after region's is called. |
Thank you @ShiiRochi. One more, how can I catch the time and stop the player when the region ends. |
Region has start and end...if wavesurfer does not stop playing on region end, then you can try to listen to "progress" event and when progress reaches the regions end, i.e. progress === region.end, then you can call pause method of wavesurfer or similar to stop playing but keeping cursor position. Whatever you decide, try to reach wavesurfer.js documentation and check what ways you have because as far as I remember, previously wavesurfer played regions fine, however currently I don't have enough time to track all its changes. |
thank you for your answer. |
This is basic structure, as I know.
And I have a listener implementation for whole Wavesurfer instance like this.
In this case, these 2 callbacks(onClick for region and the on("click") for the wavesurferRef) are all called.
The region event called first, and then wavesurfer click event called next.
I want to play all audio from clicked time when I clicked outside of all regions.
And I want to play only the region area when I clicked a region of all.
1. Is this code correct to catch on click for regions?
You have 'region-removed' event handler for
region-removed
on the example code below.wavesurfer-react/demo/src/App.js
Lines 167 to 169 in 157f414
So, I thought 'region-click event could be possible.
The Wavesurfer is listing 'region-click' event in the reference. - https://wavesurfer.xyz/plugins/regions
But it's not working now.
2. How can I modify this code when I want to stop propagating the event after called onClick() of regions and make on("click") has not called?
3. It seems that
region.play()
is playing all the audio from the time I clicked.It is same to
wavesurferRef.current.play()
.Is this intended or a bug?
The text was updated successfully, but these errors were encountered: