RecordRTC Error: MediaRecorder API seems unable to record mimeType: audio/wav

2.1k Views Asked by At

MediaRecorder API seems unable to record mimeType: audio/wav getting this error although I'm giving the type as audio/wav below is the code i'm trying to implement, actually I'm trying to record my voice and upload it to server for which i need to send in wave PCM format but in the browser console it show me this below image warning.

startRecording() {
  const mediaConstraints = {
    audio: true
  };
  navigator.mediaDevices
    .getUserMedia(mediaConstraints)
    .then(this.successCallback.bind(this));
}

successCallback(stream: MediaStream) {
  const options = {
    mimeType: 'audio/wav'
      };
      this.stream = stream;
      this.recordRTC = RecordRTC(stream, options);
      this.recordRTC.startRecording();
}

stopRecording() {
  const recordRTC = this.recordRTC;
  recordRTC.stopRecording(this.processVideo.bind(this));
  const stream = this.stream;
  stream.getAudioTracks().forEach(track => track.stop());
  stream.getVideoTracks().forEach(track => track.stop());
}

processVideo(audioVideoWebMURL) {
  const recordRTC = this.recordRTC;
  const recordedBlob = recordRTC.getBlob();     
}

here is the console report, although i'm able to record but the mimetype of the file is always audio/webm

enter image description here

And also tried passing recordtype as StereoAudioRecorder,but it says in angular Cannot find name 'StereoAudioRecorder', here is screenshot of it.

enter image description here

Please any help on this would be highly appreciated, did try searching a lot but unfortunately dint find any solution for this.

0

There are 0 best solutions below