title: Swift3 Play multiple video files with AVPlayer
body: <p>I have a little code which allows me to play a local file when I hit a UIButton. But what I want is to play multiple files on 3 different UIButtons because I have 3 video files which I want to attach to my app.</p>
  
  <p>This is the current code:</p>
  
  <pre><code>import UIKit
  import AVFoundation
  import AVKit
  
  class ViewController: UIViewController {
  
      var playerController = AVPlayerViewController()
      var player:AVPlayer?
  
  
      override func viewDidLoad() {
          super.viewDidLoad()
          // Do any additional setup after loading the view, typically from a nib.
  
          let videoString:String? = Bundle.main.path(forResource: "Video", ofType: ".mp4")
  
          if let url = videoString {
  
              let videoURL = NSURL(fileURLWithPath: url)
  
              self.player = AVPlayer(url: videoURL as URL)
              self.playerController.player = self.player
  
  
  
          }
  
  
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
  
      @IBAction func PlayVideo(_ sender: AnyObject) {
  
          self.present(self.playerController, animated: true, completion: {
  
              self.playerController.player?.play()
  
          })
  
      }
  
  
  }
  </code></pre>