import UIKit
import AVFoundation
class ViewController: UIViewController {
var APlayer:AVAudioPlayer!
@IBAction func PlayBtnClicked(sender: AnyObject) {
APlayer.play()
}
@IBAction func PauseBtnClicked(sender: AnyObject) {
APlayer.pause()
}
@IBAction func StopBtnClicked(sender: AnyObject) {
APlayer.stop()
APlayer.currentTime = 0
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
_APlayer = AVAudioPlayer(contentsOfURL: NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("Mirror Night", ofType: "mp3")!))
}_//此处有错误提示"call can throw,but it is not marked with 'try' and the error is nothandled"
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}