Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
func expandVideo() {
player?.pause()
let controller = AVPlayerViewController()
controller.player = player
NotificationCenter.default.addObserver(self, selector: #selector(avPlayerClosed), name: Notification.Name("avPlayerDidDismiss"), object: nil)
self.parentViewController()?.present(controller, animated: true) { in
DispatchQueue.main.async {
player?.play()
}
}
}
@objc func avPlayerClosed(_ notification: Notification) {
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.5) { in
player?.play()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.