# VideoRecorder

NativeScript Video Recorder on NPM NativeScript Video Recorder on NPM follow on Twitter

Android Device Android Emulator iOS Device iOS Simulator

# Installing

    ns plugin add @triniwiz/nativescript-videorecorder

# QuickStart

# JavaScript

var vr = require('@triniwiz/nativescript-videorecorder');

var options = {
	saveToGallery: true,
	duration: 30,
	format: 'mp4',
	size: 10,
	hd: true,
	explanation: 'Why do i need this permission',
};

var videorecorder = new vr.VideoRecorder(options);

videorecorder
	.record()
	.then((data) => {
		console.log(data.file);
	})
	.catch((err) => {
		console.log(err);
	});

# TypeScript

import { VideoRecorder, Options as VideoRecorderOptions } from '@triniwiz/nativescript-videorecorder';

const options: VideoRecorderOptions = {
    hd: true
    saveToGallery: true
}
const videorecorder = new VideoRecorder(options)

videorecorder.record().then((data) => {
    console.log(data.file)
}).catch((err) => {
    console.log(err)
})

# API

# VideoRecorder(...)

new VideoRecorder({...});

Creates new VideoRecorder

Param Type
options Options

Returns: VideoRecorder


# record()

 record(): void;

Opens the Video recorder

Returns: Promise<RecordResult>


# isAvailable()

 isAvailable(): boolean;

Checks if the devices supports the Video recorder

Returns: boolean


# requestPermissions(...)

 requestPermissions(): Promise<void>;

Requests the camera permissions

Returns: Promise<void>

# Interfaces

# Options

Prop Type Notes
size? number Limit the size of the video, 0 for unlimited (default: 0)
hd? boolean If true, highest quality of device, if false MMS quality (default: false)
saveToGallery? boolean Enable to save the video in the device Gallery, otherwise it will be store within the sandbox of the app (default: false)
duration? number Limit the duration of the video, 0 for unlimited (default: 0)
explanation? string Why permissions should be accepted, optional on api > 23
format? VideoFormatType allows videos to be played on android devices (default: 'default') recommended for cross platform apps
position? CameraPositionType Force which device camera should be used, 'none' for no preferences (default: none)

# RecordResult

Prop Type
file string

# Types

# VideoFormatType

"default" | "mp4";

# CameraPositionType

"front" | back" | "none"

# Properties

Property Default Type iOS Android Notes
options undefined string
Last Updated: 2/2/2021, 10:28:26 AM