Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using both front and back cameras simultaneously android

Tags:

I know this question has been asked many times before. I had looked for it over a year ago but didn't find anything so posting this question again to gather if there are any new thoughts/ approaches or hacks.

I want to be able to capture video from both cameras (front and back) in an android device.

My only thought as of now is to some how switch between front and back every 0.1 sec, however I have never been able to code this. Any help from anyone on this, please.

Also another thought is - videos are generally captured at 15 or 30 frames per second. Assume it is at 30 frames per second. What if there is a way to alternate these frames to front and back, then we could have 15 frames per second of front and 15 frames per second of back video. Is this possible? If yes then how? Please suggest. What happens to the audio? Maybe we could restrict audio to only one of the video recordings (front or back).

like image 525
axs Avatar asked Jul 10 '12 18:07

axs


People also ask

Can I use my front and back camera at the same time?

CameraX (version 1.2. 0-beta01 at the time of writing) does not support selecting the front and back cameras at the same time. You can request either ​​the default front-facing camera or the default back-facing camera, but not both.

Can you use both Android cameras at the same time?

Now, with the new Android 11 API, devs will be able to easily check which camera combinations are available on a given device and whether or not they can work at once. They'll also be able to use streams from both front and rear cameras at the same time.


Video Answer


2 Answers

It's possible on the HTC m8, the OnePlusOne and the Motorola Nexus 6, as far as I have tested. Many more phones might support it, but you just have to test on the phones and see if the app crashes or not.

You create a camera object for each available camera and have each attach to the preview callback.

-edit- So far I've found that this works on Snapdragon 801 based phones. Dunno if all of them do it or what other SOCs support it, but that's what I've found so far.

like image 114
MacD Avatar answered Sep 18 '22 18:09

MacD


It is possible but so far, only with the upcoming Samsung Galaxy S4.

It has a dual-camera feature but who knows whether it's hardware-dependant or a software-modification by Samsung, at this stage.

Dual Camera - See both sides of the story.

Hopefully it can be ported to other phones, if it's just software.

like image 26
Alastair Avatar answered Sep 18 '22 18:09

Alastair