Search code examples
audiocompressionwebrtcrecording

Record short audio file using WebRTC


In online social learning app, we want participants to be able to record short audio clips to share with others. Typically a recording will be a spoken word or a single sentence.

I've been looking at WebRTC. I understand how to create and share an audio stream. However, we want the participant to be able to start the recording manually, and to stop it when it's complete (or after 15 seconds if that is sooner). Ideally, we want to compress the resulting file to save bandwidth, and upload it to a database.

Can anyone recommend any tutorials on how to do this?


Solution

  • Maybe RecordRTC help you. https://webrtc-experiment.appspot.com/RecordRTC/

    Try this demo:

    https://github.com/muaz-khan/WebRTC-Experiment/tree/master/AudioVideoRecorder

    In the demo; MediaRecorder API is used to record audio streams. It is exactly what you want; however current support is Firefox Nightly (only).

    Chrome team also started discussing possible scenarios; and impacts. They'll implement MediaRecorder API soon.