Closed GitHubRakeshSharma closed 7 years ago
@GitHubRakeshSharma What do you mean with local file? Is it on your harddrive, or is it in the same location as the JS code you posted?
Do you get an error message?
I have put the file(s) into a folder in the same directory as the source files are... to be honest I already switched to making my own small wrapper for this lib. But now I have issues with creating a custom renderer. Seems like babel makes my life uneasy
In case it helps anyone, here's the solution I came up with for loading local files with a file input:
audioFile
to the state:this.state = {
playing: false,
pos: 0,
audioFile: null,
};
<input
type="file"
onChange={this.handleLoadSample}
/>
<Wavesurfer
audioFile={this.state.audioFile}
pos={this.state.pos}
onPosChange={this.handlePosChange}
playing={this.state.playing}
/>
handleLoadSample
to load the file. handleLoadSample(e) {
this.setState({
audioFile: e.target.files[0]
});
}
Maybe this is also related: https://stackoverflow.com/a/31360448/5097199
I'll close this for now. Please comment if you still have questions and I'll reopen.
Hi, I have an issue with loading a local file. I am completely new to React. I used Wavesurfer.js before without bigger problmes. I just cannot wrap my head around this... Here is the code (simply used the template):
Thanks for reading, Rakesh
(edited by @mspae for proper code formatting)