
Product
Socket Now Supports pylock.toml Files
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
ack-angular-webcam
Advanced tools
Angular2 webcam component. Based on MediaDevices and getUserMedia.js
A cross-browser angular2 component, it will use the browser's native getUserMedia()
implementation, otherwise an optional Flash fallback is available.
This component is based on MediaDevices and getUserMedia.js Polyfill.
Please, check original repository for clear understanding
npm install ack-angular-webcam --save-dev
Use webcam as a pure angular2 component
import { WebCamComponent } from 'ack-angular-webcam';
@NgModule({
imports: [
BrowserModule
],
declarations: [
AppComponent,
WebCamComponent
],
bootstrap: [ AppComponent ]
})
class AppModule {
}
export default AppModule;
app.component.ts
import { Component } from '@angular/core';
import { Http, Request } from '@angular/http';
const template = `
<ack-webcam [(ref)]="webcam" [options]="options" (onSuccess)="onCamSuccess($event)" (onError)="onCamError($event)"></ack-webcam>
<button (click)="genBase64()"> generate base64 </button>
<button (click)="genPostData()"> generate post data </button>
`
@Component({
selector:'app-component',
template:template
}) export class AppComponent{
public webcam//will be populated by ack-webcam [(ref)]
public base64
constructor(public http:Http){}
genBase64(){
this.webcam.getBase64()
.then( base=>this.base64=base)
.catch( e=>console.error(e) )
}
//get HTML5 FormData object and pretend to post to server
genPostData(){
this.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(){}
}
{
audio: boolean,
video: boolean,
width: number,
height: number,
fallbackMode: 'callback',
fallbackSrc: 'jscam_canvas_only.swf',
fallbackQuality: 85,
cameraType: 'front' || 'back'
};
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
FAQs
Angular2 webcam component. Based on MediaDevices and getUserMedia.js
The npm package ack-angular-webcam receives a total of 193 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.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.
Research
Security News
Malicious Ruby gems typosquat Fastlane plugins to steal Telegram bot tokens, messages, and files, exploiting demand after Vietnam’s Telegram ban.