Docs
API Docs

Getting Started

Requirements

PhotoEditor SDK 10 requires Xcode 11.0, Swift 5.1 and iOS 9 and above. If you have to use older versions of Swift or support older versions of iOS, please have a look at previous versions.

CocoaPods

VideoEditor SDK is available via CocoaPods. If you’re new to CocoaPods, this Getting Started Guide will help you. CocoaPods is the preferred and simplest way to use the VideoEditor SDK.

Important: Please make sure that you have a CocoaPods version >= 0.39.0 installed. You can check your version of CocoaPods with pod --version.

Here’s what you have to add to your Podfile:

use_frameworks!

pod 'VideoEditorSDK'

To make sure you’re fetching the latest SDK version, run pod repo update. Then run pod install to install the SDK.

License file

Before using any components of the VideoEditor SDK, you have to unlock the SDK using your license key file. It is important that you set the license key before using any of the SDK classes.

func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
  if let licenseURL = Bundle.main.url(forResource: "license", withExtension: "") {
    VESDK.unlockWithLicense(at: licenseURL)
  }

  return true
}
- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [VESDK unlockWithLicenseAt:[[NSBundle mainBundle] URLForResource:@"license" withExtension:@""]];
  return YES;
}

The license is digitally signed so it can not be altered without becoming invalid. Our sample app comes with its own license, so you can try that right away. To try our SDK in your own app, you’ll have to request a trial license because a license is bound to a bundle identifier. You can request a demo license at https://account.photoeditorsdk.com/signup.

Once you retrieved the license file it can be used to unlock the view controller. The following examples demonstrates how to unlock the SDK.

Manually

You can integrate PhotoEditor SDK into your project manually via a dynamic framework.

1) Download the SDK here, then simply drag ImglyKit.framework as well as VideoEditorSDK.framework into the Embedded Binaries section of your target:

Embedded Binaries

2) Open your project’s Build Phases tab and add a new Run Script Phase somewhere below the Embed Frameworks phase. Then copy the following line into the newly created build phase’s text field:

bash "$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/ImglyKit.framework/strip-framework.sh"

Run Script Phase

This script will remove the simulator slices from the universal binary, because Xcode currently does not allow uploading apps that contain slices for both, the simulator and for devices.

3) If you are integrating the VideoEditor SDK into an otherwise Objective-C only project you also have to set the Always Embed Swift Standard Libraries build setting in your project’s Build Settings tab to Yes.

4) To receive symbolicated crash logs, you need to include our debug symbols. Copy the ImglyKit.framework.dSYM and VideoEditorSDK.framework.dSYM files to your project’s tree without adding it to any of your targets. Then add the copied file as an input file to the Run Script Phase of step 2.

Copy dSYM

Our SDK provides two main view controllers. One to work with the camera and the other to edit an image. In the following section, we will first explain how the licensing works and then how the basic view controllers are set up. We will also demonstrate how they can be embedded into a UINavigationController.

Add Import Statement

You have to add an import statement like this:

import VideoEditorSDK
@import VideoEditorSDK;

Add a CameraViewController

The CameraViewController class is responsible for displaying an interface to interact with the camera. It provides user interface elements among others to enable the flash, toggle the camera and choose a filter. All you have to do is the following:

let cameraViewController = CameraViewController()
present(cameraViewController, animated: true, completion: nil)
PESDKCameraViewController *cameraViewController = [[PESDKCameraViewController alloc] init];
[self presentViewController:cameraViewController animated:YES completion:nil];

The CameraViewController has completionBlock, dataCompletionBlock and cancelBlock properties, which will be called after an action was taken within the camera.

Add a VideoEditViewController

The VideoEditViewController class is responsible for presenting and rendering a video. It can be presented modally in which case it will display a toolbar at the bottom or it can be pushed onto a UINavigationController in which case it will use the navigation controller’s navigation bar. It also handles presentation of PhotoEditToolController subclasses.

To present a VideoEditViewController just add these few lines:

let video = Video(url: Bundle.main.url(forResource: "sample_video", withExtension: "mp4")!)

let videoEditViewController = VideoEditViewController(videoAsset: video)
videoEditViewController.delegate = self

present(videoEditViewController, animated: true, completion: nil)
PESDKConfiguration *configuration = [[PESDKConfiguration alloc] initWithBuilder:^(PESDKConfigurationBuilder * _Nonnull builder) {
  // See Configuration section
}];

PESDKVideo *video = [[PESDKVideo alloc] initWithUrl:[[NSBundle main] URLForResource:@"sample_video" withExtension:@"mp4"]];

PESDKVideoEditViewController *videoEditViewController = [[PESDKVideoEditViewController alloc] initWithVideoAsset:video configuration:configuration];
videoEditViewController.delegate = self;

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

Here, we set the delegate of the videoEditViewController object to self. That means that the presenting view controller must implement the PhotoEditViewControllerDelegate protocol. The methods of the PhotoEditViewControllerDelegate protocol are designed to inform the delegate about the result of the editing process (for example cancellation).

The method that gets called when the user confirms the changes is func photoEditViewController(_ photoEditViewController: MediaEditViewController, didFinishWithVideoAt url: URL?). It provides the resulting video as an URL object.

Embed in an UINavigationController

The controllers provided with the SDK can be embedded in an UINavigationController. The following code demonstrates how.

let video = Video(url: Bundle.main.url(forResource: "sample_video", withExtension: "mp4")!)

let videoEditViewController = VideoEditViewController(videoAsset: video)
videoEditViewController.delegate = self

let navigationController = UINavigationController(rootViewController: videoEditViewController)
present(navigationController, animated: true, completion: nil)
PESDKConfiguration *configuration = [[PESDKConfiguration alloc] initWithBuilder:^(PESDKConfigurationBuilder * _Nonnull builder) {
  // See Configuration section
}];

PESDKVideo *video = [[PESDKVideo alloc] initWithUrl:[[NSBundle main] URLForResource:@"sample_video" withExtension:@"mp4"]];

PESDKVideoEditViewController *videoEditViewController = [[PESDKVideoEditViewController alloc] initWithVideoAsset:video configuration:configuration];
videoEditViewController.delegate = self;

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:videoEditViewController];
[self presentViewController:navigationController animated:YES completion:nil];

To try these examples, and find out about more options please take a look at the sample project provided in the demo repository .