You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi
I have problem with wavesurfer after I destroy it and recreate on a page. Consider the following scenario:
User clicks the button to start recording (record plugin) -> initializing: WaveSurfer.create and RecordPlugin.create
User clicks the button to stop recording -> calling waveSurfer.destroy and recordPlugin.destroy
User clicks the button to start recording again -> initializing: WaveSurfer.create and RecordPlugin.create.
Now what happens: When I reacreate the wavesurfer and try to draw it (3) I got RangeError: invalid array length exception in the renderMultiCanvas.draw function and the page freezes.
After some debugging I found out there is a problematic code:
// renderMultiCanvas functionconstnumCanvases=Math.ceil(totalWidth/singleCanvasWidth);// Render all canvases if the waveform doesn't scrollif(!this.isScrollable){for(leti=0;i<numCanvases;i++){draw(i);}return;}
For some reason singleCanvasWidth is 0 so it draws infinitely. I can temporarily fix my use case by doing const numCanvases = Math.ceil(totalWidth / singleCanvasWidth || 1); but I know that's not the root case.
Additionally, if I add console log inside the renderMultiCanvas I can see it is invoked constantly even when I destroy the wavesurfer instance.
Bug description
Hi
I have problem with wavesurfer after I destroy it and recreate on a page. Consider the following scenario:
Now what happens: When I reacreate the wavesurfer and try to draw it (3) I got
RangeError: invalid array length
exception in therenderMultiCanvas.draw
function and the page freezes.After some debugging I found out there is a problematic code:
For some reason
singleCanvasWidth
is 0 so it draws infinitely. I can temporarily fix my use case by doingconst numCanvases = Math.ceil(totalWidth / singleCanvasWidth || 1);
but I know that's not the root case.Additionally, if I add
console log
inside therenderMultiCanvas
I can see it is invoked constantly even when I destroy the wavesurfer instance.Environment
Minimal code snippet
(Some code omitted to make it clearer)
Expected result
Library and plugin is correctly unmounted and it is possible to clean and rerun the initialization
The text was updated successfully, but these errors were encountered: