Home

Awesome

<p align="center"> <img width="150" src="assets/logo.png"> </p> <p align="center"> <img src="assets/splash.png"> </p>

vue-web-cam

npm npm Contributions welcome License

Webcam component for VueJs. See this for browser compatibility.

Installation

npm install vue-web-cam --save
// or
yarn add vue-web-cam

Usage

import Vue from 'vue'
import WebCam from "../../src";
Vue.use(WebCam);


<vue-web-cam ... />

// or
import { WebCam } from "vue-web-cam";

components: {
    WebCam
}

<web-cam ... />

components: {
    'vue-web-cam': WebCam
}

<vue-web-cam ... />

Nuxt.js

Add vue-web-cam/nuxt to modules section of nuxt.config.js

{
  modules: ['vue-web-cam/nuxt']
}

Testing & Dev

npm run dev

Props

proptypedefaultnotes
heightnumber500height of video element
widthnumber500width of video element
autoplaybooleantrueautoplay attribute
screenshotFormatstring'image/jpeg'format of screenshot
selectFirstDevicebooleanfalseselect first device when avaialble
deviceIdstringnullcurrently selected camera
playsinlinebooleantrueplaysinline of video element
resolutionobjectnullobject with width and height for camera resolution

Events

nameparamnotes
startedstreamemitted once the stream has started
stoppedstreamemitted once the stream has stopped
errorerroremitted if the stream failed to start with the error returned
notsupportederroremitted when the browser does not support this feature
camerascamerasemitted when a list of all cameras available is loaded
camera-changedeviceIdemitted when camera change occurs
video-livestreamemitted when video is started

Methods

nameparamnotes
capturevoidCapture the current image through the webcam as a base64 encoded dataUri
changeCameradeviceIdchange the currently selected camera. Must pass in the device ID
startvoidProgrammatically Start the camera after stopping it (relies on deviceId prop passed to the component)
stopvoidProgrammatically stop the camera
pausevoidProgrammatically pause the camera
resumevoidProgrammatically resume the camera after it was paused

Contributing

If you'd like to help make this project better you can help with the following tasks:

License

MIT

Credits

This is based off @smronju vue-webcam and react-webcam