安卓可以同时使用前后摄像头吗 [英] Is it possible to use front and back Camera at same time in Android

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

问题描述

我想同时使用设备的前后摄像头.在我的应用中,屏幕的前半部分将显示后置摄像头的预览,下半部分屏幕将显示前置摄像头的预览.

I want to use front and back Camera of device both at same time. In my app, first half of the screen will display preview of back camera and next half of the screen will display front camera preview.

我尝试过设置两个不同的相机预览,但是当我打开我的应用程序时,屏幕的前半部分(显示后置相机预览)不显示预览.屏幕的后半部分(显示前置摄像头)显示后置摄像头(奇怪).

I have tried this with setting two different camera previews but when I open my app, first half of the screen(which displays back camera preview) does not display the preview. And second half of the screen(which displays front facing Camera) displays back facing Camera(strange).

根据Camera.open(int) 文档:

您的应用程序一次只能激活一个 Camera 对象对于特定的硬件相机.

Your application should only have one Camera object active at a time for a particular hardware camera.

这意味着如果两个相机硬件(正面和背面)不同并且可以同时打开.

This means if both camera hardware (front and back) are different and can be opened at same time.

在我的应用程序中,我使用了与上面相同的 api.当我打开并同时为两个摄像头调用 Camera.startPreview(); 时,这不会给出任何异常或错误.但它仍然无法正常工作.我一次只能看到一个相机预览.

In my application, I am using the same above api. This does not give any exception or error when I open and call Camera.startPreview(); for both cameras at same time. But still it is not working. I can see only one camera preview at a time.

这里有什么可以同时使用两个摄像头的地方吗?

Is there anything which I am missing here to use both cameras at same time?

推荐答案

我在 HTC ONE M8 上同时使用双摄像头

I got simultaneous dual camera access working on the HTC ONE M8

视频:http://youtu.be/lt8N1Lpa9Zw
请随意使用我的代码:https://bitbucket.org/jens_grubert/androiddualcameracapture/

这篇关于安卓可以同时使用前后摄像头吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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