Skip to content

Instantly share code, notes, and snippets.

@pgpt10
Last active February 25, 2019 09:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pgpt10/66bc777bc903c8ab8aed4239a56eefd4 to your computer and use it in GitHub Desktop.
Save pgpt10/66bc777bc903c8ab8aed4239a56eefd4 to your computer and use it in GitHub Desktop.
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