0.0.1 • Published 6 years ago

nativescript-fancy-camera v0.0.1

Weekly downloads
1
License
Apache-2.0
Repository
-
Last release
6 years ago

NativeScript Fancy Camera

Installation

tns plugin add nativescript-fancy-camera

Usage

Basic Camera

takePhoto

import { FancyCamera } from 'nativescript-fancy-camera';
const fc = new FancyCamera();
fc.takePhoto().then(data => {
        if (data && data.file) {
            vm.set('src', data.file);
        }
    });

recordVideo

import { FancyCamera } from 'nativescript-fancy-camera';
const fc = new FancyCamera();

fc.record().then(data => {
        if (data && data.file) {
            vm.set('src', data.file);
        }
    });

showCamera

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);
        }
    });

Camera View

<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();

API

MethodDefaultTypeDescription
startvoidStarts the camera preview
stopvoidStop the camera preview
startRecordingvoidStart recording camera preview.
stopRecordingvoidStop recording camera preview.
toggleCameravoidToggles between front or the back camera.
durationintGet the current recording video duration.
cameraPositionBACKvoidGets or Sets camera position
qualityMAX_480PvoidGets or sets Video Quality
toggleFlashoffvoidToggle the device flash mode
takePhotovoidCapture photo

License

Apache License Version 2.0, January 2004

ScreenShots

AndroidIOS
Coming SoonRecording