Recorder is a free, open source browsers & extensions project written in JavaScript and released under MIT. It has 5,633 GitHub stars, 1,096 forks and 136 open issues, and was last pushed 2 months ago. On this registry it ranks #57 of 101 tracked projects in Browsers & Extensions, with 5 head-to-head comparisons available.

What is Recorder?

Recorder is an MIT-licensed JavaScript library for HTML5 microphone recording that captures audio from any MediaStream and transcodes it into mp3, wav, ogg, webm, amr, g711a, or g711u, aimed at front-end, hybrid-app, and mini-program developers who need recording, format conversion, or speech recognition inside a web page.

What it is

Recorder lives in the browser JavaScript and web audio ecosystem. It is distributed as repository source plus a hosted demo rather than as a packaged application, and it sits directly on the getUserMedia API and on any other MediaStream object a page can obtain. The library supplies the recording and transcoding layer that a project would otherwise have to build itself: browser capture, format encoding, real-time streaming, and playback helpers all arrive in one set of JavaScript files. Its companion, RecordApp, extends the same model into WeChat mini programs and uni-app, where getUserMedia is not available at all.

The concrete problem is that browsers do not agree on what they can record. Chrome, Firefox, and Safari expose different codecs and containers, the Tencent X5 kernel used by QQ and WeChat behaves differently again, and iOS only reached getUserMedia in Safari from version 14.3 onward. Recorder normalises that situation by encoding captured buffers into a chosen output format, with mp3 as the default, and by offering real-time transcoding and transfer so audio can be sent to a server while recording continues. It also addresses memory pressure during long sessions through onProcess, which releases processed data instead of holding the entire recording.

Key capabilities

  • Records from any MediaStream, including streams returned by getUserMedia, WebRTC remote streams, streams from the captureStream method on audio and video tags, and streams created by the page itself.
  • Encodes to mp3 by default, with wav, pcm, g711a, g711u, ogg, amr, and beta-stage webm as alternatives, and supports custom formats when a matching encoder is supplied.
  • Ships two builds with different footprints: recorder.mp3.min.js at 150kb for mp3 and recorder.wav.min.js at 25kb for wav, both with real-time transcoding and real-time transfer.
  • Converts already recorded buffers or arbitrary pcm data into another format through the rec.mock method.
  • Supports real-time processing and playback through plugins, including BufferStreamPlayer for segmented audio playback, audio visualisation, speed and pitch adjustment, and speech recognition.
  • Handles DTMF encoding and decoding, and ships a working H5 voice call and chat example.
  • Runs partly outside the browser in environments such as nodejs, and runs in WeChat mini programs and uni-app through RecordApp.

Who uses it and how

  • Teams building mobile web recording inside WeChat, QQ, or a mini-program WebView, where the X5 kernel and the absence of getUserMedia in mini programs would otherwise block capture.
  • Hybrid app developers who need Android and iOS builds; the repository includes Android and iOS app source, WeChat mini program source, and uni-app source under app-support-sample.
  • Applications that need live transcription, using the real-time ASR tutorials that stream encoded audio toward speech recognition services as recording proceeds.
  • Desktop and Electron applications that capture audio and video playback streams, using the captureStream tutorials for visualisation and processing.
  • Long-running voice capture, where continuous sessions rely on onProcess to keep memory under control.

Getting started

The README describes no package manager or container image. The stated path is to download the repository source and open the html files locally, or to use the hosted copy at https://xiangyuecn.github.io/Recorder/, then include recorder.mp3.min.js or recorder.wav.min.js in the page.

How it compares

No similar tools are named in the facts, and no list of paid products it replaces is provided, so this project stands alone in this registry for the capabilities recorded here.

When to use it — and when not to

Recorder supports mono only; stereo is not adapted, which rules it out for music or multi-channel capture. Browser support has real gaps, notably older domestic Android browsers and iOS 11.0 to 14.2 outside Safari, and the repository carries 136 open issues. There is also no server component: upload handling, file storage, and playback hosting remain the integrator's responsibility, and the documentation and issue tracker are primarily in Chinese.

project readme (upstream, from github) — read inline

源GitHub仓库】 | 【Gitee镜像库】本文档中默认使用github.io部署的链接,如果无法访问,请直接下载仓库源码到本地然后双击打开html文件访问。

:open_book:Recorder用于html5录音

支持在大部分已实现getUserMedia的移动端、PC端浏览器麦克风录音、实时处理,主要包括:Chrome、Firefox、Safari、iOS 14.3+、Android WebView、腾讯Android X5内核(QQ、微信、小程序WebView)、Electron、大部分2021年后更新的Android手机自带浏览器、2024年后更新的Android版UC内核(UC、支付宝、钉钉);不支持:老旧国产手机自带浏览器、老旧iOS(11.0-14.2)上除Safari外的其他任何形式的浏览器

支持在非浏览器环境中使用部分功能(如nodejs、各种使用js来构建的程序),使用RecordApp可在微信小程序、uni-app中直接录音。

支持对任意MediaStream进行音频录制、实时处理,包括:getUserMedia返回的流WebRTC中的remote流audio、video标签的captureStream方法返回的流自己创建的流 等等。

提供多个插件功能支持,拥有丰富的音频可视化、变速变调处理、语音识别、音频流播放等;搭配上强大的实时处理支持,可用于各种网页应用:从简单的录音,到复杂的实时语音识别(ASR),甚至音频相关的游戏,都能从容应对;提供转码支持,允许将录制的buffers数据或任意pcm数据转码成你需要的格式(参考rec.mock方法)。

主要用于语音录制,因此仅对单声道进行支持(未适配双声道),支持超长时间录音(参考onProcess实时清理释放内存);默认输出mp3格式,另外可选wav、pcm、g711a、g711u、ogg、amr、webm(beta)格式,支持任意格式扩展(前提有相应编码器);使用recorder.mp3.min.js(150kb)即可录制mp3,使用recorder.wav.min.js(25kb)即可录制wav;均支持实时转码和实时传输。

音频文件的上传和播放:可直接使用常规的Audio HTML标签来播放完整的音频文件,参考文档下面的【快速使用】部分,有上传和播放例子;上传了的录音直接将音频链接赋值给audio.src即可播放;本地的blob音频文件可通过URL.createObjectURL来生成本地链接赋值给audio.src即可播放,或者将blob对象直接赋值给audio.srcObject(兼容性没有src高)。实时的音频片段文件播放,可以使用本库自带的BufferStreamPlayer插件来播放,简单高效,或者采用别的途径播放。

如需录音功能定制开发,网站、App、小程序、前端后端开发等需求,请加本文档下面的QQ群,联系群主(即作者),谢谢~

Recorder H5 : [ H5在线测试 ] [ H5 QuickStart ] [ H5 vue ] [ H5 ts ] [ H5 es module ] [ 旧版本测试 ]

Recorder App : [ RecordApp测试 ] [ App QuickStart ] [ App vue ] [ Android、iOS App源码 ] [ 微信小程序源码 ] [ uni-app源码 ]

工具集 : [ Recorder代码运行和静态分发 ] [ PCM转WAV播放测试和转码 ] [ 无用户操作测试 ] [ Can I Use查看浏览器支持情况 ]

手机浏览器扫一扫在线测试

Demo片段列表

  1. 【教程】【PCM基础】buffers转pcm、转采样率、改音量、pcm合并转mp3等格式
  2. 【教程】【音频流】【上传】实时转码上传-实时帧回调版
  3. 【教程】【音频流】【上传】实时转码上传-pcm固定帧大小
  4. 【教程】【音频流】【上传】实时转码上传-通用转码旧版
  5. 【教程】【音频流】【播放】实时解码播放音频片段
  6. 【教程】【播放】【可视化】实时录制处理audio、video播放流
  7. 【教程】【ASR】实时语音识别、音频文件转文字-阿里云版
  8. 【Demo库】【格式转换】-mp3等格式解码转成其他格式
  9. 【Demo库】【格式转换】-wav格式转成其他格式
  10. 【Demo库】【格式转换】-amr格式转成其他格式
  11. 【Demo库】【文件合并】-mp3多个片段文件合并
  12. 【Demo库】【文件合并】-wav多个片段文件合并
  13. 【教程】实时多路音频混音
  14. 【教程】变速变调音频转换
  15. 【教程】新录音从老录音接续、或录制中途插入音频
  16. 【教程】DTMF(电话拨号按键信号)解码、编码
  17. 【测试】PCM采样率转换测试
  18. 【Demo库】【信号处理】IIR低通、高通滤波
  19. 【测试】【信号处理】FFT频域分析ECharts频谱曲线图
  20. 【测试】WebM格式解析并提取音频
  21. 【测试】G711、G72X编码和解码播放
  22. 【Demo库】js二进制转换、基础知识-Base64/Hex/Int16Array/ArrayBuffer/Blob
  23. 【测试】音乐合成-用波形函数将歌曲简谱文本转成PCM
  24. 【测试】音频可视化相关插件测试

App Demo

Android Demo App : 下载APK(40kb,删除.zip后缀, 源码

iOS Demo App :下载源码 自行编译

【QQ群】交流与支持

欢迎加QQ群:①群 781036591、②群 748359095、③群 450721519、④群 1027243616,纯小写口令:recorder

Recorder logo

Stars Forks npm Downloads npm Version License JsDelivr CDN unpkg CDN 51LA

:open_book:快速使用

你可以通过阅读和运行QuickStart.html文件来快速入门学习,直接将QuickStart.htmlcopy到你的(https、localhost)网站中,无需其他文件,就能正常开始测试了;注意:需要在https、localhost等安全环境下才能进行录音。

https环境搭建最佳实践:建议给自己的域名申请一个泛域名通配符证书(*.xxx.com),然后线上、本地开发均可使用此证书;本地开发环境直接分配一个三级域名(dev.xxx.com、local.xxx.com、192-168-1-123.xxx.com)解析A记录到电脑局域网的IP地址(192.168.1.123、127.0.0.1),方便本地开发跨端调试(本地如何配置https请针对自己的开发环境自行搜索,很容易)。

获取泛域名通配符证书推荐:在线免费申请(ZeroSSL、Let’s Encrypt);不建议自己生成根证书来签发域名证书,一个是流程复杂,每个设备均要导入根证书,致命的是很多现代浏览器不再信任用户目录下导入的根证书(Android)。

如果必须http访问,Chrome中可尝试打开chrome://flags/#unsafely-treat-insecure-origin-as-secure,启用`Insecure origins tre

readme truncated — read the full docs on github

Frequently asked questions

Is Recorder free to use?

Recorder is open source under the MIT licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does Recorder do?

html5 js 录音 mp3 wav ogg webm amr g711a g711u 格式,支持pc和Android、iOS部分Web浏览器、Hybrid App(提供Android iOS App源码)、微信,提供ASR语音识别转文字 H5版语音通话聊天示例 DTMF编码解码

What is Recorder written in?

Recorder is primarily written in JavaScript. Its source is publicly available at https://github.com/xiangyuecn/Recorder, and it has 5,633 GitHub stars.