2
如何声明AKAudioPlayer
?用AKAudioPlayer播放声音 - iOS
我使用AudioKit Lib
,我只需要帮助打.wav
文件与更改文件按钮。
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()
}
}
非常感谢你 – EssamSoft
不客气! –