0.0.8 • Published 5 years ago

vue-cam-vision v0.0.8

Weekly downloads
153
License
MIT
Repository
github
Last release
5 years ago

Online : demo

vue-cam-vision

Webcam component for VueJs. See this for browser compatibility.

Installation

npm install vue-cam-vision --save

yarn add vue-cam-vision

Usage

// vue page
<template>
    <WebCam
        ref="webcam"
        :deviceId="deviceId"
        width="auto"
        height="100%"
        @cameras="onCameras"
        @camera-change="onCameraChange"
        :isFrontCam="frontCam"
        :googleKey="googleKey"
        >
    </WebCam>
</template>
import { WebCam } from 'vue-cam-vision'

export default {
  data () {
    return {
      captures: [],
      imgReport: [],
      frontCam: false,
      webcam: null,
      img: null,
      camera: null,
      deviceId: null,
      devices: [],
      googleKey: config.googleVisionKey
    }
  },
  components: {
    WebCam
  }
}

// or
import {WebCam} from 'vue-cam-vision'
Vue.component(WebCam.name, WebCam)

Testing & Dev

npm run dev

Props

proptypedefaultnotes
heightnumber500height of video element
widthnumber500width of video element
autoplaybooleantrueautoplay attribute
screenshotFormatstring'image/jpeg'format of screenshot
deviceIdstringnullcurrently selected camera
googleKeystringnullGOOGLE VISION API KEY

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

Methods

nameparamnotes
capturevoidCapture the current image through the webcam as base64 encoded string
changeCameradeviceIdchange the currently selected camera. Must pass in the device ID
startvoidProgramatically Start the camera after stopping it (relies on deviceId prop passed to the component)
stopvoidProgramatically stop the camera

License

MIT

Credits

This is based off VinceG vue-web-cam @smronju vue-webcam and react-webcam

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago