-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Need to modify applyAudioTrack function in VideoEditorModule.swift to working dynamic mp3 file path
// Applies audio track from custom audio browser
@objc func applyAudioTrack(_ resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
self.currentResolve = resolve
self.currentReject = reject
// Specify audio track URL. Video Editor SDK can apply tracks stored on the device.
// In this sample we use audio file stored in the project.
let audioURL = Bundle.main.url(forResource: "sample_audio", withExtension: "mp3")
if (audioURL == nil) {
let errMessage = "Failed to apply audio track. Unknow file"
print(errMessage)
self.currentReject!("", errMessage, nil)
return
}
// Specify custom track name and additional data
let trackName = "Track Name"
let additionTitle = "Awesome artist"
DispatchQueue.main.async {
self.customAudioTrackUUID = UUID()
let audioBrowserModule = self.getAudioBrowserModule()
// Apply audio in Video Editor SDK
audioBrowserModule.trackSelectionDelegate?.trackSelectionViewController(
viewController: audioBrowserModule,
didSelectFile: audioURL!,
isEditable: true,
title: trackName,
additionalTitle: additionTitle,
uuid: self.customAudioTrackUUID!
)
print("Audio track is applied")
self.currentResolve!(nil)
}
}
so i can pass directly mp3 path from JS, something like this
return await VideoEditorModule.applyAudioTrack(
"file:///Users/miteshkalal/Library/Developer/CoreSimulator/Devices/CAB59D05-4642-41F1-B9C1-C22D5892E263/data/Containers/Data/Application/5E7C48C9-83E9-42DB-9989-7669199AB6DC/Library/Caches/music.mp3"
);
Metadata
Metadata
Assignees
Labels
No labels