public interface

HVTCameraListener

com.hvt.horizonSDK.HVTCameraListener

Class Overview

Listener interface used to deliver the events of HVTCamera regarding the running state, recording status, handle errors and update the UI.

All methods are called at the UI thread.

Summary

Public Methods
abstract void onAngleUpdated(float rotation, float scale)
Called when the leveler calculates the rotation and scale of the crop region of a new camera frame.
abstract void onFailedToStart()
Called when HVTCamera fails to start running.
abstract void onPhotoCaptured(File file, boolean success)
Called when a photo has been captured.
abstract void onPreviewHasBeenRunning(Camera.Parameters params, int facing)
Called after onStartedRunning(), when a couple of frames have been actually processed by HVTCamera.
abstract void onRecordingFinished(File file, boolean success)
Called when movie recording has finished.
abstract void onRecordingHasStarted()
Called when recording has finished initializing and it has started.
abstract void onRecordingWillStop()
Called when the recording process is trying to stop.
abstract void onSensorNotResponding()
Called when the leveler doesn't get updates from the device's motion sensor after a few seconds have passed since startRunning() was called.
abstract void onSensorResponded()
Called when the leveler receives the first update from the device's motion sensor after stopRunning() was called.
abstract void onSnapshotCaptured(File file)
Called when a snapshot has be captured.
abstract void onStartedRunning(Camera.Parameters params, int facing)
Called when HVTCamera starts running.
abstract void onStoppedRunning()
Called after onWillStopRunning() when HVTCamera has actually stopped running.
abstract void onWillStopRunning()
Called when HVTCamera is about to stop running.

Public Methods

public abstract void onAngleUpdated (float rotation, float scale)

Called when the leveler calculates the rotation and scale of the crop region of a new camera frame.

Implement this method to be notified of the updated angle and scale of the crop region in order to adjust your interface elements (i.e. rotate or/and scale your UI elements).

The angle represents the angle the crop region was rotated in clock-wise fashion.

The scale is the scale factor applied to the crop region. A scale of 1.0 is when the crop region's height matches the camera's frame height. You usually don't have to use this property.

If you have an attached HVTView and you want to know the exact size (in pixels) and rotation of the crop region, use getOutputFramePlacement().

Parameters
rotation the angle of the crop frame in rads
scale the scale factor of the crop frame

public abstract void onFailedToStart ()

Called when HVTCamera fails to start running.

This is called probably because the camera is already in use. You should inform the user to try again later.

Another reason would be that the supplied parameters at setCamera(int, Size, Size) where not valid.

public abstract void onPhotoCaptured (File file, boolean success)

Called when a photo has been captured.

Parameters
file the file the photo was saved to
success true if successful, false if it failed

public abstract void onPreviewHasBeenRunning (Camera.Parameters params, int facing)

Called after onStartedRunning(), when a couple of frames have been actually processed by HVTCamera.

Even after onStartedRunning() is called, it may take a while until the camera starts to produce frames. This method is called after a few frames have processed.

This method is called when an attached HVTView has started updating its preview. So, you may want to adjust your UI when this method is called.

Parameters
params the parameters of the camera that was just opened by HVTCamera
facing the facing of the camera. Can be CAMERA_FACING_BACK or CAMERA_FACING_FRONT

public abstract void onRecordingFinished (File file, boolean success)

Called when movie recording has finished.

Parameters
file the file the movie was saved to
success true if successful, false if it failed
See Also

public abstract void onRecordingHasStarted ()

Called when recording has finished initializing and it has started.

public abstract void onRecordingWillStop ()

Called when the recording process is trying to stop.

It's called before onRecordingFinished(File, boolean).

You may want to adjust your interface so that the user knows that the app is busy processing the movie.

See Also

public abstract void onSensorNotResponding ()

Called when the leveler doesn't get updates from the device's motion sensor after a few seconds have passed since startRunning() was called.

This may happen because there was an error in the device's sensor service. This usually requires a device restart.

You may may want to prompt the user to restart his device.

public abstract void onSensorResponded ()

Called when the leveler receives the first update from the device's motion sensor after stopRunning() was called.

If onSensorNotResponding() was called previously, it means that the problem has been resoled. If you displayed a warning message to the user, you may want to hide it now.

public abstract void onSnapshotCaptured (File file)

Called when a snapshot has be captured.

Parameters
file the file the snapshot was saved to

public abstract void onStartedRunning (Camera.Parameters params, int facing)

Called when HVTCamera starts running.

Parameters
params the parameters of the camera that was just opened by HVTCamera
facing the facing of the camera. Can be CAMERA_FACING_BACK or CAMERA_FACING_FRONT

public abstract void onStoppedRunning ()

Called after onWillStopRunning() when HVTCamera has actually stopped running.

public abstract void onWillStopRunning ()

Called when HVTCamera is about to stop running.

It's called before onStoppedRunning().

The attached HVTView is going to stop updating the preview. So, you may want to adjust your UI when this method is called.