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
不客氣! –