title: Play MP4 using MPMoviePlayerController() in Swift
body: <p>I can't for the life of me figure out a way to play an MP4 that takes up the entire background in a <code>UIViewController</code>.</p>
  
  <p>So far I have the following, which doesn't even play the video at all.</p>
  
  <p>I can confirm that the <code>bokeh.mp4</code> video exists because if I change the file to something else then it throws an error that it's missing.</p>
  
  <pre><code>override func viewDidAppear(animated: Bool)  {
      let filePath = NSBundle.mainBundle().pathForResource("bokeh", ofType: "mp4")
      self.moviePlayerController.contentURL = NSURL(string: filePath)
      self.moviePlayerController.prepareToPlay()
      self.moviePlayerController.repeatMode = .One
      self.moviePlayerController.controlStyle = .Embedded
      self.view.addSubview(self.moviePlayerController.view)
  }
  </code></pre>
  
  <p>I get an error in the console:</p>
  
  <pre><code>2014-06-22 21:22:42.347 MoviePlayer[26655:60b] _itemFailedToPlayToEnd: {
      kind = 1;
      new = 2;
      old = 0;
  }
  </code></pre>
  
  <p>I've also tried adding a <code>UIView</code> that takes up the entire screen and adding the player to that view, but it's the same problem. It doesn't start playing.</p>
  
  <p>I'm trying to achieve the same effect that Vine has when you first load up the application where it has the video playing in the background.</p>
  
  <p><img src="https://i.stack.imgur.com/4ZaJn.jpg" alt="enter image description here"></p>