Obtain a registered plugin from WaveSurfer instance #4006
-
First of all, thanks for this great library! I've reviewed the documentation thoroughly but haven't seen anything related on how to obtain a specific plugin from the registered plugins inside the WaveSurfer. I'm using the React version of the library but I exposed the WaveSurfer instance to other components. I don't know if I'm missing some part of the docs but just wanted to make sure if this feature exists, for something like const regionsPlugin = wavesurfer.getActivePlugin('regions'); to obtain a specific registered plugin inside the Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
There can be multiple of the same plugin type active at the same time. E.g. two Timelines – one above and one under with different steps. Better yet, just keep a memoized reference to your plugin instances using useMemo or useRef. |
Beta Was this translation helpful? Give feedback.
There can be multiple of the same plugin type active at the same time. E.g. two Timelines – one above and one under with different steps.
So you can use https://wavesurfer.xyz/docs/classes/wavesurfer.default#getActivePlugins + filter by type.
Better yet, just keep a memoized reference to your plugin instances using useMemo or useRef.