# vue-vision-camera

> Camera component for Vue 3. We can use this component for computer vision tasks like barcode scanning, text recognition, etc.

Latest version **1.2.0** (published 2022-07-11) · MIT license · 8 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score; declining downloads.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2022-07-11 |
| First published | 2022-07-06 |
| Weekly downloads | 8 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 476.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Xu Lihang |
| Maintainers | xulihang |
| Keywords | vue, vuejs, vue-component, dynamsoft, camera, vision, barcode, barcode-reader, qrcode, qrcode-reader, qrcode-scanner, webrtc, getUserMedia |

## Links

- npm: https://www.npmjs.com/package/vue-vision-camera
- Repository: https://github.com/xulihang/vue-vision-camera
- Issues: https://github.com/xulihang/vue-vision-camera/issues
- npm.io page: https://npm.io/package/vue-vision-camera

## Dependencies (2)

- [vue](https://npm.io/package/vue.md) ^3.2.13
- [core-js](https://npm.io/package/core-js.md) ^3.8.3

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2022-07-11
- 1.1.0 — 2022-07-11
- 1.0.0 — 2022-07-07
- 0.1.5 — 2022-07-07
- 0.1.3 — 2022-07-06
- 0.1.2 — 2022-07-06
- 0.1.1 — 2022-07-06
- 0.1.0 — 2022-07-06

## README

Camera component for Vue 3. We can use this component for computer vision tasks like barcode scanning, text recognition, etc.

[Online demo](https://lovely-squirrel-9abb74.netlify.app/)

## Usage

```vue
<VisionCamera 
  :isActive="isActive" 
  :desiredResolution="{width:1280,height:720}"
  desiredCamera="back"
  facingMode="environment"
  @devicesLoaded="devicesLoaded"
  @closed="closed"
  @opened="opened"
>
```

```js
const opened = (cam) => {
  console.log("camera opened");
  //get the inner video element in the opened event
}

const closed = () => {
  console.log("camera closed");
}

const devicesLoaded = (devices) => {
  console.log(devices); // get the list of existing camera devices
}
```

## Installation

```
npm install vue-vision-camera
```

Then import the component to use it.

```js
import { VisionCamera } from 'vue-vision-camera'

export default {
  name: 'App',
  components: {
    VisionCamera
  }
}
```

## Demos

[Barcode Scanner](https://github.com/xulihang/vue-vision-camera/tree/main/example) using [Dynamsoft Barcode Reader](https://www.dynamsoft.com/barcode-reader/overview/)


## FAQ

How to specify which camera to use?

1. Use the `desiredCamera` prop. If one of the camera's name contains it, then it will be used. You can get the devices list in the `devicesLoaded` event.
2. Use the `facingMode` prop. Set it to `environment` to use the back camera. Set it to `user` to use the front camera. Please note that this is not supported on Desktop.

You can use the two props together.

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