Improve README

v2
Mattia Iavarone 7 years ago
parent 8ed10fea06
commit 3486481494
  1. 12
      MIGRATION.md
  2. 34
      README.md

@ -3,8 +3,12 @@
- JpegQuality: both cameraJpegQuality and setJpegQuality() have been removed, because - JpegQuality: both cameraJpegQuality and setJpegQuality() have been removed, because
they were working only with specific setups. We'll use the default quality provided they were working only with specific setups. We'll use the default quality provided
by the camera engine. by the camera engine.
- capturePicture: renamed to takePicture() - CropOutput: both cameraCropOutput and setCropOutput() have been removed. If you want
- captureSnapshot: renamed to takePictureSnapshot() your output to be cropped to match the view bounds, use the *snapshot() APIs.
- startCapturingVideo: renamed to takeVideo(). Signature changed from long to int. - ExtraProperties: this has been removed.
- capturePicture(): renamed to takePicture().
- captureSnapshot(): renamed to takePictureSnapshot().
- startCapturingVideo(): renamed to takeVideo(). Signature changed from long to int.
- getSnapshotSize(): removed. The size of snapshots (pictures and videos) is equal to - getSnapshotSize(): removed. The size of snapshots (pictures and videos) is equal to
the preview size as returned by getPreviewSize(). the preview size as returned by getPreviewSize().
- onVideoTaken(): now passing a VideoResult. Use VideoResult.getFile() to access the video file.

@ -49,8 +49,8 @@ See below for a [list of what was done](#roadmap) and [licensing info](#contribu
- Output: Automatic cropping to match your `CameraView` preview bounds - Output: Automatic cropping to match your `CameraView` preview bounds
- Built-in **grid drawing** - Built-in **grid drawing**
- Multiple capture methods - Multiple capture methods
- Take high-resolution pictures with `capturePicture` - Take high-resolution pictures with `takePicture`
- Take **quick snapshots** as a freeze frame of the preview with `captureSnapshot` - Take **quick snapshots** as a freeze frame of the preview with `takePictureSnapshot`
- Control HDR, flash, zoom, white balance, exposure correction and more - Control HDR, flash, zoom, white balance, exposure correction and more
- **Frame processing** support - **Frame processing** support
- **Metadata** support for pictures and videos - **Metadata** support for pictures and videos
@ -131,7 +131,7 @@ protected void onDestroy() {
### Capturing Images ### Capturing Images
To capture an image just call `CameraView.capturePicture()`. Make sure you setup a `CameraListener` To capture an image just call `CameraView.takePicture()`. Make sure you setup a `CameraListener`
to handle the image callback. to handle the image callback.
```java ```java
@ -144,39 +144,39 @@ camera.addCameraListener(new CameraListener() {
} }
}); });
camera.capturePicture(); camera.takePicture();
``` ```
You can also use `camera.captureSnapshot()` to capture a preview frame. This is faster, though will You can also use `camera.takePictureSnapshot()` to capture a preview frame. This is faster, though will
ensure lower quality output. ensure lower quality output.
### Capturing Video ### Capturing Video
To capture video just call `CameraView.startCapturingVideo(file)` to start, and To capture video just call `CameraView.takeVideo(file)` to start, and
`CameraView.stopCapturingVideo()` to finish. Make sure you setup a `CameraListener` to handle `CameraView.stopVideo()` to finish. Make sure you setup a `CameraListener` to handle
the video callback. the video callback.
```java ```java
camera.addCameraListener(new CameraListener() { camera.addCameraListener(new CameraListener() {
@Override @Override
public void onVideoTaken(File video) { public void onVideoTaken(VideoResult result) {
// The File is the same you passed before. // Use result.getFile() to access a file holding
// Now it holds a MP4 video. // the recorded video.
} }
}); });
// Select output file. Make sure you have write permissions. // Select output file. Make sure you have write permissions.
File file = ...; File file = ...;
camera.startCapturingVideo(file); camera.takeVideo(file);
// Later... stop recording. This will trigger onVideoTaken(). // Later... stop recording. This will trigger onVideoTaken().
camera.stopCapturingVideo(); camera.stopVideo();
// You can also use one of the video constraints: // You can also use one of the video constraints:
// videoMaxSize and videoMaxDuration will automatically stop recording when satisfied. // videoMaxSize and videoMaxDuration will automatically stop recording when satisfied.
camera.setVideoMaxSize(100000); camera.setVideoMaxSize(100000);
camera.setVideoMaxDuration(5000); camera.setVideoMaxDuration(5000);
camera.startCapturingVideo(file); camera.takeVideo(file);
``` ```
### Other camera events ### Other camera events
@ -211,8 +211,8 @@ camera.addCameraListener(new CameraListener() {
public void onCameraError(CameraException error) {} public void onCameraError(CameraException error) {}
/** /**
* Notifies that a picture previously captured with capturePicture() * Notifies that a picture previously captured with takePicture()
* or captureSnapshot() is ready to be shown or saved. * or takePictureSnapshot() is ready to be shown or saved.
* *
* If planning to get a bitmap, you can use CameraUtils.decodeBitmap() * If planning to get a bitmap, you can use CameraUtils.decodeBitmap()
* to decode the byte array taking care about orientation. * to decode the byte array taking care about orientation.
@ -222,7 +222,7 @@ camera.addCameraListener(new CameraListener() {
/** /**
* Notifies that a video capture has just ended. The file parameter is the one that * Notifies that a video capture has just ended. The file parameter is the one that
* was passed to startCapturingVideo(File), or a fallback video file. * was passed to takeVideo(File), or a fallback video file.
*/ */
@Override @Override
public void onVideoTaken(File video) {} public void onVideoTaken(File video) {}
@ -442,7 +442,7 @@ What to capture - either picture or video. This has a couple of consequences:
depending on the flag. The picture size is chosen according to the given [size selector](#picture-size). depending on the flag. The picture size is chosen according to the given [size selector](#picture-size).
When `video`, in addition, we try to match the `videoQuality` aspect ratio. When `video`, in addition, we try to match the `videoQuality` aspect ratio.
- Picture capturing: due to sizing behavior, capturing pictures in `video` mode might lead to - Picture capturing: due to sizing behavior, capturing pictures in `video` mode might lead to
inconsistent results. In this case it is encouraged to use `captureSnapshot` instead, which will inconsistent results. In this case it is encouraged to use `takePictureSnapshot` instead, which will
capture preview frames. This is fast and thus works well with slower camera sensors. capture preview frames. This is fast and thus works well with slower camera sensors.
- Picture capturing: while recording a video, image capturing might work, but it is not guaranteed - Picture capturing: while recording a video, image capturing might work, but it is not guaranteed
(it's device dependent) (it's device dependent)

Loading…
Cancel
Save