Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including soundrecorder with all npm packages installed. Try it out:

var soundrecorder = require("soundrecorder")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

soundrecorder v0.0.3

A web sound recorder base on h5 api

SoundRecorder

SoundRecorder is a website sound recorder SDK base on h5 api.

  • Sdk-based Base on some h5 api, such as mediaStream, mediaRecorder, audioContext
  • browser supprot: It just build for PC website record, this sdk is unsupport for h5

Installation

SoundRecorder build by umd, you can use it by 2 ways:

  • just append the <script src="/dist/soundRecorder.min.js"></script> tag into the html.
  • or you can import soundrecorder in to your js.

Usage

SoundRecorder is very easy to use, You can read the full demo here or read the code

  // 1. instance the SoundRecorder
  var sr = new SoundRecorder() 

  // 2. start
  sr.start()

  // 3. stop
  sr.stop()

  // 4. get the recorded file
  var blob = sr.getBlob()
  console.log(blob)

Documentation

there the methods of SoundRecorder instance

startRecord(options)
type: Function
args: options
default: {}
description: start mediaRecorder


stopRecord
type: Function
args: options
default: {}
description: stop mediaRecorder


getBlob
type: Function
args: options
default: {}
description: get recorded blob, the blob is build by all chunks


on(String, Function)
type: Function
args: options
default: {}
description: add the event listener callback

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free