Gathering detailed insights and metrics for @cbdev/ngx-webcam
Gathering detailed insights and metrics for @cbdev/ngx-webcam
Gathering detailed insights and metrics for @cbdev/ngx-webcam
Gathering detailed insights and metrics for @cbdev/ngx-webcam
A simple Angular webcam component / pure & minimal, no flash-fallback
npm install @cbdev/ngx-webcam
Typescript
Module System
Node Version
NPM Version
TypeScript (80.35%)
SCSS (7.16%)
HTML (6.93%)
JavaScript (5.56%)
Total Downloads
6,853
Last Day
6
Last Week
62
Last Month
235
Last Year
2,708
MIT License
235 Stars
203 Commits
109 Forks
13 Watchers
15 Branches
6 Contributors
Updated on Jun 25, 2025
Minified
Minified + Gzipped
Latest Version
0.3.4
Package Id
@cbdev/ngx-webcam@0.3.4
Unpacked Size
198.02 kB
Size
41.59 kB
File Count
23
NPM Version
7.24.0
Node Version
16.10.0
Cumulative downloads
Total Downloads
Last Day
-66.7%
6
Compared to previous day
Last Week
10.7%
62
Compared to previous week
Last Month
-2.1%
235
Compared to previous month
Last Year
19%
2,708
Compared to previous year
1
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.
Try out the Live-Demo or see the Demo-Project.
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.
>=9.0.0
>=3.7.0
>=5.0.0
https://
or on localhost, for modern browsers to permit WebRTC/UserMedia access.npm install --save ngx-webcam
WebcamModule
into your Angular module:1import {WebcamModule} from 'ngx-webcam'; 2 3@NgModule({ 4 imports: [ 5 WebcamModule, 6 ... 7 ], 8 ... 9}) 10export class AppModule { }
WebcamComponent
on your pages:<webcam></webcam>
As simple as that.
For more examples, see the code in the Demo-Project.
This section describes the basic inputs/outputs of the component. All inputs are optional.
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.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.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!");
}
}
Here you can find instructions on how to start developing this library.
Run npm run packagr
to build the library. The build artifacts will be stored in the dist/
directory.
Run npm start
to build and run the surrounding demo app with the WebcamModule
. Essential for live-developing.
Run npm run docs
to generate the live-demo documentation pages in the docs/
directory.
Run npm run test
to run unit-tests.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 3/16 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
Project has not signed or included provenance with any releases.
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
69 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More