I'm writing an application in Swift, and I believe the code is all valid, as there are no compiler errors. When I try to play an audio file that I know exists, I get the error listed below.
No audio plays.
I have tried writing the code different ways, including instantiating the AVAudioPlayer with the contentsOf argument.
import UIKit
import CoreML
import AVFoundation
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let soundURL = Bundle.main.url(forResource: "beep", withExtension: "mp3")!
var soundPlayer : AVAudioPlayer!
do {
soundPlayer = try AVAudioPlayer(contentsOf: soundURL)
}
catch {
print("Err")
}
soundPlayer.play()
}
}
Here is the error:
2019-10-18 22:35:29.609690-040 Test[. . .] [plugin]
AddInstanceForFactory: No factory registered for id <CFUUID . . . > . .
2019-10-18 22:35:30.527132-0400 ML Test[19542:1516755] [aqsrv] AQServer.cpp:68:APIResult: Exception caught in AudioQueueInternalNotifyRunning - error -66671