Skip to main content
VESDK/iOS/Guides/Adjustments
Language:

Configure Adjustments

VideoEditor SDK supports several configuration options for the AdjustToolController allowing flexible adaptation to different needs and use cases. For a detailed explanation of how to configure different editor views, refer to this guide.

showResetButton#

By default, users are able to reset all the applied adjust operations. In our example, we hide the reset button.

allowedAdjustTools#

The set of available adjust tools can be configured by assigning an array to the allowedAdjustTools property. In our example, we only want to provide adjustments for brightness, contrast and saturation.

File:
import UIKit
import VideoEditorSDK
class VideoAdjustmentsConfigurationSwift: Example, VideoEditViewControllerDelegate {
override func invokeExample() {
// Create a `Video` from a URL to a video in the app bundle.
let video = Video(url: Bundle.main.url(forResource: "Skater", withExtension: "mp4")!)
// Create a `Configuration` object.
let configuration = Configuration { builder in
builder.configureAdjustToolController { options in
// By default the editor always shows the reset button.
// For this example, the reset button should not be shown.
options.showResetButton = false
// By default the editor shows all avaliable adjust tools.
// For this example, the editor should only show a small selection
// of them.
options.allowedAdjustTools = [.brightness, .contrast, .saturation]
}
}
// Create and present the video editor. Make this class the delegate of it to handle export and cancelation.
let videoEditViewController = VideoEditViewController(videoAsset: video, configuration: configuration)
videoEditViewController.delegate = self
videoEditViewController.modalPresentationStyle = .fullScreen
presentingViewController?.present(videoEditViewController, animated: true, completion: nil)
}
// MARK: - VideoEditViewControllerDelegate
func videoEditViewControllerShouldStart(_ videoEditViewController: VideoEditViewController, task: VideoEditorTask) -> Bool {
// Implementing this method is optional. You can perform additional validation and interrupt the process by returning `false`.
true
}
func videoEditViewControllerDidFinish(_ videoEditViewController: VideoEditViewController, result: VideoEditorResult) {
// The user exported a new video successfully and the newly generated video is located at `result.output.url`. Dismissing the editor.
presentingViewController?.dismiss(animated: true, completion: nil)
}
func videoEditViewControllerDidFail(_ videoEditViewController: VideoEditViewController, error: VideoEditorError) {
// There was an error generating the video.
print(error.localizedDescription)
// Dismissing the editor.
presentingViewController?.dismiss(animated: true, completion: nil)
}
func videoEditViewControllerDidCancel(_ videoEditViewController: VideoEditViewController) {
// The user tapped on the cancel button within the editor. Dismissing the editor.
presentingViewController?.dismiss(animated: true, completion: nil)
}
}