Skip to main content
Language:

Configure Overlays

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

initialOverlayIntensity#

The default intensity of filters is set to 100% (1.0). In this example, we only want to have 50% (0.5) intensity. Since showOverlayIntensitySlider is set to false, the filters will always be applied with a fixed intensity of 50%.

showOverlayIntensitySlider#

By default, the editor will show the slider to change the intensity of the selected filter. In our example, the slider should not be shown since we only want a specific intensity to be applied.

File:
import UIKit
import VideoEditorSDK
class VideoOverlaysConfigurationSwift: 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
// Configure the `OverlayToolController` which lets the user
// place overlays on top of the video.
builder.configureOverlayToolController { options in
// By default the editor has an initial overlay intensity of
// 100% (1). For this example it only uses 50% (0.5).
options.initialOverlayIntensity = 0.5
// By default the editor shows a slider to let the user change
// the intensity of an overlay. For this example this is disabled.
// Thereby the overlays will always have an intensity of 50% (0.5)
// since we applied this with the `initialOverlayIntensity`.
options.showOverlayIntensitySlider = false
}
}
// 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)
}
}