# @paxapos/av-inputs

> Stencil Component Input webcam

Latest version **2.1.2** (published 2025-10-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install @paxapos/av-inputs
pnpm add @paxapos/av-inputs
yarn add @paxapos/av-inputs
bun add @paxapos/av-inputs
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; large bundle.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 2.1.2 |
| Published | 2025-10-31 |
| First published | 2023-09-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 66.9 MB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | alevilar |
| Maintainers | soyalevilar |
| Keywords | stencil, web-components, face-detection, webcam, barcode-scanner, mediapipe, tensorflow, computer-vision |

## Links

- npm: https://www.npmjs.com/package/@paxapos/av-inputs
- Repository: https://github.com/alevilar/av-inputs
- Homepage: https://github.com/alevilar/av-inputs#readme
- Issues: https://github.com/alevilar/av-inputs/issues
- npm.io page: https://npm.io/package/@paxapos/av-inputs

## Dependencies (6)

- [uuid](https://npm.io/package/uuid.md) 11.1.0
- [@stencil/core](https://npm.io/package/@stencil/core.md) 4.31.0
- [@zxing/library](https://npm.io/package/@zxing/library.md) ^0.21.3
- [@tensorflow/tfjs](https://npm.io/package/@tensorflow/tfjs.md) 4.22.0
- [ml-distance-euclidean](https://npm.io/package/ml-distance-euclidean.md) ^2.0.0
- [@mediapipe/tasks-vision](https://npm.io/package/@mediapipe/tasks-vision.md) 0.10.21

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 2.1.2 (latest) — 2025-10-31
- 2.1.1 — 2025-10-31
- 2.1.0 — 2025-08-22
- 2.0.0 — 2025-08-20
- 1.0.14 — 2025-08-17
- 1.0.13 — 2025-08-17
- 1.0.12 — 2025-05-24
- 1.0.11 — 2024-11-29
- 1.0.10 — 2024-11-29
- 1.0.9 — 2023-09-28
- 1.0.8 — 2023-09-28
- 1.0.7 — 2023-09-28
- 1.0.6 — 2023-09-28
- 1.0.5 — 2023-09-22
- 1.0.4 — 2023-09-22
- … 2 more at https://npm.io/package/@paxapos/av-inputs/versions

## README

# AV-Inputs - Professional Web Components Library

A high-performance StencilJS library providing optimized web components for camera, barcode scanning, and data input operations. Built for production environments with focus on performance, reliability, and cross-browser compatibility.

## 🎯 Components Overview

### 📷 input-barcode
**Camera-based barcode/QR scanner**
- Uses device camera for real-time scanning
- Supports 17+ barcode formats (QR, Code128, EAN, UPC, etc.)
- Optimized for continuous scanning with duplicate prevention
- Perfect for: POS systems, inventory management, product lookup

### ⌨️ input-scan-reader  
**Hardware barcode scanner input**
- Captures input from physical barcode scanners (HID keyboard devices)
- Intelligent text processing for documents (DNI, licenses)
- Background operation without UI interference  
- Perfect for: Dedicated scanner setups, access control, document verification

### 🤖 input-face-api-webcam
**AI-powered face detection & recognition**
- Real-time face detection using MediaPipe/TensorFlow.js
- Custom face recognition with trained models
- Auto photo capture with confidence thresholds
- Perfect for: Employee attendance, access control, ID verification

### 📸 input-file-from-webcam
**Simple webcam photo capture**
- Streamlined photo capture with one click
- Front/back camera switching
- Custom image processing support
- Perfect for: Employee check-ins, profile photos, quick documentation

## 🔧 Key Differences

| Feature | input-barcode | input-scan-reader | input-face-api-webcam | input-file-from-webcam |
|---------|---------------|-------------------|----------------------|----------------------|
| **Input Method** | Camera scanning | Hardware scanner | AI face detection | Camera photo |
| **Processing** | Real-time decode | Keyboard events | Neural networks | Simple capture |
| **Performance** | Medium CPU | Minimal CPU | High CPU | Low CPU |
| **Use Case** | Mobile/tablet scanning | Fixed scanner stations | Security/attendance | Quick photos |

## ⚡ Performance Features

- **Memory efficient**: Automatic cleanup and resource management
- **Web Workers**: Heavy computations don't block UI
- **Optimized scanning**: Intelligent duplicate prevention and timeouts  
- **Error recovery**: Robust error handling with automatic restart
- **Cross-platform**: Works on desktop, mobile, and tablets

## 🚀 Quick Start

```html
<!-- Camera barcode scanning -->
<input-barcode 
  facing-mode="environment" 
  width="400px" 
  height="300px">
</input-barcode>

<!-- Hardware scanner input -->
<input-scan-reader 
  scan-title="Scan ID Card"
  modal-timer="2000">
</input-scan-reader>

<!-- Face detection -->
<input-face-api-webcam 
  auto-capture="true"
  score-threshold="0.8">
</input-face-api-webcam>

<!-- Simple photo capture -->
<input-file-from-webcam 
  auto-start="true"
  image-quality="0.9">
</input-file-from-webcam>
```





```js
const elInputFileFromWebcam = document.getElementById("my-input");
    elInputFileFromWebcam.addEventListener("click", (ev) => {

    elInputFileFromWebcam.takePic().then( (pic) => console.info("here is your picture", pic))
});
```


# Properties

## width 
defaults to 460px
in canvas you must set always the width

## height 
defaults to 460px
in canvas you must set always the height

## facing-mode 
we uses "user" or "environment" but you have others. If you don't write this property. the element will change facinbg Mode each time you click the element

For more FacingModel optiones you cant read here https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints/facingMode#value

## callback for drawing on canvas 
you can override the default behaviour by adding a callback function here.
if you put something here. will execute this function for doing a canvas.drawImage

you must call 
ctx.drawImage(this.elVideo, left, top, imgSize, imgSize, 0,0, this.canvas.width, this.canvas.height)
inside your function

we are just bypassing the callback function

```js
let ctx = this.canvas.getContext('2d');
functionCallback.call(ctx, elVideo, left, top, imgSize, imgSize, 0,0, this.canvas.width, this.canvas.height);
```js


# Methods

## takePic
you can easily take a picture by calling this method in your element

```js
    elInputFileFromWebcam.takePic().then( (pic) => console.info("here is your picture", pic))
```


## toggleCamera
Change front or back camera

```js
    elInputFileFromWebcam.toggleCamera()
```



# Events

## pictureTaken
returns a File

```js
    elInputFileFromWebcam.addEventListener("pictureTaken", (pic) => console.info("here is my pic from callback", pic))
```



## facingModeChanged
returns a ConstrainDOMString each time a FacingModel was changed
```js
    elInputFileFromWebcam.addEventListener("facingModeChanged", (fm) => console.info("here is your facing Mode now", fm))
```

---
_Source: https://npm.io/package/@paxapos/av-inputs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
