Skip to content

dragermrb/capacitor-plugin-media-capture

Repository files navigation

@whiteguru/capacitor-plugin-media-capture

Capacitor plugin to capture audio and video

Install (Capacitor 6.x)

npm install @whiteguru/capacitor-plugin-media-capture
npx cap sync

or for Capacitor 5.x

npm install @whiteguru/capacitor-plugin-media-capture@^5.0.1
npx cap sync

or for Capacitor 4.x

npm install @whiteguru/capacitor-plugin-media-capture@^4.0.1
npx cap sync

iOS

iOS not available jet

Android

This API requires the following permissions be added to your AndroidManifest.xml:

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />

Read about Setting Permissions in the Android Guide for more information on setting Android permissions.

Variables

This plugin needs compileSdkVersion = 31 variable (defined in your app's variables.gradle file)

API

captureVideo(...)

captureVideo(options: CaptureVideoOptions) => Promise<MediaFileResult>
Param Type
options CaptureVideoOptions

Returns: Promise<MediaFileResult>


Interfaces

MediaFileResult

Prop Type
file MediaFile

MediaFile

Prop Type Description
name string The name of the file, without path information.
path string The full path of the file, including the name.
type string The file's mime type
size number The size of the file, in bytes.

CaptureVideoOptions

Prop Type Description
duration number Maximum duration per video clip.
quality 'uhd' | 'fhd' | 'hd' | 'sd' Quality of the video. uhd for 4K ultra HD video size (2160p). fhd for full HD video size (1080p). hd for HD video size (720p). sd for SD video size (480p).
sizeLimit number Max file size in bytes.