|`takePicture()`|Pictures|Standard|`yes`|`no`|`no`|That of `setPictureSize`|
|`takeVideo()`|Videos|Standard|`no`|`yes`|`no`|That of `setVideoSize`|
|`takePictureSnapshot()`|Pictures|Snapshot|`yes`|`yes`|`yes`|That of the view|
|`takeVideoSnapshot()`|Videos|Snapshot|`yes`|`yes`|`yes`|That of the view|
The video snapshot supports audio and respects the `Audio`, max duration, max size & codec settings,
which makes it a powerful tool. The drawback is that it needs:
- API 18. If called before, it throws
- An OpenGL preview (see below). If not, it throws
### Video capturing
Some new APIs were introduced, which are respected by both standard videos and snapshot videos:
-`setAudioBitRate()` and `cameraAudioBitRate`: sets the audio bit rate in bit/s
-`setVideoBitRate()` and `cameraVideoBitRate`: sets the video bit rate in bit/s
## Camera Preview
The type of preview is now configurable with `cameraPreview` XML attribute and `Preview` control class.
This defaults to the new `GL_SURFACE` and it is highly recommended that you do not change this.
|Preview|Backed by|Info|
|-------|---------|----|
|`Preview.SURFACE`|A `SurfaceView`|This might be better for battery, but will not work well (AFAIR) with dynamic layout changes and similar things. No support for video snapshots.|
|`Preview.TEXTURE`|A `TextureView`|Better. Requires hardware acceleration. No support for video snapshots.|
|`Preview.GL_SURFACE`|A `GLSurfaceView`|Supports video snapshots. Might support GL real time filters in the future.|
The GL surface, as an extra benefit, has a much more efficient way of capturing picture snapshots,
that avoids OOM errors, rotating the image on the fly, reading EXIF, and other horrible things belonging to v1.
These picture snapshots will also work while taking videos.
## CameraListener
The listener interface brings two breaking signature changes:
-`onPictureTaken()` now returns a `PictureResult`. Use `result.getJpeg()` to access the jpeg stream.
The result class includes rich information about the picture (or picture snapshot) that was taken,
plus handy utilities (`result.asBitmap()`...)
-`onVideoTaken()` now returns a `VideoResult`. Use `result.getFile()` to access the video file.
The result class includes rich information about the video (or video snapshot) that was taken.
## Other improvements
- Added `setGridColor()` and `cameraGridColor` to control the grid color
- Default `Facing` value is not `BACK` anymore but rather a value that guarantees that you have cameras (if possible).
If device has no `BACK` cameras, defaults to `FRONT`.
TODO: max size for video snapshot is naive
TODO: document cameraGridColor
TODO: document setVideoBitRate
TODO: document setAudioBitRate
TODO: document takeVideoSnapshot
TODO: document that takePictureSnaphot works while taking videos, if GL_SURFACE
TODO: document the camera previews
TODO: think bout getPreviewSize() being removed, and think about adding a setPreviewSize().
If adding getPreviewSize() back, update this doc.
TODO: fix video recording rotation: with front camera, it does not work.