Skip to content
jQuery plugin for playing/stopping a webcam in a canvas with image capture
JavaScript HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Initial commit Feb 8, 2018
LICENSE Initial commit Feb 8, 2018
README.md Update README.md Feb 8, 2018
index.html Update example Feb 8, 2018
package-lock.json removed http-server Feb 8, 2018
package.json
video2image.js Initial commit Feb 8, 2018

README.md

Video2Image

jQuery plugin for viewing/playing/stopping a webcam with image capture

This plugin requires jQuery

Video capture may not work in all browsers

Do not try to run locally, browser permissions require running with web server only

Package Manager

This plugin can be downloaded using npm

npm install jquery-video2image

Usage

selector should be a <canvas> element you have added to the page.

<canvas id="photocanvas" width="320" height="240"></canvas>

Initialize

$("#photocanvas").video2image();

Initialize with options

$(selector).video2image({
  width : 320,
  height : 240,
  autoplay : true,
  onsuccess : function () {},
  onerror: function () {}
});

Find out if your browser supports this

Returns true or false

var isSupported = $(selector).video2image('isSupported');

To get a PNG DataURL from the canvas

Returns an image/png in base64

var dataurl = $(selector).video2image('capture');

To Stop the video

$(selector).video2image('stop');

To start/restart the video

$(selector).video2image('start');

You can’t perform that action at this time.