com.hvt.horizonSDK.HVTCameraListener |
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.
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 |
onRecordedDataIncreased(long totalBytes, long totalEstimatedBytes)
Called when the size of the video being recorded increases.
| ||||||||||
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. |
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()
.
rotation | the angle of the crop frame in rads |
---|---|
scale | the scale factor of the crop frame |
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.
Called when a photo has been captured.
file | the file the photo was saved to |
---|---|
success | true if successful, false if it failed
|
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.
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
|
Called when the size of the video being recorded increases.
The method is called when the size increases around 1MB since the previous call.
totalBytes | The number of bytes written, due the audio and video streams. |
---|---|
totalEstimatedBytes | When muxing the provided audio and video stream, some extra bytes are added (around 500 bytes per second). Since we have no way of getting the exact number, we estimate them. So, this number is the bytes from the audio and video stream, plus the estimated bytes added by the muxer. |
Called when movie recording has finished.
file | the file the movie was saved to |
---|---|
success | true if successful, false if it failed
|
Called when recording has finished initializing and it has started.
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.
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.
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.
Called when a snapshot has be captured.
file | the file the snapshot was saved to |
---|
Called when HVTCamera
starts running.
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
|
Called after onWillStopRunning()
when HVTCamera
has actually stopped
running.
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.