capture photo from both front and back camera simultaneously

后端 未结 1 434
滥情空心
滥情空心 2021-01-25 10:55

I would like to develop an Android application which has the technique of capturing a photo from camera(both front and back) at simultaneously.I searched over internet but unfor

相关标签:
1条回答
  • 2021-01-25 11:57

    You need to approach this problem step by step.

    1. First build functionality to take picture by back camera.
    2. Once you have done that, then build functionality to take picture by front camera (most of the code will be the same, just setting the back/font camera will be different.
    3. Once you have these two options built, separately, then you can combine the two by making it a three-step process: 1) take picture by back camera 2) switch the camera to front 3) take picture by front camera.

    Again, as mentioned, taking picture by back and front cameras are not different, it only involves switching the cameras.

    Edited after seeing new comment:

    If you are using the built-in camera, that is using intents, then this task is not going to be an automatic and immediate thing. I thought you were building custom camera, where you can do all this by code (without intents and built-in camera). But anyways, you can still do it.

    So now, the process will be:

    1. Use intent to go to Camera.
    2. Take a picture (which is by default back camera). Do whatever you want to do with this picture, save, process, etc.
    3. Use another intent to go to Camera again. This time, add an extra to your intent to so the camera defaults to front camera intent.putExtra("android.intent.extras.CAMERA_FACING", 1);

    4. Take picture again.

    Refer to this thread for how to launch front camera with intent: How to launch front camera with intent?

    0 讨论(0)
提交回复
热议问题