I have run into a roadblock on my web project that uses Wavesurfer. I have installed wavesurfer.js and react-wavesurfer as node modules in my project. Wavesurfer.js seems to be working fine, but react-wavesurfer seems to be encountering issues that I am finding difficult to debug. The following code:
import React from "react";
import WaveSurfer from "wavesurfer.js"
import ReactWavesurfer from "react-wavesurfer";
class Waveform extends React.Component {
makeWave() {
var wavesurfer = WaveSurfer.create({
container: '#waveform',
waveColor: 'red',
progressColor: 'purple'
});
wavesurfer.load('path/to/mp3');
};
render() {
this.makeWave();
return (
<div>
<ReactWavesurfer
audioFile={'path/to/mp3'}
/>
</div>
);
}
}
export default Waveform;
Produces only the first waveform from the call to this.makeWave(). It returns an error when trying to create the React waveform: Uncaught TypeError: this._wavesurfer.init is not a function
. I am using browserify to bundle my javascript dependencies.
Any help would be much appreciated!