screen-record
v1.0.1
Published
Capture desktop video using webrtc
Downloads
7
Maintainers
Readme
screen-record
Capture desktop video using webrtc
Installation
This client-side module is installed via npm:
$ npm install screen-record
It is a client-side browser that gives desktop recording capabilities to Chrome when this Chrome Extension is installed.
Example Usage
var screenRecord = require('screen-record'),
getUserMedia = require('getusermedia');
screenRecord(window, (err, sourceId, constraints) => {
if (err) throw err;
getUserMedia(constraints, function (err, stream) {
if (err) throw err;
// now have a webRTC stream of the desktop
})
});
API
screenRecord([window], cb(err, sourceId, contraints))
Asks the Chome Extension to ask the user to authorize and pick a window or the whole desktop to record.
window
- Optional DOMwindow
object to use to do screen recording magic (IFRAME
insertion,postMessage
etc).cb(err, sourceId, constraints)
- Callback:err
- ErrorsourceId
- The unique webrtc source ID string, that can be passed through a constraints object ingetUserMedia
to then create a webrtc stream.constraints
- Prefilled and ready-to-usegetUserMedia
constraints object that can be directly used. ThesourceId
is already correctly populated.
Acknowledgements
This is a simple commonjs adaptation of the code originally created by @muaz-khan and is designed to work with this Chrome Extension
The original code can be found here
License
As per the original license, this is licensed under the MIT License