SwiftAudio
SwiftAudio copied to clipboard
Not working with local file in Queue
trafficstars
Describe the bug When sourceType: .stream, it works. But not working with local file in Queue.
Code: var player = QueuedAudioPlayer() let filePath = "/Users/xxxx/1.m4a" let audioItem = DefaultAudioItem(audioUrl: filePath, sourceType: .file) try? self.player.add(item: audioItem, playWhenReady: true)
Smartphone:
- Device: [ iPhoneXs ]
- OS: [ iOS14.3]
You should check if you have permission to read the m4a file. Normally, you can only access the folders and files in your app sandbox on iOS . You may have two choice:
- use UIFileSharingEnabled, expose your sandbox directory to user in iOS Files App, then copy file to that directory in Files app, here is an example
- Or, you can just ask user to pick files outside your app container , see providing_access_to_directories
I'm new to iOS development, so if the answer has some wrong , please let me know ,thank you !