florent37 / CameraFragment

A simple easy-to-integrate Camera Fragment for Android
Apache License 2.0
2.29k stars 421 forks source link

Camera capture not happening. #113

Open sreekanth100khere opened 5 years ago

sreekanth100khere commented 5 years ago

While the device is moving if we click capture button, then the camera capture not happening. Mostly observed in OS version pie, Handsets observed is Poco and OnePlus. But if we keep the device to upside down with camera facing ground or cover with the hand the capture happens. but we get a black image.

@Override public void takePhoto(File photoFile, CameraPhotoListener cameraPhotoListener, CameraFragmentResultListener callback) { this.outputPath = photoFile; this.cameraPhotoListener = cameraPhotoListener; this.callback = callback;

    backgroundHandler.post(new Runnable() {
        @Override
        public void run() {

            lockFocus();
        }
    });

}

lockFocus() doesnot get called. final CameraFragmentApi cameraFragment = getCameraFragment();

    if (cameraFragment != null) {
        cameraFragment.takePhotoOrCaptureVideo(new CameraFragmentResultAdapter() {
            @Override
            public void onVideoRecorded (String filePath) {
           }

            @Override
            public void onPhotoTaken (byte[] bytes, String filePath) {
            }

onPhotoTaken not getting called.