Closed bknill closed 5 years ago
Sounds like race condition between init
and stop
messages in a Worker. Are you waiting for the initWorker()
Promise before starting the recording? Could you please show your code?
Thanks. This is from a Redux action.
import vmsg from 'vmsg'
const recorder = new vmsg.Recorder({
wasmURL: "https://unpkg.com/vmsg@0.3.0/vmsg.wasm"
})
startWebRecorder()
const startWebRecorder = async () => {
await recorder.initAudio()
await recorder.initWorker()
recorder.startRecording()
}
Then on stop
recorder.stopRecording().then(res => upload(res, type, id))
I'm not waiting for the initWorker promise, how would i add that to the start function?
Is it possible you're calling stopRecording
before startWebRecorder()
Promise fulfilled?
I'm not waiting for the initWorker promise, how would i add that to the start function?
You may make yout buttons disabled by default and activate with e.g.
startWebRecorder().then(() => {
this.setState({recording: true});
});
and then use disabled={!this.state.recording}
for your stop button.
You need to init worker only once btw, don't create a new one for every record. Probably API should disallow this...
thanks I've done a check to see if it's been initialised and it works better
Hi,
I get this error randomly.. often on short recordings.