gpt4 book ai didi

java - 检测所有摄像头android

转载 作者:行者123 更新时间:2023-12-05 00:04:49 25 4
gpt4 key购买 nike

我有一个应用程序使用 Camera2 API 来预览相机。我想在手机镜头之间做出选择。在我的代码中,我使用以下代码:

CameraManager manager = (CameraManager) activity.getSystemService(Context.CAMERA_SERVICE);
String[] ids = manager.getCameraIdList();

当我使用带有 2 个前置摄像头(常规和广角)和 3 个后置摄像头的 galaxy s10 时,我只能从管理器返回 4 个 ID:

0- regular rear
1- regular front
2- wide rear
3- wide front

为什么我没有 3 个后置微距摄像头。

问题出现在我的所有背面有 1 个以上摄像头的手机中

如何获得所有后置摄像头?

提前发送

最佳答案

根据文档,您只能获得逻辑摄像头。

public String[] getCameraIdList ()

Return the list of currently connected camera devices by identifier, including cameras that may be in use by other camera API clients.
Non-removable cameras use integers starting at 0 for their identifiers, while removable cameras have a unique identifier for each individual device, even if they are the same model.
This list doesn't contain physical cameras that can only be used as part of a logical multi-camera device.

Returns
String[] The list of currently connected camera devices. This value cannot be null.

要获取物理相机,请使用此

enter image description here enter image description here enter image description here

引用资料:

https://source.android.com/devices/camera/multi-camera

Camera2 replacing one logical stream with two physical streams in Android API 29

关于java - 检测所有摄像头android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61800594/

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