Difference Between Camera and Camera2 in Android

2019-03-18 22:58发布

问题:

I'm building an App which is similar to social media where people can share photos and videos like Instagram. That's why Camera is very important for my app. Now camera2 API is confusing me. I want to run my app on API level 11+ . I know camera2 is only available in API level 21+ So, I need to design two APIs one(camera) for older version and second(camera2) for higher version. Problem is that I just started to learn Android and I do not know what is the main difference between these two APIs.

What main features are available in Camera2 API ?
Or Is there any drawback of Old Camera API ?

I need three things in my App.

1- Simple capture photos 2- Burst pictures (To create GIF Image) 3- Simple video recording.

Which Camera API is good for me ?

回答1:

The old camera API will work fine for #1 and #3; if you're OK with video-resolution GIFs, you can do #2 as well.

You'll need camera2 (and then devices that support fast, full-resolution capture - see the BURST_CAPTURE capability, or any device that supports the FULL hardware level.), if you want bursts at resolutions above ~1080p.

You can probably start with the CameraView unofficial support library, and modify it as needed. It has support for both APIs, selected based on API level of the device.