-1
我有一個與songobjects數組。我使用avplayer來播放這些.mp3文件。 如何使用按鈕播放下一首歌曲或上一首歌曲? 我可以停止歌曲或返回並選擇另一首歌曲,但我無法在播放時手動切換歌曲。iOS Swift avplayer上一個或下一個按鈕
func playSong(url: NSURL){
let playerController = AVPlayerViewController()
playerController.player = AVPlayer(URL: url.absoluteURL)
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(MusicListViewController.playerDidFinishPlaying(_:)),
name: AVPlayerItemDidPlayToEndTimeNotification, object: playerController.player!.currentItem)
self.presentViewController(playerController, animated: true, completion: nil)
playerController.player?.play();
}