Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
headers,
method: 'POST',
body: recordedBlob
};
const response = await fetch(`${environment.serverUrl}/uploadSpeech`, requestParams);
const searchTerms = await response.json();
this.movieSearch(searchTerms);
});
}
this.isRecording = false;
} else {
this.isRecording = true;
const stream = await navigator.mediaDevices.getUserMedia({video: false, audio: true});
const options = {
mimeType: 'audio/wav',
recorderType: RecordRTC.StereoAudioRecorder
};
this.recorder = RecordRTC(stream, options);
this.recorder.startRecording();
}
}
successCallback(stream) {
var options = {
mimeType: "audio/wav",
numberOfAudioChannels: 1
};
//Start Actuall Recording
var StereoAudioRecorder = RecordRTC.StereoAudioRecorder;
this.record = new StereoAudioRecorder(stream, options);
this.record.record();
}
navigator.getUserMedia({ audio: true, video: false }, (stream) => {
recorder = new RecordRTC(stream, {
recorderType: RecordRTC.StereoAudioRecorder,
type: 'audio',
audioType: 'audio/wav',
mimeType: 'audio/wav',
sampleRate: 44100,
numberOfAudioChannels: 1,
});
recorder.setRecordingDuration(DURATION).onRecordingStopped(() => {
dispatch(stopRecording());
});
recorder.startRecording();
}, () => {
dispatch(openAlert('cannotActivateMicrophone'));