跳过内容

@capgo/camera-preview

摄像头预览插件的主要界面

摄像头预览插件的主要界面

核心功能

核心功能部分
  • start - 开始摄像头预览。
  • stop - 停止摄像头预览。
  • capture - 从摄像头捕获一张照片。
  • captureSample - 从摄像头预览流中捕获一帧图像。
MethodDescription
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。
getPreviewSizeGets the current preview size and position.
setPreviewSizeSets the preview size and position.
setFocusSets the camera focus to a specific point in the preview.
addListenerAdds a listener for screen resize events.
addListenerAdds a listener for orientation change events.
deleteFileDeletes 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.
getSafeAreaInsetsGets the current device orientation in a cross-platform format.
getOrientationReturns the exposure modes supported by the active camera. Modes can include: ‘locked’, ‘auto’, ‘continuous’, ‘custom’.
getExposureModesReturns the current exposure mode.
getExposureModeSets the exposure mode.
setExposureModeSets the exposure mode.
getExposureCompensationRange返回曝光补偿(EV偏差)支持范围。
getExposureCompensation返回当前曝光补偿(EV偏差)。
setExposureCompensation设置曝光补偿(EV偏差)。值将被限制在范围内。
getPluginVersion获取本地 Capacitor 插件版本。

此参考从 src/definitions.tscapacitor-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 中的实现细节.