-
-
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
How to set the current time #1039
Comments
@burningding The way it's done in the region examples is: wavesurfer.play(region.start); You can replace region.start with the number of seconds. |
@dmongrel Sorry for the ambiguous narration of question. In my case, I want to set the position of cursor (the current time) to the mid of region (the average between region.start and region.end). How can I achieve this? Thanks! |
You could also try |
@burningding you can set it with For now if you want to add the current time in the middle of two sections of the audio, You can do the following which will set it in the middle between start 4 seconds and end 12 seconds.
After pr #1046 is merged, you can do the following
or
|
@entonbiba @nelemnaru Thanks for your help! Looking forward the new version! |
@nelemnaru @entonbiba I tried to use
to set the current time, it works well. Now I want to drag to add a region and also set the current time to the mid of the region. I tried to add the code above to the event "region-update-end", it's true that the cursor will be set to the mid when "region-update-end" is fired. However, it seems that another mouse event is also fired, so at last, the cursor will be set to the place where I release the mouse. I also tried to use stopPropagation as well as stopImmediatePropagation in "region-update-end" event, but it doesn't work. Any idea on it? Thanks! |
@burningding so when you drag the region, you want it to set the play time in the middle or ? |
I have a similar problem trying to play a region on double click, and stopPropagation doesn't help. It starts playing the region, but the cursor ends up moving to where I clicked. Currently, I'm using a workaround by using a setTimeout delay of 0.
You could try setting a 0 timeout on your code until the issue is solved. |
@nelemnaru you can use
|
@entonbiba I tried your suggestion to no avail. The region still begins playing from where I double-clicked instead of region start. (Don't know if it matters, but I'm using Firefox.) |
@nelemnaru For now try the following below,
|
Thanks for your awesome job on wavesurfer.js!
I found there's only how to get current time, but there's no way to set current time. I'm not sure if I didn't find it, or we don't have this function right now?
Any ideas?
Thanks,
Shaojin
The text was updated successfully, but these errors were encountered: