tns plugin add nativescript-fancy-camera
import { FancyCamera } from 'nativescript-fancy-camera';
const fc = new FancyCamera();
fc.takePhoto().then(data => {
if (data && data.file) {
vm.set('src', data.file);
}
});
import { FancyCamera } from 'nativescript-fancy-camera';
const fc = new FancyCamera();
fc.record().then(data => {
if (data && data.file) {
vm.set('src', data.file);
}
});
Allows taking photos (tap) or recording videos (using longPress)
import { FancyCamera } from 'nativescript-fancy-camera';
const fc = new FancyCamera();
fc.show().then(data => {
if (data && data.file && data.type) {
if (data.type === 'video') {
}
if (data.type === 'photo') {
}
vm.set('src', data.file);
}
});
<Page xmlns="http://schemas.nativescript.org/tns.xsd"
xmlns:ui="nativescript-fancy-camera/view">
<ui:CameraView quality="highest" cameraPosition="front" id="camera"/>
const cameraView = page.getViewById("camera");
cameraView.startRecording();
Method | Default | Type | Description |
---|---|---|---|
start | void | Starts the camera preview | |
stop | void | Stop the camera preview | |
startRecording | void | Start recording camera preview. | |
stopRecording | void | Stop recording camera preview. | |
toggleCamera | void | Toggles between front or the back camera. | |
duration | int | Get the current recording video duration. | |
cameraPosition | BACK | void | Gets or Sets camera position |
quality | MAX_480P | void | Gets or sets Video Quality |
toggleFlash | off | void | Toggle the device flash mode |
takePhoto | void | Capture photo |
Apache License Version 2.0, January 2004
Android | IOS |
---|---|
Coming Soon |