洞察企业如何通过模块化APP集成工具高效管理多平台小程序
900
2022-10-31
一个非常容易使用的程序来处理臭名昭着的Android Camera和Camera2 API
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
Trusted By
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! | camerakit.io/docs/beta3.11 |
Photo and Video | v0.13.4 | Stable build with full photo and video support | camerakit.io/docs/0.13.4 |
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:
Then create a new CameraKitView object in your Activity and override the following methods.
private CameraKitView cameraKitView;@Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); cameraKitView = findViewById(R.id.camera);}@Overrideprotected void onStart() { super.onStart(); cameraKitView.onStart();}@Overrideprotected void onResume() { super.onResume(); cameraKitView.onResume();}@Overrideprotected void onPause() { cameraKitView.onPause(); super.onPause();}@Overrideprotected void onStop() { cameraKitView.onStop(); super.onStop();}@Overridepublic 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
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~