同时访问回来,同时前摄像头 [英] Access both back and front cameras simultaneously

查看:100
本文介绍了同时访问回来,同时前摄像头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要实现:正面和背面摄像头在同一时间访问

What I'm trying to achieve: access both front and back cameras at the same time.

我研究过什么:我知道Android摄像头API不给予支持使用摄像头的多个实例,你必须使用另一种之前释放一个摄像头。我读过几本有关的问题,我知道,在某些设备上它是可能的(如三星S4,或者从他们的其他新设备)。 我还发现,它有可能获得他们两人在Android的奇巧在某些设备上。 我也知道,在API> = 21,用摄像机2的API,它可能在同一时间访问两者,因为它的线程安全

What I've researched: I know android camera API doesn't give support for using multiple instances of the Camera and you have to release a camera before using the other one. I've read tens of questions about this, I know on some devices it's possible (like Samsung S4, or other new devices from them). I've also found out that it's possible to have access to both of them in Android KitKat on SOME devices. I also know that on api >= 21, using the camera2 API, it's possible to access both of them at the same time because it's thread safe.

我有什么到目前为止:执行用于访问相机之一的时间,以提供一个图片内图片

What I've got so far: implementation for accessing the cameras one at the time in order to provide a picture-in-picture.

我知道这是不可能同时实现双摄像头在每个设备上,我只是想办法让一些设备可用。

I know it's not possible to implement dual simultaneously camera on every device, I just want a way to make it available to some devices.

如何测试,看看设备能够他们访问两个?

How can I test to see if the device is capable of accessing both of them?

我还搜查了一个库,可以让我这样的事情,但我没有发现任何东西。有这样的图书馆吗?

I've also searched for a library that can allow me such thing, but I didn't find anything. Is there such a library?

我想提出这个特性可以尽可能多的设备越好,换了别人,我将离开该功能的当前状态(一一)。

I would like to make this feature available for as many devices as possible, and for the others, I'll leave the current state (one by one) of the feature.

任何人都可以请帮我,至少有一些忠告?

Can anyone please help me, at least with some pieces of advice?

谢谢 !

推荐答案

的机器人照相机的API通常允许使用多个摄像机同时,但大多数设备没有足够的硬件资源来支持,在实践中 - 例如,也往往只有两个相机共享一个摄像头图像处理器。

The Android camera APIs generally allow multiple cameras to be used at the same time, but most devices do not have enough hardware resources to support that in practice - for example, there's often only one camera image processor shared by both cameras.

有没有是随机配备在Android的API,会告诉你前面,如果你可以在同一时间使用多台摄像机的查询。

There's no query that's included in the Android APIs that'll tell you up front if you can use multiple cameras at the same time.

要告诉的唯一方法是尝试打开第二个摄像头,当你已经有一个打开。如果可以打开第二个摄像头,那么你可以做子母画面等,如果你得到一个异常试图打开第二个摄像头,则该特定设备不支持具有两个摄像头打开。

The only way to tell is to try to open a second camera when you already have one open. If you can open the second camera, then you can do picture-in-picture, etc. If you get an exception trying to open the second camera, then that particular device doesn't support having both cameras open.

这篇关于同时访问回来,同时前摄像头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆