nativescript-fancy-camera
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

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

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

License

Apache License Version 2.0, January 2004

ScreenShots

Android IOS
Coming Soon Recording

Dependents (0)

Package Sidebar

Install

npm i nativescript-fancy-camera

Weekly Downloads

0

Version

0.0.1

License

Apache-2.0

Unpacked Size

83.4 kB

Total Files

44

Last publish

Collaborators

  • triniwiz