J'essaie de lire un fichier son tel que /Users/NEO/Bibliothèque/Developer/CoreSimulator/Périphériques/D21A7767-E6F6-4B43-A76B-DC6E0F628B16/data/Conteneurs/Données/Application/3F8A82F6-739F-40EA -BEA9-DF3560D0D8BB/Documents/REMEMBER-When.mp3crash AudioKit - Comment lire un fichier audio avec elle?
J'utilise AudioKit/Swift 3, voici mon code:
do {
debugPrint(sound.filePath)
let audioFile = try AKAudioFile(forReading: URL(fileURLWithPath: sound.filePath))
player = try AKAudioPlayer(file: audioFile)
player.play()
}catch let exception {
}
l'accident Xcode et la console a déclaré: en raison de l'application Mettre fin uncaught exception 'com.apple.coreaudio.avfaudio', la raison: 'condition nécessaire est fausse: _engine-> IsRunning()'
J'ai essayé avec AVAudioFoundation donc ça marche bien.
do {
player = try AVAudioPlayer(contentsOf: URL(fileURLWithPath: sound.filePath))
guard let player = player else { return }
player.prepareToPlay()
player.play()
} catch let error {
print(error.localizedDescription)
}
Pourriez-vous me donner un conseil?
[Voici quelques articles correspondants] (http://stackoverflow.com/search?q=required+condition+is+false%3A+_engine-%3EIsRunning%28 % 29) sur l'erreur. – rmaddy