HVTCameraDelegate Protocol Reference
Conforms to | NSObject |
---|---|
Declared in | HVTCamera.h |
Overview
The HVTCameraDelegate protocol defines delegate methods you should implement in order to get updates from an HVTCamera instance about the running state, recording status, handle errors and update the UI.
All the delegate methods are invoked in the main thread.
Interface Delegate Method
– hvtCamera:didUpdateParams:
required method
Implement this method to be notified of the updated device angle and computed scale factors in order to adjust your interface elements (i.e. rotate your UI elements).
- (void)hvtCamera:(HVTCamera *)hvtCamera didUpdateParams:(HVTParams)params
Parameters
hvtCamera |
The HVTCamera object calling the delegate method. |
---|---|
params |
The angle (physical yaw) of the device in rads and scale values. |
Discussion
The angle represents the yaw of the device (in the real world) at the time the latest video frame was received by the device’s camera.
The scale represents the scale that has to be applied to the frame depending on the active levelerCropMode and the angle of the device.
You may want to rotate your UI elements to match the attached HVTView(s) appearence as illustrated in the following code fragment:
- (void)hvtCamera:(HVTCamera *)hvtCamera didUpdateParams:(HVTParams)params
{
[_uiElement setTransform:CGAffineTransformMakeRotation(params.angle)];
}
The calling frequency matches the frame rate of the HVTCamera instance.
Declared In
HVTCamera.h
Running State Delegate Method
– hvtCameraDidStartRunning:
Called when HVTcamera starts running.
- (void)hvtCameraDidStartRunning:(HVTCamera *)hvtCamera
Parameters
hvtCamera |
The HVTCamera object calling the delegate method. |
---|
Declared In
HVTCamera.h
– hvtCamera:didStopRunningWithError:
Called when HVTcamera stops running due to an error.
- (void)hvtCamera:(HVTCamera *)hvtCamera didStopRunningWithError:(NSError *)error
Parameters
hvtCamera |
The HVTCamera object calling the delegate method. |
---|---|
error |
The error occured. |
Declared In
HVTCamera.h
Recording Delegate Methods
– hvtCameraRecordingDidStart:
Called when video recording has begun.
- (void)hvtCameraRecordingDidStart:(HVTCamera *)hvtCamera
Parameters
hvtCamera |
The HVTCamera object calling the delegate method. |
---|
Declared In
HVTCamera.h
– hvtCamera:didUpdateRecordingDuration:
Implement this method to get the updated recording duration in order to update duration counters in your interface.
- (void)hvtCamera:(HVTCamera *)hvtCamera didUpdateRecordingDuration:(NSTimeInterval)duration
Parameters
hvtCamera |
The HVTCamera object calling the delegate method. |
---|---|
duration |
The video duration up until this point as a NSTimeInterval variable. |
Discussion
This method is called for every recorded frame when recording a video.
Declared In
HVTCamera.h
– hvtCameraRecordingWillStop:
Called when video recording is going to stop.
- (void)hvtCameraRecordingWillStop:(HVTCamera *)hvtCamera
Parameters
hvtCamera |
The HVTCamera object calling the delegate method. |
---|
Declared In
HVTCamera.h
– hvtCamera:didStopRecordingWithMetadata:
Called when video recording has stopped successfully. You can access the recorded
video’s properties through the metadata
NSDictionary.
- (void)hvtCamera:(HVTCamera *)hvtCamera didStopRecordingWithMetadata:(NSDictionary *)metadata
Parameters
hvtCamera |
The HVTCamera object calling the delegate method. |
---|---|
metadata |
The NSDictionary containing information of the recorded video. |
Declared In
HVTCamera.h
– hvtCamera:recordingDidFailWithError:
Called when video recording has stopped due to an error.
- (void)hvtCamera:(HVTCamera *)hvtCamera recordingDidFailWithError:(NSError *)error
Parameters
hvtCamera |
The HVTCamera object calling the delegate method. |
---|---|
error |
The error occured |
Declared In
HVTCamera.h
Photo Capturing Delegate Methods
– hvtCamera:didCapturePhotoData:metadata:
Called when a photo has been captured
- (void)hvtCamera:(HVTCamera *)hvtCamera didCapturePhotoData:(NSData *)photo metadata:(NSDictionary *)metadata
Parameters
hvtCamera |
The HVTCamera object calling the delegate method. |
---|---|
photo |
The photo captured as NSData (JPEG representation) |
metadata |
The photo metadata (already passed inside the NSData structure) |
Declared In
HVTCamera.h
– hvtCamera:didCapturePhotoImageRef:metadata:
Called when a photo has been captured
- (void)hvtCamera:(HVTCamera *)hvtCamera didCapturePhotoImageRef:(CGImageRef)photo metadata:(NSDictionary *)metadata
Parameters
hvtCamera |
The HVTCamera object calling the delegate method. |
---|---|
photo |
The photo captured as CGImageRef |
metadata |
The photo metadata |
Declared In
HVTCamera.h
– hvtCamera:photoCapturingDidFailWithError:
Called when photo capturing has not been completed successfully due to an error.
- (void)hvtCamera:(HVTCamera *)hvtCamera photoCapturingDidFailWithError:(NSError *)error
Parameters
hvtCamera |
The HVTCamera object calling the delegate method. |
---|---|
error |
The error occured |
Declared In
HVTCamera.h