- 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
Preview Camera Plugin for iOS, Android
npm install @numbersprotocol/preview-camera
npx cap sync
echo(...)
startPreview()
stopPreview()
takePhoto()
capturePhoto()
startRecord()
stopRecord()
flipCamera()
getFlashModes()
setFlashMode()
isTorchOn()
enableTorch(...)
isTorchAvailable()
focus(...)
minAvailableZoom()
maxAvailableZoom()
zoom(...)
setQuality(...)
addListener('captureVideoFinished', ...)
addListener('capturePhotoFinished', ...)
- Interfaces
echo(options: { value: string; }) => Promise<{ value: string; }>
Param | Type |
---|---|
options |
{ value: string; } |
Returns: Promise<{ value: string; }>
startPreview() => Promise<void>
stopPreview() => Promise<void>
takePhoto() => Promise<void>
capturePhoto() => Promise<void>
startRecord() => Promise<void>
stopRecord() => Promise<void>
flipCamera() => Promise<void>
getFlashModes() => Promise<any>
Returns: Promise<any>
setFlashMode() => Promise<void>
isTorchOn() => Promise<{ result: boolean; }>
Returns: Promise<{ result: boolean; }>
enableTorch(options: { enable: boolean; }) => Promise<void>
Param | Type |
---|---|
options |
{ enable: boolean; } |
isTorchAvailable() => Promise<{ result: boolean; }>
Returns: Promise<{ result: boolean; }>
focus(options: { x: number; y: number; }) => Promise<void>
Param | Type |
---|---|
options |
{ x: number; y: number; } |
minAvailableZoom() => Promise<{ result: number; }>
Returns: Promise<{ result: number; }>
maxAvailableZoom() => Promise<{ result: number; }>
Returns: Promise<{ result: number; }>
zoom(options: { factor: number; }) => Promise<void>
Param | Type |
---|---|
options |
{ factor: number; } |
setQuality(options: { quality: 'low' | 'hq'; }) => Promise<void>
Param | Type |
---|---|
options |
{ quality: 'low' | 'hq'; } |
addListener(eventName: 'captureVideoFinished', listenerFunc: (data: CaptureResult) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Param | Type |
---|---|
eventName |
'captureVideoFinished' |
listenerFunc |
(data: CaptureResult) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
addListener(eventName: 'capturePhotoFinished', listenerFunc: (data: CaptureResult) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Param | Type |
---|---|
eventName |
'capturePhotoFinished' |
listenerFunc |
(data: CaptureResult) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Prop | Type |
---|---|
remove |
() => Promise<void> |
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 |