Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
startRecording () {
// build a config for the OpusRecorder
const config = {
encoderPath: encoderPath,
encoderApplication: 2048,
streamPages: true // Receive every frame in real time
}
// create the media recorder
this._mediaRecorder = new Recorder(config)
this._mediaRecorder.ondataavailable = (data) => {
this._send(data)
}
// start the media recorder.
this._mediaRecorder.start()
.then(() => { console.log('Started audio recorder')})
.catch((err) => {
const serr = new Error(`Failed to start audio recording: ${err}`)
this.emit(Events.error, serr)
})
}
constructor(props: IFileElementComponent) {
super(props);
this.canRecord = Recorder.isRecordingSupported();
try {
this.recorder = new Recorder({
encoderPath: '/assets/recorder/encoderWorker.min.js'
});
} catch (err) {
console.warn('Recording is not supported');
this.canRecord = false;
}
}
constructor(props: IFileElementComponent) {
super(props);
this.canRecord = Recorder.isRecordingSupported();
try {
this.recorder = new Recorder({
encoderPath: '/assets/recorder/encoderWorker.min.js'
});
} catch (err) {
console.warn('Recording is not supported');
this.canRecord = false;
}
}