Last active
February 25, 2019 09:33
-
-
Save pgpt10/66bc777bc903c8ab8aed4239a56eefd4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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