Comment déclarer AKAudioPlayer
?Lecture du son avec AKAudioPlayer - iOS
J'utilise AudioKit Lib
et j'ai juste besoin d'aide pour lire le fichier .wav
avec le bouton de changement de fichier.
import UIKit
import AudioKit
class ViewController: UIViewController {
let file = NSBundle.mainBundle().pathForResource("song", ofType: "wav")
let song = AKAudioPlayer(file!) // <--- ERROR = instance member 'file' cannot be used on type
override func viewDidLoad() {
super.viewDidLoad()
AudioKit.output = song
AudioKit.start()
song.play()
}
@IBAction func btn(sender: AnyObject) {
song.replaceFile("NewFile")
song.play()
}
}
Merci beaucoup – EssamSoft
De rien! –