I am using wavesurfer and showing the wave in a modal. But when I close the modal and then want to open another file in new modal, it shows me the older wave. It looks like the canvas is not destroyed when I close the canvas.
I don't want to refresh the page under the modal. The canvas is destroyed obviously when I refresh the page.
Can you help?
@shaliniidea you can empty it and load another file when opening the modal:
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">Load Audio</button>
<script>
$('#exampleModal').on('show.bs.modal', function (event) {
wavesurfer.empty();
wavesurfer.load('mp3link');
});
</script>
Most helpful comment
@shaliniidea you can empty it and load another file when opening the modal: