feat: New JS API for useCameraDevice
and useCameraFormat
and much faster getAvailableCameraDevices()
(#1784)
* Update podfile * Update useCameraFormat.ts * Update API * Delete FormatFilter.md * Format CameraViewManager.m ObjC style * Make `getAvailableCameraDevices` synchronous/blocking * Create some docs * fix: Fix HardwareLevel types * fix: Use new device/format API * Use 60 FPS format as an example * Replace `Camera.getAvailableCameraDevices` with new `CameraDevices` API/Module * Fix Lint * KTLint options * Use continuation indent of 8 * Use 2 spaces for indent * Update .editorconfig * Format code * Update .editorconfig * Format more * Update VideoStabilizationMode.kt * fix: Expose `CameraDevicesManager` to ObjC * Update CameraPage.tsx * fix: `requiresMainQueueSetup() -> false` * Always prefer higher resolution * Update CameraDevicesManager.swift * Update CameraPage.tsx * Also filter pixelFormat * fix: Add AVFoundation import
This commit is contained in:
@@ -57,17 +57,6 @@ For debugging purposes you can use the `id` or `name` properties to log and comp
|
||||
* For a single Wide-Angle camera, this would be `["wide-angle-camera"]`
|
||||
* For a Triple-Camera, this would be `["wide-angle-camera", "ultra-wide-angle-camera", "telephoto-camera"]`
|
||||
|
||||
You can use the helper function `parsePhysicalDeviceTypes` to convert a list of physical devices to a single device descriptor type which can also describe virtual devices:
|
||||
|
||||
```ts
|
||||
console.log(device.devices)
|
||||
// --> ["wide-angle-camera", "ultra-wide-angle-camera", "telephoto-camera"]
|
||||
|
||||
const deviceType = parsePhysicalDeviceTypes(device.devices)
|
||||
console.log(deviceType)
|
||||
// --> "triple-camera"
|
||||
```
|
||||
|
||||
Always choose a camera device that is best fitted for your use-case; so you might filter out any cameras that do not support flash, have low zoom values, are not on the back side of the phone, do not contain a format with high resolution or fps, and more.
|
||||
|
||||
:::caution
|
||||
|
Reference in New Issue
Block a user