Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Example/Example/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,31 @@ class ViewController: UIViewController, BanubaVideoEditorDelegate, BanubaPhotoEd
}
}

func videoEditor(_ videoEditor: BanubaVideoEditor, shouldProcessMediaUrls urls: [URL]) -> Bool {
guard let jpegURL = urls.first(where: { $0.pathExtension.lowercased() == "jpeg" }),
let imageData = try? Data(contentsOf: jpegURL),
!imageData.isEmpty,
let resultImage = UIImage(data: imageData) else {
return true
}

videoEditor.dismissVideoEditor(animated: true) {
DispatchQueue.main.async { [weak self] in
guard let self else { return }
// Calling clearSessionData() also removes any files stored in urls array
videoEditorModule?.videoEditorSDK?.clearSessionData()

let launchConfig = PhotoEditorLaunchConfig(
hostController: self,
entryPoint: .editorWithImage(resultImage)
)
checkLicenseAndOpenPhotoEditor(with: launchConfig)
}
}

return false
}

// MARK: - Actions
@IBAction func openVideoEditorDefault(_ sender: Any) {
let musicTrackPreset: MediaTrack? = nil
Expand Down