Access both back and front cameras simultaneously

后端 未结 3 1103
盖世英雄少女心
盖世英雄少女心 2020-12-06 11:52

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

What I\'ve researched: I know android camera API doesn\'t give support for using mu

相关标签:
3条回答
  • 2020-12-06 11:55

    It is possible using the Android Camera2 API, but as indicated above most devices don't have hardware support. If you have a Nexus 5X, Nexus 6, or Nexus 6P it will work and you can test with this BothCameras app. I've implemented blitting to allow video recording as well (in addition to still pictures) using the hardware h264 encoder.

    0 讨论(0)
  • 2020-12-06 12:00

    You can not access both the cameras in all android mobile phones due to hardware limitations. The best alternative can be using both the camera one by one. For that you can use single camera object and can change camera face to take another photo.

    I have done this in one of my application. https://play.google.com/store/apps/details?id=com.ushaapps.bothie

    0 讨论(0)
  • 2020-12-06 12:18

    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.

    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.

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