gpt4 book ai didi

支持从两个后置摄像头同时捕获的 Android 设备

转载 作者:行者123 更新时间:2023-12-05 05:30:55 26 4
gpt4 key购买 nike

我想知道是否有人使用此 API 在 Android 设备上同时从 2 个后置摄像头捕获图像或视频:https://source.android.com/docs/core/camera/concurrent-streaming .我用来测试的手机 (S21) 支持该 API,但唯一支持的摄像头对是前置+后置组合。在 kotlin 中,获取支持对的代码是:

val cameraManager = applicationContext.getSystemService(Context.CAMERA_SERVICE) as CameraManager
val concurrentCameras = cameraManager.concurrentCameraIds

希望有人有更新的三星、小米或华为手机来测试 API 是否受支持?非常感谢!

最佳答案

如果摄像头的特性提供功能,您可以按如下方式检查。

 fun CameraManager.directCamera(cameraId: String): LensDirect {
val lensFacing = getCameraCharacteristics(cameraId).get(CameraCharacteristics.LENS_FACING)
return when (lensFacing) {
CameraMetadata.LENS_FACING_FRONT -> LensDirect.FRONT
CameraMetadata.LENS_FACING_BACK -> LensDirect.BACK
else -> throw IllegalArgumentException("unknown direction")
}
}

Query the capabilities of a camera device. These capabilities areimmutable for a given camera.

From API level 29, this function can also be used to query thecapabilities of physical cameras that can only be used as part oflogical multi-camera. These cameras cannot be opened directly viaopenCamera(String, CameraDevice.StateCallback, Handler)

Also starting with API level 29, while most basic camera informationis still available even without the CAMERA permission, some values arenot available to apps that do not hold that permission. The keys notavailable are listed byCameraCharacteristics#getKeysNeedingPermission.

关于支持从两个后置摄像头同时捕获的 Android 设备,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74510708/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com