/preview-camera

Adjusted Camera Preview to skyscrapper-portrait only and proper flip of selfie-mode

Primary LanguageKotlin

changes on this fork:

  • force portrait orientation
  • mirror the result / preview of front camera (so the recording is the same orientation as the preview)

That matched more my use case, would be cleaner to add properly options so this behaviour can be controlled via capacitor


@numbersprotocol/preview-camera

Preview Camera Plugin for iOS, Android

Install

npm install @numbersprotocol/preview-camera
npx cap sync

API

echo(...)

echo(options: { value: string; }) => Promise<{ value: string; }>
Param Type
options { value: string; }

Returns: Promise<{ value: string; }>


startPreview()

startPreview() => Promise<void>

stopPreview()

stopPreview() => Promise<void>

takePhoto()

takePhoto() => Promise<void>

capturePhoto()

capturePhoto() => Promise<void>

startRecord()

startRecord() => Promise<void>

stopRecord()

stopRecord() => Promise<void>

flipCamera()

flipCamera() => Promise<void>

getFlashModes()

getFlashModes() => Promise<any>

Returns: Promise<any>


setFlashMode()

setFlashMode() => Promise<void>

isTorchOn()

isTorchOn() => Promise<{ result: boolean; }>

Returns: Promise<{ result: boolean; }>


enableTorch(...)

enableTorch(options: { enable: boolean; }) => Promise<void>
Param Type
options { enable: boolean; }

isTorchAvailable()

isTorchAvailable() => Promise<{ result: boolean; }>

Returns: Promise<{ result: boolean; }>


focus(...)

focus(options: { x: number; y: number; }) => Promise<void>
Param Type
options { x: number; y: number; }

minAvailableZoom()

minAvailableZoom() => Promise<{ result: number; }>

Returns: Promise<{ result: number; }>


maxAvailableZoom()

maxAvailableZoom() => Promise<{ result: number; }>

Returns: Promise<{ result: number; }>


zoom(...)

zoom(options: { factor: number; }) => Promise<void>
Param Type
options { factor: number; }

setQuality(...)

setQuality(options: { quality: 'low' | 'hq'; }) => Promise<void>
Param Type
options { quality: 'low' | 'hq'; }

addListener('captureVideoFinished', ...)

addListener(eventName: 'captureVideoFinished', listenerFunc: (data: CaptureResult) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Param Type
eventName 'captureVideoFinished'
listenerFunc (data: CaptureResult) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


addListener('capturePhotoFinished', ...)

addListener(eventName: 'capturePhotoFinished', listenerFunc: (data: CaptureResult) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Param Type
eventName 'capturePhotoFinished'
listenerFunc (data: CaptureResult) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


Interfaces

PluginListenerHandle

Prop Type
remove () => Promise<void>

CaptureResult

Prop Type Description
filePath string File path for photo or video taken by camera. Example: file://your-app-dir/.../my-video.mp4
errorMessage string Error message if any