概述
概述部分摄像头预览插件的主要界面
核心功能
核心功能部分start- 开始摄像头预览。stop- 停止摄像头预览。capture- 从摄像头捕获一张照片。captureSample- 从摄像头预览流中捕获一帧图像。
公开 API
Section titled “公开 API”| Method | Description |
|---|---|
start | 开始摄像头预览。 |
stop | 停止摄像头预览。 |
capture | 从摄像头捕获一张照片。 |
captureSample | 从摄像头预览流中捕获一帧图像。 |
getSupportedFlashModes | 获取当前激活相机支持的闪光模式。 |
setAspectRatio | 设置相机预览的分辨率比例。 |
getAspectRatio | 获取当前相机预览的分辨率比例。 |
setGridMode | 设置相机预览覆盖层的网格模式。 |
getGridMode | 获取当前相机预览覆盖层的网格模式。 |
checkPermissions | 检查当前相机(可选微型摄像头)权限状态,无提示系统对话。 |
requestPermissions | 请求相机(可选微型摄像头)权限。如果权限已被授予或拒绝,当前状态将返回无提示。如果 showSettingsAlert 设置相机(可选微型摄像头)权限。若权限已被授予或拒绝,当前状态将返回无提示。当 |
getHorizontalFov | 获取当前激活相机的水平视野。注意:在某些设备上,这可能是一个估计值。 |
getSupportedPictureSizes | 获取所有相机支持的图片尺寸。 |
setFlashMode | 设置当前激活相机的闪光模式。 |
flip | 切换前后摄像头。 |
setOpacity | 设置摄像头预览的透明度。 |
stopRecordVideo | 停止正在进行的视频录制。 |
startRecordVideo | 开始录制视频。 |
isRunning | 检查摄像头预览是否正在运行。 |
getAvailableDevices | 获取所有可用的摄像头设备。 |
getZoom | 获取当前的缩放状态,包括最小值/最大值和当前镜头信息。 |
getZoomButtonValues | 返回缩放按钮值以快速切换。 - iOS/Android:包括 0.5 如果超广角可用; 1 和 2 如果宽角可用; 3 如果望远镜可用 - Web:不支持。 |
setZoom | 设置摄像头的缩放级别。 |
getFlashMode | 获取当前闪光模式。 |
removeAllListeners | 移除所有注册的监听器。 |
setDeviceId | 切换到具有指定 ID 的摄像头。 deviceId. |
getDeviceId | 获取当前绑定的摄像头设备的 ID。 在 Android 上,如果物理镜头请求 fallback 到逻辑摄像头,这将返回绑定的逻辑摄像头 ID。 |
getPreviewSize | Gets the current preview size and position. |
setPreviewSize | Sets the preview size and position. |
setFocus | Sets the camera focus to a specific point in the preview. |
addListener | Adds a listener for screen resize events. |
addListener | Adds a listener for orientation change events. |
deleteFile | Deletes a file at the given absolute path on the device. Use this to quickly clean up temporary images created with __CAPGO_KEEP_0__ . On web, this is not supported and will throw. storeToFileGets the safe area insets for devices. Returns the orientation-aware notch/camera cutout inset and the current orientation. In portrait mode: returns top inset (notch at top). In landscape mode: returns left inset (notch moved to side). This specifically targets the cutout area (notch, punch hole, etc.) that all modern phones have. |
getSafeAreaInsets | Gets the current device orientation in a cross-platform format. |
getOrientation | Returns the exposure modes supported by the active camera. Modes can include: ‘locked’, ‘auto’, ‘continuous’, ‘custom’. |
getExposureModes | Returns the current exposure mode. |
getExposureMode | Sets the exposure mode. |
setExposureMode | Sets the exposure mode. |
getExposureCompensationRange | 返回曝光补偿(EV偏差)支持范围。 |
getExposureCompensation | 返回当前曝光补偿(EV偏差)。 |
setExposureCompensation | 设置曝光补偿(EV偏差)。值将被限制在范围内。 |
getPluginVersion | 获取本地 Capacitor 插件版本。 |
真实来源
标题:真实来源此参考从 src/definitions.ts 在 capacitor-camera-preview.
继续从 @capgo/camera-preview
标题:继续从 @capgo/camera-preview如果您正在使用 @capgo/camera-preview 为了规划原生媒体和界面行为,连接它与 使用 @capgo/camera-preview 为原生能力在使用 @capgo/camera-preview 中 使用 @capgo/capacitor-live-activities 为原生能力在使用 @capgo/capacitor-live-activities 中 @capgo/capacitor-live-activities 为在 @capgo/capacitor-live-activities 中的实现细节 使用 @capgo/capacitor-video-player 为原生能力在使用 @capgo/capacitor-video-player 中,并且 @capgo/capacitor-video-player 为在 @capgo/capacitor-video-player 中的实现细节.