All Projects → basst314 → Ngx Webcam

basst314 / Ngx Webcam

Licence: mit
A simple Angular webcam component / pure & minimal, no flash-fallback

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Ngx Webcam

CameraSlider
3D printed and smartphone controlled camera slider
Stars: ✭ 16 (-89.19%)
Mutual labels:  camera, smartphone
Termux Archlinux
You can use setupTermuxArch.bash 📲 to install Arch Linux in Termux on Amazon, Android, Chromebook and Windows. https://sdrausty.github.io/termux-archlinux/
Stars: ✭ 384 (+159.46%)
Mutual labels:  smartphone, tablet
PhoneVR
Use Steam VR-enabled applications with your phone as HMD (Head-mounted display). The only Open-Source solution to similar commercial packages like VRidge, iVRy, Trinus etc etc.
Stars: ✭ 178 (+20.27%)
Mutual labels:  phone, smartphone
rt-mrcnn
Real time instance segmentation with Mask R-CNN, live from webcam feed.
Stars: ✭ 47 (-68.24%)
Mutual labels:  live, webcam
Pi Webcam
Automation to configure a Raspberry Pi as a USB OTG webcam
Stars: ✭ 990 (+568.92%)
Mutual labels:  camera, webcam
MobyDroid
Android Device Manager with a Graphic User Interface (GUI) – Manage Android on Linux, Windows and MacOS.
Stars: ✭ 76 (-48.65%)
Mutual labels:  phone, tablet
mcloud
Mobile farm ecosystem for Android and iOS devices
Stars: ✭ 32 (-78.38%)
Mutual labels:  phone, tablet
react-device-frameset
React device frameset component
Stars: ✭ 30 (-79.73%)
Mutual labels:  phone, tablet
Termuxarch
You can use setupTermuxArch.bash 📲 to install Arch Linux in Amazon, Android, Chromebook and Windows. https://sdrausty.github.io/TermuxArch/docs/install
Stars: ✭ 653 (+341.22%)
Mutual labels:  smartphone, tablet
Cam2ip
Turn any webcam into an IP camera
Stars: ✭ 587 (+296.62%)
Mutual labels:  camera, webcam
TermuxPRoot
SetupTermuxPRoot.sh 📲 shall install Linux distributions in Termux on Android and Chrome. This setup script will attempt to set Linux distributions up in your Termux environment.
Stars: ✭ 59 (-60.14%)
Mutual labels:  tablet, smartphone
Pixelbot
Stars: ✭ 90 (-39.19%)
Mutual labels:  camera, phone
termux-arch
You can use setupTermuxArch.sh 📲 to install Arch Linux in Termux on Android and Chrome. This setup script will attempt to set Arch Linux up in your Termux environment.
Stars: ✭ 25 (-83.11%)
Mutual labels:  tablet, smartphone
jeelizPupillometry
Real-time pupillometry in the web browser using a 4K webcam video feed processed by this WebGL/Javascript library. 2 demo experiments are included.
Stars: ✭ 78 (-47.3%)
Mutual labels:  camera, webcam
Nager.VideoStream
Get images from a network camera stream or webcam
Stars: ✭ 27 (-81.76%)
Mutual labels:  camera, webcam
pattern-lock-js
An android inspired pattern lock in scalable vector graphics and pure javascript
Stars: ✭ 51 (-65.54%)
Mutual labels:  tablet, smartphone
Esp32 Cam Webserver
Expanded version of the Espressif ESP webcam
Stars: ✭ 200 (+35.14%)
Mutual labels:  camera, webcam
Instascan
HTML5 QR code scanner using your webcam
Stars: ✭ 2,657 (+1695.27%)
Mutual labels:  camera, webcam
Showmewebcam
Raspberry Pi + High Quality Camera = High-quality USB Webcam!
Stars: ✭ 531 (+258.78%)
Mutual labels:  camera, webcam
Ros openpose
ROS wrapper for OpenPose
Stars: ✭ 39 (-73.65%)
Mutual labels:  camera, webcam

ngx-webcam npm version Build Status

A simple Angular webcam component. Pure & minimal, no Flash-fallback. See the Demo!

Plug-and-play. This library contains a single module which can be imported into every standard Angular 9+ project.

Simple to use. The one component gives you full control and lets you take snapshots via actions and event bindings.

Minimal. No unnecessary Flash-fallbacks, no bundle-size bloating.

Demo

Try out the Live-Demo or see the Demo-Project.

Features

  • Webcam live view
  • Photo capturing
  • Smartphone compatibility for modern OS's (OS must support WebRTC/UserMedia API)
  • Access to front- and back-camera, if multiple cameras exist
  • Portrait & Landscape mode on smartphones
  • Mirrored live-view for user-facing cameras - "selfie view" on phones
  • Capturing of lossless pixel image data for better post-processing.

Prerequisites

Runtime Dependencies

Note: Starting from version 0.3.0 this project requires TypeScript >= 3.7.0 (Angular 9). For older versions of Angular/TypeScript, please use version 0.2.6 of this library.

  • Angular: >=9.0.0
  • Typescript: >=3.7.0
  • RxJs: >=5.0.0
  • Important: Your app must be served on a secure context using https:// or on localhost, for modern browsers to permit WebRTC/UserMedia access.

Client

  • Current browser w/ HTML5 and WebRTC/UserMedia support (Chrome >53, Safari >11, Firefox >38, Edge)
  • Webcam / camera
  • User permissions to access the camera

Usage

  1. Install the library via standard npm command:

npm install --save ngx-webcam

  1. Import the WebcamModule into your Angular module:
import {WebcamModule} from 'ngx-webcam';

@NgModule({
  imports: [
    WebcamModule,
    ...
  ],
  ...
})
export class AppModule { }
  1. Use the WebcamComponent on your pages:

<webcam></webcam>

As simple as that.

For more examples, see the code in the Demo-Project.

Options and Events

This section describes the basic inputs/outputs of the component. All inputs are optional.

Inputs

  • trigger: Observable<void>: An Observable to trigger image capturing. When it fires, an image will be captured and emitted (see Outputs).
  • width: number: The maximal video width of the webcam live view.
  • height: number: The maximal video height of the webcam live view. The actual view will be placed within these boundaries, respecting the aspect ratio of the video stream.
  • videoOptions: MediaTrackConstraints: Defines constraints (MediaTrackConstraints) to apply when requesting the video track.
  • mirrorImage: string | WebcamMirrorProperties: Flag to control image mirroring. If the attribute is missing or null and the camera claims to be user-facing, the image will be mirrored (x-axis) to provide a better user experience ("selfie view"). A string value of "never" will prevent mirroring, whereas a value of "always" will mirror every camera stream, even if the camera cannot be detected as user-facing. For future extensions, the WebcamMirrorProperties object can also be used to set these values.
  • allowCameraSwitch: boolean: Flag to enable/disable camera switch. If enabled, a switch icon will be displayed if multiple cameras are found.
  • switchCamera: Observable<boolean|string>: Can be used to cycle through available cameras (true=forward, false=backwards), or to switch to a specific device by deviceId (string).
  • captureImageData: boolean = false: Flag to enable/disable capturing of a lossless pixel ImageData object when a snapshot is taken. ImageData will be included in the emitted WebcamImage object.
  • imageType: string = 'image/jpeg': Image type to use when capturing snapshots. Default is 'image/jpeg'.
  • imageQuality: number = 0.92: Image quality to use when capturing snapshots. Must be a number between 0..1. Default is 0.92.

Outputs

  • imageCapture: EventEmitter<WebcamImage>: Whenever an image is captured (i.e. triggered by [trigger]), the image is emitted via this EventEmitter. The image data is contained in the WebcamImage data structure as both, plain Base64 string and data-url.
  • imageClick: EventEmitter<void>: An EventEmitter to signal clicks on the webcam area.
  • initError: EventEmitter<WebcamInitError>: An EventEmitter to signal errors during the webcam initialization.
  • cameraSwitched: EventEmitter<string>: Emits the active deviceId after the active video device has been switched.

Good To Know

How to determine if a user has denied camera access

When camera initialization fails for some reason, the component emits a WebcamInitError via the initError EventEmitter. If provided by the browser, this object contains a field mediaStreamError: MediaStreamError which contains information about why UserMedia initialization failed. According to Mozilla API docs, this object contains a name attribute which gives insight about the reason.

If the user denies permission, or matching media is not available, then the promise is rejected with NotAllowedError or NotFoundError respectively.

Determine if a user has denied permissions:

  <webcam (initError)="handleInitError($event)"></webcam>
  public handleInitError(error: WebcamInitError): void {
    if (error.mediaStreamError && error.mediaStreamError.name === "NotAllowedError") {
      console.warn("Camera access was not allowed by user!");
    }
  }

Development

Here you can find instructions on how to start developing this library.

Build

Run npm run packagr to build the library. The build artifacts will be stored in the dist/ directory.

Start

Run npm start to build and run the surrounding demo app with the WebcamModule. Essential for live-developing.

Generate docs/

Run npm run docs to generate the live-demo documentation pages in the docs/ directory.

Running Unit Tests

Run npm run test to run unit-tests.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].