17

As you may know Samsung Galaxy s4 has the capability to capture both front and back cameras at the same time. Now I need to capture both of them in my application. Should I download something?
I tried to open both of them but It wasn't successful! I'm using API level 17.

Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
s4eed
  • 7,173
  • 9
  • 67
  • 104

1 Answers1

9

As far as I know, this is the only phone which supports both the cameras working. This being said, your application may be applicable to this phone only by far.

Unfortunatelly I don't know of any API which is released so far that can work the things out and believe me I turned the Internet upside down. Samsung claims that on the S4 you can capture videos from both the cameras at the same time, but they never explained (or at least I didn't see it) what this "same time" means. This could be something in the hardware, which is controlled only by the Samsung's application or it can be achieved only by software, which is controlled by the same application - who knows.

I've read a lot of posts of how those two cameras can be put to work together on the other phones (by switching the cameras on an interval, but those are expensive operations and this will probably not work). Other thing I can think of (which I didn't see anywhere as a suggestion) is to start both cameras in separate processes (with or without using the AsyncTask class) and put them to work at the same time practically, but I didn't test such a solution (you can try this one if you like, I'm interested in the result actually).

To sum the things up: So far - no luck with Galaxy S4 API, but maybe there are going to be some leaks of the technology and/or a way of achieving this.

g00dy
  • 6,752
  • 2
  • 30
  • 43
  • 1
    You are very wellcome. I hope that at least I gave you some hope of achieving what you wanted. If you focus on the subject long enough, the solution will come naturally I think. If all else fails, then you might come up with a workaround for the moment, untill an API comes out. – g00dy Jun 19 '13 at 06:25
  • I recently found that there's an upload of the JB OpenSource of the S4, even though I don't know if it can be of help here. here's the [link](https://docs.google.com/uc?id=0B7S-bznVXd7BSkxWSVlKV09scGM&export=download&pli=1). Let's hope there's something interesting there :) – g00dy Jun 27 '13 at 14:00
  • 1
    _they never explained (or at least I didn't see it) what this "same time" means_: just got my device and tried to play with it. The answer is simple: _same time_ is actually **same time**. The built-in camera app supports "Split screen" in the Dual camera mode, where you can record a video with both cameras simultaneously, see http://www.youtube.com/watch?v=zo_otshqmmU – Alex Cohn Aug 01 '13 at 06:57
  • @AlexCohn - thank you for pointing that out, but I mentioned it, because I don't actually know for sure (not a written specification found), that this happens practically at the same moment (no matter if you see a "Split screen", becaue there could be a small, but considerable delay between the two screens). – g00dy Aug 01 '13 at 07:13
  • So now you have the answer: there is no delay. The two cameras are active in parallel. The video stream combines both cameras together. – Alex Cohn Aug 01 '13 at 07:35
  • 1
    @g00dy You can't use both cameras in different processes because of hardware limitations. Furthermore only one application can use only one camera at the same time. – Ari Sep 24 '13 at 12:51
  • Source for the comment above: *"Calling Camera.open() throws an exception if the camera is already in use by another application"*, http://developer.android.com/training/camera/cameradirect.html – klh Jul 08 '14 at 20:22
  • Aww, I can't edit the comment anymore. Actually, I'm not sure if it's not possible (should be tested), because in the description of the `open(int)` method in the documentation we can read: *"Your application should only have one Camera object active at a time __for a particular hardware camera__."* – klh Jul 08 '14 at 20:29
  • According to documentation; you cannot have two object instances for a particular camera (i.e front camera). But there are no mentions about any limitations for holding two seperate objects for both front and back cameras. http://developer.android.com/reference/android/hardware/Camera.html#open(int) – Taner Feb 15 '16 at 22:19