# vue-cam-vision

> Vuejs Webcam component (fork from https://github.com/vinceg/vue-web-cam) with get user media / google imagecapture / google vision api

Latest version **0.0.8** (published 2019-01-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install vue-cam-vision
pnpm add vue-cam-vision
yarn add vue-cam-vision
bun add vue-cam-vision
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.8 |
| Published | 2019-01-18 |
| First published | 2019-01-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 8.10.0 |
| Dependencies | 2 |
| Unpacked size | 2 MB |
| Known vulnerabilities | 0 (+25 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 16 |
| Author | Kelvin Ho |
| Maintainers | kelvin2go |
| Keywords | vuejs, web, cam, getusermedia, google, vision, api |

## Links

- npm: https://www.npmjs.com/package/vue-cam-vision
- Repository: https://github.com/kelvin2go/vue-cam-vision
- Homepage: https://github.com/kelvin2go/vue-cam-vision#readme
- Issues: https://github.com/kelvin2go/vue-cam-vision/issues
- npm.io page: https://npm.io/package/vue-cam-vision

## Dependencies (2)

- [vue](https://npm.io/package/vue.md) ^2.5.17
- [axios](https://npm.io/package/axios.md) ^0.18.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.0.8 (latest) — 2019-01-18
- 0.0.7 — 2019-01-17
- 0.0.6 — 2019-01-17
- 0.0.5 — 2019-01-17
- 0.0.4 — 2019-01-08
- 0.0.3 — 2019-01-06
- 0.0.2 — 2019-01-06
- 0.0.1 — 2019-01-05

## README

Online : [demo](https://kelvinho.js.org/vue/vue-cam-vision/)
<p align="center">
    <img src="assets/demo.png">
</p>

# vue-cam-vision

<!-- [![npm](https://img.shields.io/npm/v/vue-web-cam.svg)](https://www.npmjs.com/package/vue-web-cam)
[![npm](https://img.shields.io/npm/dm/vue-web-cam.svg)](https://www.npmjs.com/package/vue-web-cam)
![Contributions welcome](https://img.shields.io/badge/contributions-welcome-orange.svg)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT) -->

Webcam component for VueJs. See [this](http://caniuse.com/#feat=stream)
for browser compatibility.


## Installation

```
npm install vue-cam-vision --save

yarn add vue-cam-vision
```

## Usage

```javascript
// 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

| prop             | type    | default      | notes                     |
| ---------------- | ------- | ------------ | ------------------------- |
| height           | number  | 500          | height of video element   |
| width            | number  | 500          | width of video element    |
| autoplay         | boolean | true         | autoplay attribute        |
| screenshotFormat | string  | 'image/jpeg' | format of screenshot      |
| deviceId         | string  | null         | currently selected camera |
| googleKey        | string  | null         | GOOGLE VISION API KEY     |

### Events

| name           | param    | notes                                                         |
| -------------- | -------- | ------------------------------------------------------------- |
| started        | stream   | emitted once the stream has started                           |
| stopped        | stream   | emitted once the stream has stopped                           |
| error          | error    | emitted if the stream failed to start with the error returned |
| notsupported   | error    | emitted when the browser does not support this feature        |
| cameras        | cameras  | emitted when a list of all cameras available is loaded        |
| camera-change  | deviceId | emitted when camera change occurs                             |

### Methods

| name           | param    | notes                                                                   |
| -------------- | -------- | ----------------------------------------------------------------------- |
| capture        | void     | Capture the current image through the webcam as base64 encoded string   |
| changeCamera   | deviceId | change the currently selected camera. Must pass in the device ID        |
| start          | void     | Programatically Start the camera after stopping it (relies on deviceId prop passed to the component)                     |
| stop           | void     | Programatically stop the camera      |

## License

MIT

## Credits

This is based off [VinceG vue-web-cam](https://github.com/VinceG/vue-web-cam)
[@smronju vue-webcam](https://github.com/smronju/vue-webcam) and [react-webcam](https://github.com/mozmorris/react-webcam)

---
_Source: https://npm.io/package/vue-cam-vision · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
