simple-webrtc
A simple WebRTC and MediaRecorder wrapper.
Installation
npm install --save simple-webrtc
Usage
Initialization
var SimpleWebRtc = require('simple-webrtc');
var webRtc = SimpleWebRtc(rtcConfiguration, mediaConstraints);
Checking if the browser supports getUserMedia
console.log(webRtc.hasUserMedia);
// true or false, depending on wether
// the browser supports any form of getUserMedia
Checking if the browser supports MediaRecorder
console.log(webRtc.hasMediaRecorder);
// true or false, depending on wether
// the browser supports MediaRecorder
Checking if there is a camera
webRtc.hasCamera()
.then(function(hasCamera) {
console.log(hasCamera);
// true or false, depending on wether
// there is a camera or not
});
Creating a peer connection
var connection = webRtc.createConnection();
Creating a media recorder
var recorder = webRtc.createRecorder(constraints);