Using iOS 8.4, I have created an AVPlayerViewController with and AVPlayer. The video controls appear as expected and the video plays, but there is no "Done" button and xCode crashes whenever I try to lay one on the ViewController at the top of the view. An example I saw: Video Playback clearly shows a "Done" button on the upper left of the screen.
Do AVPlayerViewController and AVPlayer support a "Done" button? Is it possible to add one?
The existing answer suggested by the comment included Objective-C code.
"Done" button is present and working if doing this way:
let playerVC = AVPlayerViewController()
playerVC.player = AVPlayer(URL: NSURL(string: "http://www.ebookfrenzy.com/ios_book/movie/movie.mov")!)
self.presentViewController(playerVC, animated: true, completion: nil)
Swift 3:
self.showDetailViewController(playerVC, sender: self)
// presentViewController is deprecated
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With