Skip to main content
VESDK/iOS/Guides/Audio Overlays/Custom Libraries

Custom Audio

VideoEditor SDK for iOS allows extension of predefined audio clip categories by implementing a custom audio view controller

Custom audio view controller#

Predefined audio clip categories can be extended by providing a custom view controller that is automatically added to the view hierarchy when selecting the appropriate custom category. The view controller instance must be exposed by an object conforming to AudioCollection protocol. The selected audio clip can then be added to the composition by calling the AudioCollectionDelegate.

The audio clip will also be embedded in the serialization if it was not removed from the composition before the export. For further information on how to serialize and deserialize your custom assets, please take a look at our dedicated serialization section.

class CustomAudioController: UIViewController, AudioCollection {
var viewController: UIViewController { self }
weak var delegate: AudioCollectionDelegate?
// Add custom views.
func someAction() {
delegate?.audioCollection(self, didSelect: AudioClip(identifier: UUID().uuidString, audioURL: URL(string: "https://sample.audio")!))
}
}

A custom category can be added to the existing categories in a familiar way. Instead of passing an audioClips array, you should provide an audioCollection object.

let customAudioClipCategory = AudioCollectionCategory(title: "Custom Controller", imageURL: nil, audioCollection: CustomAudioController())
let configuration = Configuration { builder in
let assetCatalog = AssetCatalog.defaultItems
assetCatalog.audioClips.append(customAudioClipCategory)
builder.assetCatalog = assetCatalog
}

Consult the next section to learn how to use external APIs such as audio search engines as a data source for your custom audio clip categories.