Akshit Agarwal
Akshit Agarwal

Reputation: 71

How to have 2 different previews running on Camera2 Api?

I want to have previews running from 2 different cameras, like the front and rear (or rear wide and rear ultra-wide) both are being previewed at the same time. I am able to create a single preview but don't know how to have 2 previews running. Any guide on how to do that? Also if there any changes that need to be done on the HAL side, please tell about that too.

Upvotes: 0

Views: 87

Answers (1)

Eddy Talvala
Eddy Talvala

Reputation: 18137

You just operate the two cameras separately. Open both cameras, configure each with a single output. However, most devices don't support this on the hardware level, because they share some of the processing pipeline between the two cameras.

So be prepared to have the second camera open to fail, on most Android devices. On devices where it works, try to minimize the resolution you configure, since that increases the likelihood the device can run both cameras at the same time.

Upvotes: 1

Related Questions