剛開始使用AVKit,我試圖播放一些音頻。使用Mastering Modern Media Playback中詳細介紹的新AVPlayerViewController會很好,所以我有一個現成的播放/暫停/搜索UI。我基本上有一個容器視圖的故事板,它具有一個嵌入到AVPlayerViewController的segue。然後我用:AVPlayerViewController只使用AVPlayer音頻AVPlayer
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if (segue.identifier == "embedAudio") {
var playerViewController:AVPlayerViewController = segue.destinationViewController as AVPlayerViewController
playerViewController.player = AVPlayer(URL: NSURL(string: "http://dts.podtrac.com/redirect.mp3/files.serialpodcast.org/sites/default/files/podcast/1420057326/serial-s01-e01.mp3"))
}
}
它很好地嵌入和劇本,但它有一個大黑QuickTime的符號,其中的視頻會。我想知道是否有辦法讓它看起來更像音樂或播客應用程序。
或者,如果你不想通過網站挖掘發現項目,只是[下載直接](http://swiftarchitect.com/wp-content/uploads/2015/08/SO-32342486.zip)。 – 2016-07-15 20:33:22