Post

Replies

Boosts

Views

Activity

Using AVFoundation to play audio asset results in error
Hi, I've been trying to play an audio asset (.m4a) using an AVAudioPlayer, but results in what I believe is an internal error. I've been using the following code to load and play the asset. Please note that the code was run using an iPad Pro 11-inch simulator with iPadOS 14 in Xcode 12 beta. guard let audioData = NSDataAsset(name: "Example")?.data else {     fatalError("Asset not found") } do {     let audioPlayer = try AVAudioPlayer(data: audioData, fileTypeHint: "m4a")     audioPlayer.play() } catch {     fatalError(error.localizedDescription) } The catch block is not reached, but the audio does not play and the console logs the following: 2020-06-26 14:48:25.784066-0500 Name[45441:2235216]  HALB_IOBufferManager_Client::GetIOBuffer: the stream index is out of range 2020-06-26 14:48:25.784551-0500 Name[45441:2235216]  HALB_IOBufferManager_Client::GetIOBuffer: the stream index is out of range 2020-06-26 14:48:25.796707-0500 Name[45441:2235216] [aqme] 255: AQDefaultDevice (1): output stream 0: null buffer 2020-06-26 14:48:25.797137-0500 Name[45441:2235216] [aqme] 1778: EXCEPTION thrown (-50): error != 0 Can you please let me know if there's something wrong with the way I'm loading/playing the asset or if this looks like an internal bug in the betas?
6
1
3.9k
Jun ’20