Any way to know when the regions plugin is ready to accept new regions? #3559
Unanswered
jagthedrummer
asked this question in
Q&A
Replies: 1 comment
-
You should be able to add regions as soon as wavesurfer knows the audio duration. So on one of the following events:
See this example: https://wavesurfer.xyz/examples/?regions.js |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm working on an interactive player where the regions plugin is added after the wavesurfer is initially created and I'm trying to figure out how to know when the plugin is ready to accept new regions.
I'm trying to do this:
The problem I'm running into is that sometimes (often, but not always) the call to
this.regions.addRegion
will fail with a complaint thatthis.regions
isnull
. (Theawait
s here seem to be useless because neitherRegionsPlugin.create
orwavesurfer.registerPlugin
return a promise, so nothing is actually beingawait
ed.)If I set a timeout and add the region after a few hundred milliseconds it works pretty consistently.
Is there any way to know when the regions plugin is ready?
Beta Was this translation helpful? Give feedback.
All reactions