CameraFragment icon indicating copy to clipboard operation
CameraFragment copied to clipboard

Unable to capture multiple photos (Live view changes to preview)

Open arshdoda opened this issue 7 years ago • 4 comments

I want to take multiple photos at once without previewing the image. But on taking 1st picture live view changes to preview mode and if i capture the picture again app crashes.

arshdoda avatar Oct 03 '17 05:10 arshdoda

I am suffering from this issue, right now I am recreating the Camera Fragment but this cause a black screen appear for 2 or 3 seconds

RHoumaidy avatar Oct 03 '17 07:10 RHoumaidy

m doing the same. but i don't want that

arshdoda avatar Oct 03 '17 07:10 arshdoda

if you solve the issue. please update me

arshdoda avatar Oct 03 '17 07:10 arshdoda

You have to change Camera1Manager.java to continue showing preview.

camera.startPreview();

public void takePhoto(File photoFile, final CameraPhotoListener cameraPhotoListener, final CameraFragmentResultListener callback) {
this.outputPath = photoFile;
this.photoListener = cameraPhotoListener;
    EventBus.getDefault().post(new RecordStateEvent(RecordStateEvent.State.Photo));
    backgroundHandler.post(new Runnable() {
        @Override
        public void run() {
            setCameraPhotoQuality(camera);
            try {
                camera.takePicture(null, null, new Camera.PictureCallback() {
                    @Override
                    public void onPictureTaken(byte[] bytes, Camera camera) {
                        Camera1Manager.this.onPictureTaken(bytes, camera, callback);
                        camera.startPreview();
                    }
                });
            } catch (Exception e) {
                Log.e(TAG, "takePhoto error: "+e.getMessage()+" (usually caused by a double tap on photo trigger)");
                if(cameraPhotoListener!=null)
                    cameraPhotoListener.onPhotoTakeError();
            }
        }
    });
}

polaris0227 avatar Mar 31 '18 13:03 polaris0227