Overview
VideoEditor SDK for iOS allows to create and/or integrate custom audio controllers and libraries into the video editor. For a detailed overview of the integration process, please take a look at our dedicated integration sections.
Serialization / Deserialization#
In order to serialize and deserialize custom audio assets that are not included in the AssetCatalog
(e.g. when loaded via a custom controller / an external library) you need to implement your own controller that conforms to the AssetResolver
protocol. Each AssetResolver
needs to have an unique identifier which is used by the SDK to determine which resolver is responsible for which assets. This said, you need to ensure that you are assigning the correct resolver identifier to the AudioClip
.
class ExternalAudioResolver: AssetResolver {/// The unique identifier of this `AssetResolver`.static let identifier = "YOUR_ASSET_RESOLVER_IDENTIFIER"func deserialize(from data: [String: String], completion: @escaping (ResolvableAsset?) -> Void) {// Deserialize the data and call completion handler.let identifier = data["identifier"]!let url = data["url"]!let audioClip = AudioClip(identifier: identifier, audioURL: URL(string: url)!, resolver: ExternalAudioResolver.identifier)completion(audioClip)}func serialize(_ asset: ResolvableAsset) -> [String: String]? {// Serialize the asset and return data.nil}}
In order for the SDK to use your AssetResolver
during serialization and deserialization, you need to register it:
IMGLY.assetResolvers = [ExternalAudioResolver.identifier: ExternalAudioResolver()]
Integration#
Take a look on how to create/integrate your custom audio libraries: