Complete docs

pull/661/head
Mattia Iavarone 6 years ago
parent 0bd20d1a8b
commit 118c0c5e33
  1. 1
      README.md
  2. 13
      cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java
  3. 36
      docs/_posts/2018-12-20-controls.md

@ -122,6 +122,7 @@ Using CameraView is extremely simple:
app:cameraGestureScrollVertical="none|zoom|exposureCorrection|filterControl1|filterControl2"
app:cameraEngine="camera1|camera2"
app:cameraPreview="glSurface|surface|texture"
app:cameraPreviewFrameRate="@integer/preview_frame_rate"
app:cameraFacing="back|front"
app:cameraHdr="on|off"
app:cameraFlash="on|auto|torch|off"

@ -1450,8 +1450,12 @@ public class CameraView extends FrameLayout implements LifecycleObserver {
}
/**
* Sets the frame rate for the video
* Will be used by {@link #takeVideoSnapshot(File)}.
* Sets the preview frame rate in frames per second.
* This rate will be used, for example, by the frame processor and in video
* snapshot taken through {@link #takeVideo(File)}.
*
* A value of 0F will restore the rate to a default value.
*
* @param frameRate desired frame rate
*/
public void setPreviewFrameRate(float frameRate) {
@ -1459,7 +1463,10 @@ public class CameraView extends FrameLayout implements LifecycleObserver {
}
/**
* Returns the current frame rate.
* Returns the current preview frame rate.
* This can return 0F if no frame rate was set.
*
* @see #setPreviewFrameRate(float)
* @return current frame rate
*/
public float getPreviewFrameRate() {

@ -30,7 +30,8 @@ or `CameraOptions.supports(Control)` to see if it is supported.
app:cameraVideoCodec="deviceDefault|h263|h264"
app:cameraVideoMaxSize="0"
app:cameraVideoMaxDuration="0"
app:cameraVideoBitRate="0"/>
app:cameraVideoBitRate="0"
app:cameraPreviewFrameRate="30"/>
```
### APIs
@ -40,6 +41,8 @@ or `CameraOptions.supports(Control)` to see if it is supported.
Which camera to use, either back facing or front facing.
Defaults to the first available value (tries `BACK` first).
The available values are exposed through the `CameraOptions` object.
```java
cameraView.setFacing(Facing.BACK);
cameraView.setFacing(Facing.FRONT);
@ -49,6 +52,8 @@ cameraView.setFacing(Facing.FRONT);
Flash mode, either off, on, auto or torch. Defaults to `OFF`.
The available values are exposed through the `CameraOptions` object.
```java
cameraView.setFlash(Flash.OFF);
cameraView.setFlash(Flash.ON);
@ -61,6 +66,8 @@ cameraView.setFlash(Flash.TORCH);
Sets the encoder for video recordings. Defaults to `DEVICE_DEFAULT`,
which should typically be H_264.
The available values are exposed through the `CameraOptions` object.
```java
cameraView.setVideoCodec(VideoCodec.DEVICE_DEFAULT);
cameraView.setVideoCodec(VideoCodec.H_263);
@ -72,6 +79,8 @@ cameraView.setVideoCodec(VideoCodec.H_264);
Sets the desired white balance for the current session.
Defaults to `AUTO`.
The available values are exposed through the `CameraOptions` object.
```java
cameraView.setWhiteBalance(WhiteBalance.AUTO);
cameraView.setWhiteBalance(WhiteBalance.INCANDESCENT);
@ -84,6 +93,8 @@ cameraView.setWhiteBalance(WhiteBalance.CLOUDY);
Turns on or off HDR captures. Defaults to `OFF`.
The available values are exposed through the `CameraOptions` object.
```java
cameraView.setHdr(Hdr.OFF);
cameraView.setHdr(Hdr.ON);
@ -94,6 +105,8 @@ cameraView.setHdr(Hdr.ON);
Turns on or off audio stream while recording videos.
Defaults to `ON`.
The available values are exposed through the `CameraOptions` object.
```java
cameraView.setAudio(Audio.OFF);
cameraView.setAudio(Audio.ON); // on but depends on video config
@ -143,6 +156,27 @@ cameraView.setVideoBitRate(0);
cameraView.setVideoBitRate(4000000);
```
##### cameraPreviewFrameRate
Controls the preview frame rate, in frames per second.
Use a value of 0F to restore the camera default value.
```java
cameraView.setPreviewFrameRate(30F);
cameraView.setPreviewFrameRate(0F);
```
The preview frame rate is an important parameter because it will also
control (broadly) the rate at which frame processor frames are dispatched,
the video snapshots frame rate, and the rate at which real-time filters are invoked.
The available values are exposed through the `CameraOptions` object:
```java
float min = options.getPreviewFrameRateMinValue();
float max = options.getPreviewFrameRateMaxValue();
```
### Zoom
There are two ways to control the zoom value:

Loading…
Cancel
Save