Quick Start Document

Here is a simple guide to get up and running with Horizon SDK in under 5 minutes! If you are looking how you can integrate Horizon SDK to your new or existing project, head over the the Installation Guide.


Once the SDK is installed, ensure you initialize the SDK upon application launch. For most applications, this can be done in application:didFinishLaunchingWithOptions: of your UIApplicationDelegate class.

The example below contains a placeholder API key, so after placing the code be sure to replace it with your own.

@import HorizonSDK;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    [[HVTSDK sharedInstance] activateWithAPIKey:@"<PLACEHOLDER API KEY>"];

    return YES;

After initializing Horizon SDK, you can choose between two different approaches: Using the HVTCameraController or handling the whole process programmatically with HVTCamera.

The first approach provides a fast and easy way of displaying a camera interface with all the controls your users will need to capture videos or shoot photos. The second one provides you with more flexibiliy and control over the camera, the previews and the UI.

1. Using HVTCameraController

The HVTCameraController has similar behavior with the build-in UIImagePickerController of the UIKit framework.

To get started with the HVTCameraController, first instantiate one.

HVTCameraController *myController = [HVTCameraController new];

Provide any additional properties, such as the supported mediaTypes and cameraCaptureMode.

myController.mediaTypes = @[(NSString*)kUTTypeMovie, (NSString*)kUTTypeImage];
myController.cameraCaptureMode = HVTCameraControllerCameraCaptureModeVideo;

Provide a delegate object that the controller will send its notifications.

myController.cameraDelegate = myCameraControllerDelegate;

Present the controller.

[self presentViewController:myController animated:YES completion:nil];

It is expected that you implement the two methods of HVTCameraControllerDelegate protocol, in order to deal with the recorded videos/photos or the event of the user cancelling the controller.

2. Using HVTCamera

Create an HVTCamera instance in your view controller.

HVTCamera *camera = [HVTCamera new];

If you are using the Interface Builder to create your view controllers, then you must instantiate HVTCamera in the viewDidLoad method instead of the initWithCoder:.

If you are creating the view controllers programmatically then you can use the init or initWithFrame: methods to instantiate the HVTCamera.

Optionally, you can set the interfaceOrientation property to the UI orientation of your UIViewController.

camera.interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];

If your app supports multiple orientations, follow the instructions provided in [HVTCamera interfaceOrientation].

You can also set the camera’s delegate defined in the HVTCameraDelegate protocol and implement the protocol’s methods in order to handle events like movie recording and photo capturing.

camera.delegate = myCameraDelegate;

Displaying Video preview

In order to display a video preview, you can create an HVTView programmatically or via the Interface Builder.

To create a HVTView programmatically, you can do the following.

HVTView *videoPreview = [[HVTView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
videoPreview.center = self.view.center;
[self.view addSubview:videoPreview];

Attach this view to your camera by calling HVTCamera’s addView method.

[camera addView:videoPreview];


Open the camera by running the camera instance.

[camera startRunning];

Make sure you have handled all the camera & microphone permissions as startRunning will throw an exception if it can’t access camera or microphone devices.

You can request camera/microphone access by calling AVCaptureDevice’s requestAccessForMediaType:completionHandler: method for AVMediaTypeVideo and AVMediaTypeAudio types.


To start video recording call HVTCamera’s startRecordingWithMovieURL:.

Provide a NSURL with the file path the movie will be saved to.

Here’s an example:

NSURL *recordingURL = [[NSURL alloc] initFileURLWithPath:[NSString pathWithComponents:@[NSTemporaryDirectory(), @"movie.mov"]]];

[camera startRecordingWithMovieURL:_recordingURL];

To stop recording call the stopRecording method.

There you have it! Your fist video recording app!

Well done! You now have a video recording application, able to record horizontal videos no matter what! You can learn more about every single class and method by taking a look at the API reference.

Swift Support

Horizon SDK is built on Objective-C, but it supports projects built on the Swift language.

You can get Horizon SDK to work with your Swift project, just by following the same instructions found in the Installation Guide.

You can also take a look at the HorizonSDK sample project written in Swift, provided with the library.