title: Adding an Image overlay to video
body: <p>Looking to add an image overlay to this video I have playing in fullscreen. I was wondering what the best route would be to achieve this? This will be a PNG image with transparency. Thanks for any help in advance!</p>
  
  <pre><code>import UIKit
  import AVKit
  import AVFoundation
  
  
  class videoViewController: UIViewController, UIApplicationDelegate{
  
  
  var videoPlayer: AVPlayer!
  var playerLayer: AVPlayerLayer?
  
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
  
      let path = NSBundle.mainBundle().pathForResource("video", ofType:"mp4")
      let url = NSURL(fileURLWithPath: path!)
      let playerItem = AVPlayerItem(URL: url)
  
      self.videoPlayer = AVPlayer(playerItem: playerItem)
      self.playerLayer = AVPlayerLayer(player: self.videoPlayer)
      self.playerLayer!.frame = self.view.frame
      self.videoPlayer!.play()
  
      self.view.layer.addSublayer(self.playerLayer!)
  
      NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("continueVideo:"), name: "continueVideo", object: nil)
  
  
      NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("playerDidReachEnd:"), name: AVPlayerItemDidPlayToEndTimeNotification, object:nil)
  }
  
  
  func playerDidReachEnd(notification: NSNotification) {
      self.videoPlayer.seekToTime(kCMTimeZero)
      self.videoPlayer.play()
  }
  
  func continueVideo(notification: NSNotification) {
      self.videoPlayer.play()
  }
  
  func applicationWillResignActive(application: UIApplication) {
      videoPlayer.pause()
  }
  
  
  func applicationDidBecomeActive(application: UIApplication) {
      videoPlayer.play()
  }
  
  
  func applicationDidEnterBackground(application: UIApplication) {
      videoPlayer.pause()
  }
  
  
  func applicationWillEnterForeground(application: UIApplication) {
      videoPlayer.play()
  }
  
  
  
  
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
  }
  
  
  
  }
  </code></pre>