Closed shahramSo closed 3 years ago
Tone.Recorder is a very thin wrapper around the MediaRecorder API so it can only support the mime types that the browser supports.
You can check which formats your browser supports using:
MediaRecorder.isTypeSupported('audio/ogg; codecs=opus')
On Chrome this currently produces false
. But looks like opus encoding of a webm wrapper does work: MediaRecorder.isTypeSupported("audio/webm\;codecs=opus")
Thank you for you reply; Yes it's correct, I have already seen that chrome browser doesn't support OGG but when I use the MediaRecorder API like an example which I saw on the Codepen, it looks like works correctly. example link is as follows:
https://codepen.io/jakealbaugh/pen/QVqgBE/?editors=1111
So it can be save the audio files as OGG or Wav with this solution but I don't know the saved file is a real OGG or not.
There is an option of mimeType in Tone.Recorder but when I change it as follows: recorder = new Tone.Recorder({ mimeType: 'audio/ogg; codecs=opus' }); so I get the error like this:
"core.js:6456 ERROR Error: Uncaught (in promise): NotSupportedError: Failed to construct 'MediaRecorder': Failed to initialize native MediaRecorder the type provided (audio/ogg; codecs=opus) is not supported."
It's looks like the Tone.Recorder only suports "webm" mimeType as default.
How to change it? Thanks