android高级封装,CameraKit 将一个最难的Camera Android API封装成一个高级和易于使用的库...

gh-readme-header.svg?sanitize=true

gh-readme-googleplay-demo-button.svg?sanitize=truegh-readme-spectrum-button.svg?sanitize=true68747470733a2f2f6173736574732e62756464792e776f726b732f6175746f6d617465642d6461726b2e737667

CameraKit helps you add reliable camera to your app quickly. Our open source camera platform provides consistent capture results, service that scales, and endless camera possibilities.

With CameraKit you are able to effortlessly do the following:

Image and video capture seamlessly working with the same preview session.

Automatic system permission handling.

Automatic preview scaling.

Create a CameraView of any size (not just presets!).

Automatic output cropping to match your CameraView bounds.

Multiple capture methods.

METHOD_STANDARD: an image captured normally using the camera APIs.

METHOD_STILL: a freeze frame of the CameraView preview (similar to SnapChat and Instagram) for devices with slower cameras.

METHOD_SPEED: automatic capture method determination based on measured speed.

Built-in continuous focus.

Built-in tap to focus.

Built-in pinch to zoom.

Sponsored By

gh-readme-expensify-logo.svg?sanitize=truee6ec4186588882c1afdfb482cac5fb1a.png

Trusted By

gh-readme-infitting-logo.svg?sanitize=truegh-readme-goosechase-logo.svg?sanitize=truegh-readme-alphaapps-logo.pnggh-readme-expensify-logo.svg?sanitize=true

Get The Most From CameraKit

There are currently two versions of CameraKit that we support, v1.0.0-beta3.X and v0.13.X.

If photo is your only need, try out the latest and greatest CameraKit features with v1.0.0-beta3.11. Our beta3.11 release does not yet support video, but that feature is coming!

In the meantime, if your application requires video we recommend sticking with v0.13.4; the latest stable release with video implementation.

Use Case

Version

Notes

Documentation Link

Photo only

v1.0.0-beta3.11

The latest and greatest CameraKit has to offer. Video support coming soon!

Photo and Video

v0.13.4

Stable build with full photo and video support

Documentation Site

Setup instructions for 1.0.0-beta3.11 are below. To see the full documentation head over to our website, camerakit.io/docs.

Setup

To include CameraKit in your project, add the following to your app level build.gradle.

dependencies {

implementation 'com.camerakit:camerakit:1.0.0-beta3.11'

implementation 'com.camerakit:jpegkit:0.1.0'

implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.0'

implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.0'

}

Usage

Create a CameraKitView in your layout as follows:

android:id="@+id/camera"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:adjustViewBounds="true"

android:keepScreenOn="true"

app:camera_flash="auto"

app:camera_facing="back"

app:camera_focus="continuous"

app:camera_permissions="camera" />

Then create a new CameraKitView object in your Activity and override the following methods.

private CameraKitView cameraKitView;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

cameraKitView = findViewById(R.id.camera);

}

@Override

protected void onStart() {

super.onStart();

cameraKitView.onStart();

}

@Override

protected void onResume() {

super.onResume();

cameraKitView.onResume();

}

@Override

protected void onPause() {

cameraKitView.onPause();

super.onPause();

}

@Override

protected void onStop() {

cameraKitView.onStop();

super.onStop();

}

@Override

public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {

super.onRequestPermissionsResult(requestCode, permissions, grantResults);

cameraKitView.onRequestPermissionsResult(requestCode, permissions, grantResults);

}

ProGuard

If using ProGuard, add the following rules:

-dontwarn com.google.android.gms.**

-keepclasseswithmembers class com.camerakit.preview.CameraSurfaceView {

native ;

}

License

CameraKit is MIT License

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值