dimanche 8 février 2015

AVPlayerViewController using audio-only AVPlayer

Just starting out with AVKit, and I'm trying to play some audio. It would be nice to use the new AVPlayerViewController detailed in Mastering Modern Media Playback so that I have a ready-made play/pause/seek UI. I basically have a storyboard with a container view which has an embed segue to the AVPlayerViewController. Then I use:



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://ift.tt/1vceaeW"))
}
}


It embeds nicely and plays, but it has a big black QuickTime symbol where the video would be. I'm wondering if there's a way to make it look more like the Music or Podcasts app.


Aucun commentaire:

Enregistrer un commentaire