diff --git a/components/docs/docs.js b/components/docs/docs.js index f27f7ca3..0f0b0d40 100644 --- a/components/docs/docs.js +++ b/components/docs/docs.js @@ -63,6 +63,7 @@ class Docs extends React.Component { const options = { '1.0.0-beta3.10': 'v1.0.0-beta3.10', '1.0.0-beta3.9': 'v1.0.0-beta3.9', + '0.13.4': 'v0.13.4', '0.13.2': 'v0.13.2', }; diff --git a/components/docs/versions/0.13.2/page1.md b/components/docs/versions/0.13.2/page1.md index 137b2243..af1a4004 100644 --- a/components/docs/versions/0.13.2/page1.md +++ b/components/docs/versions/0.13.2/page1.md @@ -10,10 +10,10 @@ ## Setup -Add __CameraKit__ to the dependencies block in your app level uild.gradle: +Add __CameraKit__ to the dependencies block in your app level build.gradle: ```groovy -compile 'com.wonderkiln:camerakit:0.12.0' +compile 'com.wonderkiln:camerakit:0.13.2' ``` ## Usage @@ -374,9 +374,9 @@ You can setup the CameraView dimensions however you want. When your dimen ### adjustViewBounds -You can use a mix of a fixed dimension (a set value or match_parent) as well as wrap_content. When you do this make sure you set android:adjustViewBounds="true" on the CameraView. +You can use a mix of a fixed dimension (a set value or match\_parent) as well as wrap\_content. When you do this make sure you set android:adjustViewBounds="true" on the CameraView. -When you do this the dimension set to wrap_content will automatically align with the true aspect ratio of the preview surface. In this case the whole preview will be visible with no cropping. +When you do this the dimension set to wrap\_content will automatically align with the true aspect ratio of the preview surface. In this case the whole preview will be visible with no cropping. ## Events diff --git a/components/docs/versions/0.13.4/page1.md b/components/docs/versions/0.13.4/page1.md new file mode 100644 index 00000000..b28a9b8f --- /dev/null +++ b/components/docs/versions/0.13.4/page1.md @@ -0,0 +1,409 @@ +# CameraKit Documentation - v0.13.4 + +1. Setup +2. Usage +3. Capturing Images +4. Extra Attributes +5. Permissions +6. Sizing +7. Events + +## Setup + +Add __CameraKit__ to the dependencies block in your app level build.gradle: + +```groovy +compile 'com.wonderkiln:camerakit:0.13.4' +``` + +## Usage + +To use CameraKit, simply add a CameraView to your layout: + +```xml + +``` + +Override onResume and onPause in your activity, and make calls respectively to CameraView.start() and CameraView.stop(). + +```java +@Override +protected void onResume() { + super.onResume(); + cameraView.start(); +} + +@Override +protected void onPause() { + cameraView.stop(); + super.onPause(); +} +``` + +### Capturing Images + +To capture an image just call CameraView.captureImage(). Then setup a CameraListener to handle the image callback. + +```java +camera.setCameraListener(new CameraListener() { + @Override + public void onPictureTaken(byte[] picture) { + super.onPictureTaken(picture); + + // Create a bitmap + Bitmap result = BitmapFactory.decodeByteArray(picture, 0, picture.length); + } + }); + +camera.captureImage(); +``` + +### Capturing Video + +To capture video just call CameraView.startRecordingVideo() to start, and CameraView.stopRecordingVideo() to finish. Setup a CameraListener to handle the video callback. + +```java +camera.setCameraListener(new CameraListener() { + @Override + public void onVideoTaken(File video) { + super.onVideoTaken(video); + // The File parameter is an MP4 file. + } +}); + +camera.startRecordingVideo(); +camera.postDelayed(new Runnable() { + @Override + public void run() { + camera.stopRecordingVideo(); + } +}, 2500); +``` + +#### Other Methods +```java +cameraView.stopVideo(); +``` + +```java +Size cameraView.getPreviewSize(); +``` + +```java +Size cameraView.getCaptureSize(); +``` + +## Extra Attributes + +```xml + +``` + +|Attribute|Values|Default Value| +|---------|------|-------------| +|[ckFacing](#ckfacing)|[back](#back) [front](#front)|back| +|[ckFlash](#ckflash)|[off](#off) [on](#on) [auto](#auto)|off| +|[ckFocus](#ckfocus)|[off](#off-1) [continuous](#continuous) [tap](#tap)|continuous| +|[ckMethod](#ckmethod)|[standard](#standard) [still](#still) [speed](#speed)|standard| +|[ckZoom](#ckzoom)|[off](#off-2) [pinch](#pinch)|off| +|[ckPermissions](#ckpermissions)|[strict](#strict) [lazy](#lazy) [picture](#picture)|strict`| +|[ckCropOutput](#ckcropoutput)|[true](#true) [false](#false)|false| +|[ckJpegQuality](#ckjpegquality)|[0 <= n <= 100](#ckjpegquality)|100| +|[ckVideoQuality](#ckvideoquality)|[max480p](#max480p) [max720p](#max720p) [max1080p](#max1080p) [max2160p](#max2160p) [highest](#highest) [lowest](#lowest)|max480p| + + +- - - + +### ckFacing +[back](#back) [front](#front) + +back + +```java +cameraView.setFacing(CameraKit.Constants.FACING_BACK); +``` + +front + +```java +cameraView.setFacing(CameraKit.Constants.FACING_FRONT); +``` + +Other Methods +```java +int cameraView.getFacing() +``` + +```java +boolean cameraView.isFacingFront() +``` + +```java +boolean cameraView.isFacingBack() +``` + + +- - - + +### ckFlash +[off](#off) [on](#on) [auto](#auto) [torch](#torch) + +off + +```java +cameraView.setFlash(CameraKit.Constants.FLASH_OFF); +``` + +on + +```java +cameraView.setFlash(CameraKit.Constants.FLASH_ON); +``` + +auto + +```java +cameraView.setFlash(CameraKit.Constants.FLASH_AUTO); +``` + +torch +```java +cameraView.setFlash(CameraKit.Constants.FLASH_TORCH); +``` + +Other Methods +```java +int getFlash() +``` + +- - - + +### ckFocus +[off](#off-1) [continuous](#continuous) [tap](#tap) + +off + +```java +cameraView.setFocus(CameraKit.Constants.FOCUS_OFF); +``` + +continuous + +```java +cameraView.setFocus(CameraKit.Constants.FOCUS_CONTINUOUS); +``` + +tap + +```java +cameraView.setFocus(CameraKit.Constants.FOCUS_TAP); +``` + +- - - + +### ckMethod +[standard](#standard) [still](#still) [speed](#speed) + +standard + +```java +cameraView.setMethod(CameraKit.Constants.METHOD_STANDARD); +``` + +When you use METHOD_STANDARD (camerakit:ckMethod="standard"), images will be captured using the normal camera API capture method using the shutter. + +still + +```java +cameraView.setMethod(CameraKit.Constants.METHOD_STILL); +``` + +When you use METHOD_STILL (camerakit:ckMethod="still"), images will be captured by grabbing a single frame from the preview. This behavior is the same as SnapChat and Instagram. This method has a higher rate of motion blur but can be a better experience for users with slower cameras. + +speed + +- - - + +### ckZoom +[off](#off-2) [pinch](#pinch) + +off + +```java +cameraView.setZoom(CameraKit.Constants.ZOOM_OFF); +``` + +pinch + +```java +cameraView.setZoom(CameraKit.Constants.ZOOM_PINCH); +``` + +- - - + +### ckPermissions +[strict](#strict) [lazy](#lazy) [picture](#picture`) + +strict + +```java +cameraView.setPermissions(CameraKit.Constants.PERMISSIONS_STRICT); +``` + +lazy + +```java +cameraView.setPermissions(CameraKit.Constants.PERMISSIONS_LAZY); +``` + +picture + +```java +cameraView.setPermissions(CameraKit.Constants.PERMISSIONS_PICTURE); +``` + +- - - + +### ckCropOutput +[true](#true) [false](#false) + +true + +```java +cameraView.setCropOutput(true); +``` + +false + +```java +cameraView.setCropOutput(false); +``` + +- - - + +### ckJpegQuality + +```java +cameraView.setJpegQuality(100); +``` + +- - - +### ckVideoQuality +[max480p](#max480p) [max720p](#max720p) [max1080p](#max1080p) [max2160p](#max2160p) [lowest](#lowest) [highest](#highest) [qvga](#qvga) + +max480p + +```java +cameraView.setVideoQuality(CameraKit.Constants.VIDEO_QUALITY_480P); +``` + +max720p + +```java +cameraView.setVideoQuality(CameraKit.Constants.VIDEO_QUALITY_720P); +``` + +max1080p + +```java +cameraView.setVideoQuality(CameraKit.Constants.VIDEO_QUALITY_1080P); +``` + +max2160p + +```java +cameraView.setVideoQuality(CameraKit.Constants.VIDEO_QUALITY_2160P); +``` + +lowest + +```java +cameraView.setVideoQuality(CameraKit.Constants.VIDEO_QUALITY_LOWEST); +``` + +highest + +```java +cameraView.setVideoQuality(CameraKit.Constants.VIDEO_QUALITY_HIGHEST); +``` + +qvga + +```java +cameraView.setVideoQuality(CameraKit.Constants.VIDEO_QUALITY_QVGA); +``` + +### ckVideoBitRate +[int bitRate](#bitRate) + +bitRate + +```java +cameraView.setVideoBitrate(CameraKit.Constants.VIDEO_QUALITY_480P); +``` + + +- - - + +## Automatic Permissions Behavior + +You can handle permissions yourself in whatever way you want, but if you make a call to CameraView.start() without the android.permission.CAMERA permission, an exception would normally be thrown and your app would crash. + +With CameraKit, we will automatically prompt for the android.permission.CAMERA permission if it's not available. If you want to handle it yourself, just make sure you don't call CameraView.start() until you acquire the permissions. + +## Dynamic Sizing Behavior + +You can setup the CameraView dimensions however you want. When your dimensions don't match the aspect ratio of the internal preview surface, the surface will be cropped minimally to fill the view. The behavior is the same as the android:scaleType="centerCrop" on an ImageView. + +### adjustViewBounds + +You can use a mix of a fixed dimension (a set value or match\_parent) as well as wrap\_content. When you do this ensure that you set android:adjustViewBounds="true" on the CameraView. + +When you do this the dimension set to wrap\_content will automatically align with the true aspect ratio of the preview surface. In this case the whole preview will be visible with no cropping. + +## Events + +Be sure to set up a CameraListener instance to react to different camera events. + +```java +camera.setCameraListener(new CameraListener() { + + @Override + public void onCameraOpened() { + super.onCameraOpened(); + } + + @Override + public void onCameraClosed() { + super.onCameraClosed(); + } + + @Override + public void onPictureTaken(byte[] picture) { + super.onPictureTaken(picture); + } + + @Override + public void onVideoTaken(File video) { + super.onVideoTaken(video); + } + +}); +``` \ No newline at end of file diff --git a/components/docs/versions/0.13.4/pages.json b/components/docs/versions/0.13.4/pages.json new file mode 100644 index 00000000..3ca52e8b --- /dev/null +++ b/components/docs/versions/0.13.4/pages.json @@ -0,0 +1,3 @@ +[ + "page1.md" +] \ No newline at end of file