-
public abstract class CameraListenerThe base class for receiving updates from a CameraView instance. You can add and remove listeners using addCameraListener and removeCameraListener.
-
-
Method Summary
Modifier and Type Method Description voidonCameraOpened(@NonNull() CameraOptions options)Notifies that the camera was opened. voidonCameraClosed()Notifies that the camera session was closed. voidonCameraError(@NonNull() CameraException exception)Notifies about an error during the camera setup or configuration. voidonPictureTaken(@NonNull() PictureResult result)Notifies that a picture previously captured with takePicture or takePictureSnapshot is ready to be shown or saved to file. voidonVideoTaken(@NonNull() VideoResult result)Notifies that a video capture has just ended. voidonOrientationChanged(int orientation)Notifies that the device was tilted or the window offset changed.The orientation passed is exactly the counter-clockwise rotation that a View should have,in order to appear correctly oriented to the user, considering the way she isholding the device, and the native activity orientation.This is meant to be used for aligning views (e.g. voidonAutoFocusStart(@NonNull() PointF point)Notifies that user interacted with the screen and started metering with a gesture,and touch metering routine is trying to focus around that area.This callback can be used to draw things on screen. voidonAutoFocusEnd(boolean successful, @NonNull() PointF point)Notifies that a touch metering event just ended, and the camera convergedto a new focus, exposure and possibly white balance.This might succeed or not. voidonZoomChanged(float newValue, @NonNull() Array<float> bounds, @Nullable() Array<PointF> fingers)Notifies that a finger gesture just caused the camera zoomto be changed. voidonExposureCorrectionChanged(float newValue, @NonNull() Array<float> bounds, @Nullable() Array<PointF> fingers)Noitifies that a finger gesture just caused the camera exposure correctionto be changed. voidonVideoRecordingStart()Notifies that the actual video recording has started.This is the time when actual frames recording starts.This can be used to show some UI indicator for video recording or counting time. voidonVideoRecordingEnd()Notifies that the actual video recording has ended.At this point recording has ended, though the file might still be processed. voidonPictureShutter()Notifies that the picture capture has started. -
-
Method Detail
-
onCameraOpened
@UiThread() void onCameraOpened(@NonNull() CameraOptions options)
Notifies that the camera was opened.The CameraOptions object collects all supported options by the current camera.
- Parameters:
options- camera supported options
-
onCameraClosed
@UiThread() void onCameraClosed()
Notifies that the camera session was closed.
-
onCameraError
@UiThread() void onCameraError(@NonNull() CameraException exception)
Notifies about an error during the camera setup or configuration.At this point you should inspect the CameraException reason using getReason and see what should be done, if anything.If the error is unrecoverable, this is the right moment to show an error dialog, for example.
- Parameters:
exception- the error
-
onPictureTaken
@UiThread() void onPictureTaken(@NonNull() PictureResult result)
Notifies that a picture previously captured with takePicture or takePictureSnapshot is ready to be shown or saved to file.If planning to show a bitmap, you can use toBitmap to decode the byte arraytaking care about orientation and threading.
- Parameters:
result- captured picture
-
onVideoTaken
@UiThread() void onVideoTaken(@NonNull() VideoResult result)
Notifies that a video capture has just ended.
- Parameters:
result- the video result
-
onOrientationChanged
@UiThread() void onOrientationChanged(int orientation)
Notifies that the device was tilted or the window offset changed.The orientation passed is exactly the counter-clockwise rotation that a View should have,in order to appear correctly oriented to the user, considering the way she isholding the device, and the native activity orientation.This is meant to be used for aligning views (e.g. buttons) to the current camera viewport.
- Parameters:
orientation- either 0, 90, 180 or 270
-
onAutoFocusStart
@UiThread() void onAutoFocusStart(@NonNull() PointF point)
Notifies that user interacted with the screen and started metering with a gesture,and touch metering routine is trying to focus around that area.This callback can be used to draw things on screen.Can also be triggered by startAutoFocus.
- Parameters:
point- coordinates with respect to CameraView.getWidth() and CameraView.
-
onAutoFocusEnd
@UiThread() void onAutoFocusEnd(boolean successful, @NonNull() PointF point)
Notifies that a touch metering event just ended, and the camera convergedto a new focus, exposure and possibly white balance.This might succeed or not.Can also be triggered by startAutoFocus.
- Parameters:
successful- whether metering succeededpoint- coordinates with respect to CameraView.getWidth() and CameraView.
-
onZoomChanged
@UiThread() void onZoomChanged(float newValue, @NonNull() Array<float> bounds, @Nullable() Array<PointF> fingers)
Notifies that a finger gesture just caused the camera zoomto be changed. This can be used to draw, for example, a seek bar.
- Parameters:
newValue- the new zoom valuebounds- min and max bounds for newValue (fixed to 0 ...fingers- finger positions that caused the event, null if not caused by touch
-
onExposureCorrectionChanged
@UiThread() void onExposureCorrectionChanged(float newValue, @NonNull() Array<float> bounds, @Nullable() Array<PointF> fingers)
Noitifies that a finger gesture just caused the camera exposure correctionto be changed. This can be used to draw, for example, a seek bar.
- Parameters:
newValue- the new correction valuebounds- min and max bounds for newValue, as returned by CameraOptionsfingers- finger positions that caused the event, null if not caused by touch
-
onVideoRecordingStart
@UiThread() void onVideoRecordingStart()
Notifies that the actual video recording has started.This is the time when actual frames recording starts.This can be used to show some UI indicator for video recording or counting time.
-
onVideoRecordingEnd
@UiThread() void onVideoRecordingEnd()
Notifies that the actual video recording has ended.At this point recording has ended, though the file might still be processed.The onVideoTaken callback will be called soon.This can be used to remove UI indicators for video recording.
-
onPictureShutter
@UiThread() void onPictureShutter()
Notifies that the picture capture has started. Can be used to update the UI for visualconfirmation or sound effects.
-
-
-
-