0.3.1 • Published 7 years ago

media-bits-recorder v0.3.1

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

media-bits-recorder

Build Status

This package is to extract bits from the video/audio device on the client side.

Install

npm install --save media-bits-recorder

Import to your project

There are two ways to import MediaBitsRecorder.

adapter.js shim

It is strongly recommended to add the adapter.js shim.

<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>

Script tag

<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
<script src="./node_modules/media-bits-recorder/dist/out.js"></script>
<script>
  // MediaBitsRecorder available here!
</script>

Browsify/Webpack

var MediaBitsRecorder = require('media-bits-recorder');

Or in ES6:

import MediaBitsRecorder from 'media-bits-recorder';

Usage

After importing the package, you could simply interact with the apis.

var recorder = new MediaBitsRecorder({video: true, audio: false});

recorder.on('audio', function(bits){
  // this event is triggered every `interval`(500) ms
  console.log(bits); // "011010101001010..." as a string
});

recorder.on('video', function(bits){
  // this event is triggered every `interval`(500) ms
  console.log(bits); // "011010101001010..." as a string
});

...

// trigger the on event every 500 ms
var interval = 500;
recorder.start(interval);

...

// never trigger on event until stop
recorder.start();

...

// trigger the on video/audio event
recorder.stop();

Testing

npm test

Live example

npm install
npm run build:example
PORT=8000 npm start

Open your browser: http://localhost:8000

Author

Jaosn Yu

0.3.1

7 years ago

0.3.0

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago