
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
ack-angular-webcam
Advanced tools
Angular2 webcam component. Based on MediaDevices and getUserMedia.js
A cross-browser Angular component, it will use the browser's native getUserMedia()
implementation, otherwise an optional Flash fallback is available. Demo Page Here
This component is based on MediaDevices and getUserMedia.js Polyfill.
Please, check original repository for clear understanding
npm install ack-angular-webcam --save-dev
import { WebCamModule } from 'ack-angular-webcam';
@NgModule({
imports: [
BrowserModule,
WebCamModule
],
declarations: [
AppComponent
],
bootstrap: [ AppComponent ]
})
class AppModule {
}
export default AppModule;
app.component.ts
import { Component } from '@angular/core';
import { Http, Request } from '@angular/http';
//imported here just for type checking. Optional
import { WebCamComponent } from 'ack-angular-webcam';
const template = `
<ack-webcam
#webcam
[options] = "options"
(success) = "onCamSuccess($event)"
(catch) = "onCamError($event)"
></ack-webcam>
<button (click)="genBase64(webcam)"> generate base64 </button>
<button (click)="genPostData(webcam)"> generate post data </button>
`
@Component({
selector:'app-component',
template:template
}) export class AppComponent{
base64
constructor(public http:Http){}
genBase64( webcam:WebCamComponent ){
webcam.getBase64()
.then( base=>this.base64=base)
.catch( e=>console.error(e) )
}
//get HTML5 FormData object and pretend to post to server
genPostData( webcam:WebCamComponent ){
webcam.captureAsFormData({fileName:'file.jpg'})
.then( formData=>this.postFormData(formData) )
.catch( e=>console.error(e) )
}
//a pretend process that would post the webcam photo taken
postFormData(formData){
const config = {
method:"post",
url:"http://www.aviorsciences.com/",
body: formData
}
const request = new Request(config)
return this.http.request( request )
}
onCamError(err){}
onCamSuccess(){}
}
ack-angular-webcam inputs and outputs
[videoDevice] : MediaDeviceInfo
[videoDeviceId] : string
[audioDeviceId] : string
[mime] : string = 'image/jpeg'
[useParentWidthHeight] : boolean = false
[facingMode] : "user"|"environment"|"left"|"right"|string
[reflect]:boolean //mirror camera image
(success) = new EventEmitter()
(catch) : EventEmitter<Error> = new EventEmitter()
[(error)] : Error
[options]:{
video : boolean | MediaTrackConstraints
audio : boolean
width : number
height : number
fallback : boolean
fallbackSrc: string
fallbackMode: string
fallbackQuality: number
}
Binding Resource Links
Tested for tablet (Android 4.4.2 GT-N5110) and phone (Android 4.1.2 GT-I8268)
Quite Simple: You must indicate the URL of the swf fallback file named jscam_canvas_only.swf
This file is included and located at ack-angular-webcam/jscam_canvas_only.swf
You can check example using following npm commands:
npm run watch
Type the following commands in a command prompt terminal
Step 1 of 4
git clone https://github.com/ackerapple/ack-angular-webcam -b master
Step 2 of 4
cd ack-angular-webcam
Step 3 of 4
npm install
Step 4 of 4
npm run watch
After step 4, a web browser should auto open a demo page and any code changes you perform to ack-angular-webcam will cause an auto-refresh of browser
Get listing of users media devices
<ack-media-devices
[(array)]="devices"
[(error)]="deviceListingError"
></ack-media-devices>
Bindings
[(array)]:MediaDeviceInfo[] = []
[(error)]:Error
[(videoInputs)]:MediaDeviceInfo[]
[(audioInputs)]:MediaDeviceInfo[]
[(audioOutputs)]:MediaDeviceInfo[]
(catch):EventEmitter<Error> = new EventEmitter()
Nobodies perfect
Source files are on not the default github branch
You might also want to give these packages a try
FAQs
Angular2 webcam component. Based on MediaDevices and getUserMedia.js
The npm package ack-angular-webcam receives a total of 236 weekly downloads. As such, ack-angular-webcam popularity was classified as not popular.
We found that ack-angular-webcam demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.