You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Has anyone attempted to build a version which could load a remote URL? AVAssetReader complains currently "Cannot initialize an instance of AVAssetReader with an asset at non-local URL"
The text was updated successfully, but these errors were encountered:
I've never actually tried that myself tbh. But you can simply download the file with URLSession. Code for this (just an illustration as it ignores all sorts of possible error scenarios) could look like this:
lettask=URLSession.shared.downloadTask(with: remoteAudioURL){ downloadedURL, urlResponse, error in
guard let downloadedURL = downloadedURL else{return}letcachesFolderURL=try?FileManager.default.url(for:.cachesDirectory, in:.userDomainMask, appropriateFor:nil, create: false)letaudioFileURL= cachesFolderURL!.appendingPathComponent("yourLocalAudioFile.m4a")try?FileManager.default.copyItem(at: downloadedURL, to: audioFileURL)DispatchQueue.main.async{self.WaveformView.waveformAudioURL = audioFileURL
}}
task.resume()
Has anyone attempted to build a version which could load a remote URL?
AVAssetReader
complains currently"Cannot initialize an instance of AVAssetReader with an asset at non-local URL"
The text was updated successfully, but these errors were encountered: