Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
@yoonit/nativescript-camera
Advanced tools
Yoonit Camera have a custom view that shows a preview layer of the front/back camera and detects human faces in it and read qr code.
A NativeScript plugin to provide:
npm i -s @yoonit/nativescript-camera
All the functionalities that the @yoonit/nativescript-camera
provides is accessed through the YoonitCamera
component, that includes the camera preview. Below we have the basic usage code, for more details, your can see the Methods, Events or the Demo Vue.
App.vue
<template>
<Page @loaded="onLoaded">
<YoonitCamera
id="yooCamera"
@faceDetected="doFaceDetected"
@faceImage="doFaceImage"
@endCapture="doEndCapture"
@qrCodeContent="doQRCodeContent"
@status="doStatus"
@permissionDenied="doPermissionDenied"
/>
</Page>
</template>
<script>
export default {
data: () => ({
$yoo: null
}),
methods: {
async onLoaded(args) {
this.$yoo = {
camera: null
}
console.log('[YooCamera] Getting Camera view')
this.$yoo.camera = args.object.getViewById('yooCamera')
console.log('[YooCamera] Getting permission')
const permissionGranted = await this.$yoo.camera.requestPermission()
if (permissionGranted) {
console.log('[YooCamera] Permission granted, start preview')
this.$yoo.camera.preview()
}
},
doFaceDetected({ faceDetected }) {
console.log('[YooCamera] faceDetected', faceDetected)
},
doFaceImage({
count,
total,
image: {
path,
source
}
}) {
if (total !== 0) {
console.log('[YooCamera] doFaceImage', `[${count}] of [${total}] - ${path}`)
} else {
console.log('[YooCamera] doFaceImage', `[${count}] ${path}`)
}
console.log('[YooCamera] doFaceImage', path, source)
},
doEndCapture() {
console.log('[YooCamera] doEndCapture')
},
doQRCodeContent({ content }) {
console.log('[YooCamera] doQRCodeContent', content)
},
doStatus({ status }) {
console.log('[YooCamera] doStatus', JSON.parse(status))
},
doToggleLens() {
const currentCameraLens = this.$yoo.camera.getLens()
console.log('[YooCamera] doToggleLens', currentCameraLens)
this.$yoo.camera.toggleLens()
},
doStartCapture(captureType) {
console.log('[YooCamera] doStartCapture', captureType)
this.$yoo.camera.startCapture(captureType)
},
doFaceDetectionBox(status) {
console.log('[YooCamera] doFaceDetectionBox', status)
this.$yoo.camera.setFaceDetectionBox(status)
},
doPermissionDenied() {
console.log('[YooCamera] doPermissionDenied')
}
}
}
</script>
Function | Parameters | Return Type | Valid values | Description |
---|---|---|---|---|
hasPermission | - | boolean | - | Return if application has camera permission. |
preview | - | void | - | Start camera preview if has permission. |
startCapture | captureType: string | void | none default capture type. face for face recognition. barcode to read barcode content. | Set capture type none, face or barcode. |
stopCapture | - | void | - | Stop any type of capture. |
toggleLens | - | void | - | Set camera lens facing front or back. |
getLens | - | number | - | Return number that represents lens face state: 0 for front 1 for back camera. |
setFaceNumberOfImages | faceNumberOfImages: number | void | Any positive number value | Default value is 0. For value 0 is saved infinity images. When saved images reached the "face number os images", the onEndCapture is triggered. |
setFaceDetectionBox | faceDetectionBox: boolean | void | true or false | Set to show face detection box when face detected. |
setFaceTimeBetweenImages | faceTimeBetweenImages: number | void | Any positive number that represent time in milli seconds | Set saving face images time interval in milli seconds. |
setFacePaddingPercent | facePaddingPercent: number | void | Any positive number value | Set face image and bounding box padding in percent. |
setFaceImageSize | faceImageSize: number | void | Any positive number value | Set face image size to be saved. |
Event | Parameters | Description |
---|---|---|
faceImage | { count: number, total: number, image: object = { path: string, source: blob } } | Must have started capture type of face (see startCapture ). Emitted when the face image file is created:
|
faceDetected | { faceDetected: boolean } | Emitted true while the camera detects a face. Emitted false once when a face is no more detected |
endCapture | - | Emitted when the number of face image files created is equal of the number of images set (see the method setFaceNumberOfImages ). |
qrCodeContent | { content: string } | Must have started capture type of barcode (see startCapture ). Emitted when the camera scan a QR Code. |
status | { type: 'error'/'message', status: string } | Emitted message error from native. Used more often for debug purpose. |
permissionDenied | - | Emitted when try to preview but there is not camera permission. |
Clone the repo, change what you want and send PR.
Contributions are always welcome!
Code with ❤ by the Cyberlabs AI Front-End Team
FAQs
Yoonit Camera have a custom view that shows a preview layer of the front/back camera and detects human faces in it and read qr code.
The npm package @yoonit/nativescript-camera receives a total of 20 weekly downloads. As such, @yoonit/nativescript-camera popularity was classified as not popular.
We found that @yoonit/nativescript-camera demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 11 open source maintainers 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
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.