I want to play local video in AVPlayerViewController but did not find click event of Done button.
My video is able to play in AVPlayerViewController but I did not fi
I guess there are lots of ways to skin a cat. I needed to handle the 'Done' click event. In my case, I wanted to make sure I was able to hook into the event after the "X" was clicked and the AVPlayerViewController was COMPLETELY closed (dismissed).
Swift 4.0
protocol TableViewCellVideoPlayerViewControllerDelegate: class {
func viewControllerDismissed()
}
class MyPlayerViewController: AVPlayerViewController {
weak var navDelegate: TableViewCellVideoPlayerViewControllerDelegate?
open override func viewDidDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
if self.isBeingDismissed {
self.navDelegate?.viewControllerDismissed()
}
}
}
class TodayCell: UITableViewCell, SFSafariViewControllerDelegate, TableViewCellVideoPlayerViewControllerDelegate {
func viewControllerDismissed() {
self.continueJourney()
}
}