react-wavesurfer icon indicating copy to clipboard operation
react-wavesurfer copied to clipboard

Large files problem/Disabling the waveform in the timeline

Open hhlevnjak opened this issue 8 years ago • 3 comments

I don't know if anyone here has had this issue, but there is a problem when you try to load large files in Chrome, it can cause an out of memory exception. The audio files that I have are sometimes over an hour long.

Now, I know this is a problem in Wavesurfer itself, there are issues on Wavesurfer Github with potential solutions, mostly using predefined peaks or images, but I can't seem to make any one of them work with react-wavesurfer.

Has anyone managed to resolve that problem using react-wavesurfer? If I try to load audio peaks, it breaks and won't load the audio, and there doesn't seem to be an option to use images like in just Wavesurfer. I'm fine with just disabling the waveform generation for larger files now, if anyone has managed to do it here, until I can make a better solution.

hhlevnjak avatar Jul 26 '17 14:07 hhlevnjak

You can pass in pregenerated peaks into the component with audioPeaks prop if you use the MediaElement backend. Then the audio does not need to be decoded before rendering the waveform.

You could detect the size of the file before loading with something like this: https://stackoverflow.com/questions/17416274/ajax-get-size-of-file-before-downloading

mspae avatar Aug 10 '17 18:08 mspae

I tried that, but it didn't work either, it still takes up too much memory, so I guess it's still decoding the audio file.

hhlevnjak avatar Aug 21 '17 07:08 hhlevnjak

How large is your audio file? Can you provide the implemetation code? Otherwise I'm afraid I can't really help you much.

mspae avatar Aug 21 '17 20:08 mspae