Giter Club home page Giter Club logo

mgechev.jscapture's Introduction

Warning!

JSCapture won't work in Chrome 37+ due to removal of the experimental desktop sharing API.

JSCapture

JSCapture is screen capturing library implemented with pure JavaScript and HTML5.

It allows you to make screenshots and record a video of your desktop from your browser.

How to use

JSCapture uses getUserMedia for screen capturing. Currently the API for screen capturing is supported only by Google Chrome, Canary and Chromium by enabling an experimental flag.

In order to enable the flag:

  • Go to chrome://flags/#enable-usermedia-screen-capture
  • Enable - "Enable screen capture support in getUserMedia()"
  • Restart your browser.

When you're done and you open chrome://flags/#enable-usermedia-screen-capture, you should see something like:

Chrome flags

Note that you MUST use https in order to be allowed to do screen recording. Since there are some very expensive operations happening when each frame is being captured the video won't be useful when you're capturing a high resolution. In order to handle this issue use the scale property.

API

  • JSCapture.capture(config) - Captures a new screenshot.
    • config.x - (Number) default value 0. Specifies the left offset.
    • config.y - (Number) default value 0. Specifies the top offset.
    • config.width - (Number) default value the screen width. Specifies the width of the screenshot.
    • config.height - (Number) default value the screen height. Specifies the height of the screenshot.
    • config.process - (Function|Array) default value an empty array. A list of filters, which are going to process the image.
    • config.done - (Function) default value is undefined. Callback, which is being called with the captured image.
    • config.fail - (Function) default value is undefined. A callback, which is being executed on unsuccessful screen capturing (for example if the user does not allow screen capturing).
    • config.delay - (Number) default value 0. Specifies the delay after each the screenshot will be captured.
  • JSCapture.record(config) - Capture a video.
    • config.x - (Number) default value 0. Specifies the left offset.
    • config.y - (Number) default value 0. Specifies the top offset.
    • config.width - (Number) default value the screen width. Specifies the width of the video.
    • config.height - (Number) default value the screen height. Specifies the height of the video.
    • config.process - (Function|Array) default value an empty array. A list of filters, which are going to process the individual frames.
    • config.done - (Function) default value is undefined. Callback, which is being called with the captured video.
    • config.delay - (Number) default value 0. Specifies the delay after each the video will be captured.
    • config.frameRate - (Number) default value 60 frames per second. Specifies the number of frames per second.
    • config.done - (Function) default value is undefined. A callback, which accepts the video (as a Blob), result of the screen recording, as an argument
    • config.fail - (Function) default value is undefined. A callback, which is being executed on unsuccessful screen recording (for example if the user does not allow screen capturing).
    • config.duration - (Number) default is Infinity. A number which indicates the length of the video.
  • JSCapture.stopRecording(fn) - Stops the video recording.
    • fn - (Function) default value is undefined. A callback, which accepts the video (as a Blob), result of the screen recording, as an argument. Note that the callback provided in config.done won't be invoked if JSCapture.stopRecording(fn) is called.
  • JSCapture.isRecording() - (Boolean) Returns whether the screen recording have been started.

Demo

Here

Contributors

mgechev jbrooksuk themgt hemanth
mgechev jbrooksuk themgt hemanth

License

This software is distributed under the terms of the MIT license.

mgechev.jscapture's People

Contributors

mgechev avatar jbrooksuk avatar themgt avatar hemanth avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.