js中 webm 转 wav 或其他格式
webm to wav
js webm to wav
“Recording audio in the same format across browsers is annoying, especially if you want the audio files sent to a backend.
Converting to a consistent audio format on the frontend before sending to the backend is a good solution. This is how Facebook Messenger and WhatsApp do their voice recording on the web.
WhatsApp on Web convert the recorded data to an OGG format from inside a WebWorker. They use a library similar to opus.js-sample to do it – this means both Chrome, Firefox and other browsers can then use ogg.
They also access the microphone raw data similary to this article by Google developers. This uses the AudioContext API which is part of the Web Audio API, this means they can also add effects and filters before creating the output. I noticed they added a Butterworth Filter which I believe reduces background noise from the recording.
用Web Audio API的话，则就是用：AudioContext API
<code> Recording... Audio context set up. navigator.getUserMedia available. No live audio input: SecurityError: Only secure origins are allowed (see: https://goo.gl/Y0ZkNV). Stopped recording. </code>
<code>Audio context set up. navigator.getUserMedia available. No live audio input: NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission. </code>