@@ -590,14 +590,14 @@ public void onError(int error, Camera camera) {
590
590
});
591
591
592
592
try {
593
-
594
- // If the phone has a flash, we turn it on/off according to mFlashEnabled
595
- // setRecordingHint(true) is a very nice optimization if you plane to only use the Camera for recording
596
593
Parameters parameters = mCamera .getParameters ();
597
- if (parameters .getFlashMode ()!=null ) {
598
- parameters .setFlashMode (mFlashEnabled ?Parameters .FLASH_MODE_TORCH :Parameters .FLASH_MODE_OFF );
594
+ parameters .setFocusMode (Parameters .FOCUS_MODE_CONTINUOUS_VIDEO ); // Enable autofocus
595
+ parameters .setRecordingHint (true ); // Lets the camera preview start faster.
596
+
597
+ if (parameters .getFlashMode ()!=null ) { // Set flash as requested, if it's present.
598
+ parameters .setFlashMode (mFlashEnabled ? Parameters .FLASH_MODE_TORCH : Parameters .FLASH_MODE_OFF );
599
599
}
600
- parameters . setRecordingHint ( true );
600
+
601
601
mCamera .setParameters (parameters );
602
602
mCamera .setDisplayOrientation (mOrientation );
603
603
@@ -611,12 +611,10 @@ public void onError(int error, Camera camera) {
611
611
} catch (IOException e ) {
612
612
throw new InvalidSurfaceException ("Invalid surface !" );
613
613
}
614
-
615
614
} catch (RuntimeException e ) {
616
615
destroyCamera ();
617
616
throw e ;
618
617
}
619
-
620
618
}
621
619
}
622
620
@@ -638,7 +636,6 @@ protected synchronized void destroyCamera() {
638
636
}
639
637
640
638
protected synchronized void updateCamera () throws RuntimeException {
641
-
642
639
// The camera is already correctly configured
643
640
if (mUpdated ) return ;
644
641
@@ -648,6 +645,8 @@ protected synchronized void updateCamera() throws RuntimeException {
648
645
}
649
646
650
647
Parameters parameters = mCamera .getParameters ();
648
+ parameters .setFocusMode (Parameters .FOCUS_MODE_CONTINUOUS_VIDEO );
649
+
651
650
mQuality = VideoQuality .determineClosestSupportedResolution (parameters , mQuality );
652
651
int [] max = VideoQuality .determineMaximumSupportedFramerate (parameters );
653
652
0 commit comments