CameraKit / camerakit-android

Library for Android Camera 1 and 2 APIs. Massively increase stability and reliability of photo and video capture on all Android devices.
https://camerakit.io
MIT License
5.36k stars 876 forks source link

Working perfectly in Android 4, but not work in Android 8. Same code. #510

Open SlonGL opened 5 years ago

SlonGL commented 5 years ago

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Two phones. API 17 (4.2.2) - everything working perfectly API 27 (8.1.0) - In onCreate - togleFacing() working, but in fun called with button onClick - no. CaptureImage - same.

Steps to Reproduce

start app, call activity with camera. in 4.2 - ok, in 8.1 - no. Permissions Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA asked in manifest for 4.2 and asked in app for 8.1

Same issue for emulator API 28

Expected Behaviour

Photo onClick photo button, and toggle facing onCllck toggle button.

Actual Behaviour

public fun rotateCameraButtonPressed(view : View) { cameraKitView?.toggleFacing() // has no effect, but works ok when called from onCreate. // Is called when press button, I checked it with breakpoint in debug }

Hasiy commented 5 years ago

我也有相同的问题但将代码改成 如下似乎没问题了 on xml <com.camerakit.CameraKitView android:id="@+id/camera_kit" android:layout_width="match_parent" android:layout_height="wrap_content" android:adjustViewBounds="true" android:keepScreenOn="true" />

on kotlin private fun setCameraKit() { cameraKitView = findViewById(R.id.camera_kit) cameraKitView.facing = FACING_BACK cameraKitView.flash = FLASH_OFF cameraKitView.focus = FOCUS_AUTO }

KaelMa commented 5 years ago

same as @SlonGL . @Hasiy 's solution not work.

KaelMa commented 5 years ago

toggleFacing not work in Xiaomi Mi6 in 1.0.0-beta4 , but works in 0.13.6.

update: Pixel 1 (Android 9) works perfectly Xiaomi Mi 6 (Android 8) not work, toggleFacing() just freeze the frame.

API version: 1.0.0-beta4

update1: Camera1 impl works in Mi 6, it's a bug in Camera2 implementation