I have several AVPlayerViewControllers set as the ViewControllers of a UITabBarController. What I want is having the video of the currently visible AVPlayerViewController automatically pause playing when the user switches to another tab (which is another AVPlayerViewController)
I tried this approach:
override func viewWillDisappear(animated: Bool) {
player?.pause()
super.viewWillDisappear(animated)
}
but the video just keeps running in the background. (audio is still running at least) Debugger says player property is not nil in viewWillDisappear. I already tried implicitly and forced unwrapping, to no avail.