1.9.0 • Published 4 years ago

vue-web-cam v1.9.0

Weekly downloads
2,749
License
MIT
Repository
github
Last release
4 years ago

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 base64 encoded string
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:

  • Tests - This project needs a way to test the functionality using a javascript testing solution (Jest as an example)
  • Examples - Additional Examples of usage might be helpful to others.
  • Project Website - Perhaps launch a project website (on Github Pages) that'll showcase the plugin, Demo, Usage instructions, configuration etc..

License

MIT

Credits

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

1.9.0

4 years ago

1.8.0

5 years ago

1.7.1

5 years ago

1.7.0

5 years ago

1.6.0

5 years ago

1.5.1

5 years ago

1.5.0

5 years ago

1.4.4

5 years ago

1.4.3

5 years ago

1.4.2

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.0

6 years ago

1.2.5

6 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago