Created
June 1, 2016 23:17
-
-
Save alexcurylo/db743df00a6d27758b45c6537b26a800 to your computer and use it in GitHub Desktop.
This file contains 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
class SomeViewController: UIViewController { | |
private typealias My = SomeViewController | |
private let videoPlayer: AVPlayer | |
private let videoPlayerLayer: AVPlayerLayer | |
override init(nibName: String?, bundle nibBundle: NSBundle?) { | |
(videoPlayer, videoPlayerLayer) = My.commonInit() | |
super.init(nibName: nibName, bundle: nibBundle) | |
} | |
required init?(coder decoder: NSCoder) { | |
(videoPlayer, videoPlayerLayer) = My.commonInit() | |
super.init(coder: decoder) | |
} | |
private static func commonInit() -> (AVPlayer, AVPlayerLayer) { | |
let player = AVPlayer(URL: NSURL(fileReferenceLiteral: "movie.mov")) | |
let layer = AVPlayerLayer(player: player) | |
return (player,layer) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome! Thanks!