1.0.1 • Published 8 years ago

screen-record v1.0.1

Weekly downloads
4
License
BSD-3-Clause
Repository
github
Last release
8 years ago

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 DOM window object to use to do screen recording magic (IFRAME insertion, postMessage etc).
  • cb(err, sourceId, constraints) - Callback:
    • err - Error
    • sourceId - The unique webrtc source ID string, that can be passed through a constraints object in getUserMedia to then create a webrtc stream.
    • constraints - Prefilled and ready-to-use getUserMedia constraints object that can be directly used. The sourceId 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