title: How can I tap to close AVPlayer in Swift 5?
body: <p><strong>I'm creating an extremely simple game, and I've hidden the video controls.</strong></p>
  
  <pre><code>@IBAction func playVideo1(_ sender: Any) {
  
      // play video connected to button 1
      guard let firstVideo = Bundle.main.path(forResource: "Video1", ofType:"mp4") else {
              debugPrint("Video not found")
                  return
              }
  
      // create an AVPlayer, passing it mp4
      let player = AVPlayer(url: URL(fileURLWithPath: firstVideo))
  
  
      // Create a new AVPlayerViewController and pass it a reference to the player.
      let controller = AVPlayerViewController()
      controller.player = player
  
      controller.showsPlaybackControls = false
  
  
  
      // Modally present the player and call the player's play() method when complete.
      present(controller, animated: true) {
          player.play()
      } 
  } // end playVideo1
  </code></pre>
  
  <p>One of the two options would be OK. </p>
  
  <p><strong>Option 1:</strong> Tap to close the video.</p>
  
  <p><strong>Option 2:</strong> Have the AVPlayer close automatically at the end of the video.</p>
  
  <p>I appreciate any help.</p>
  
  <p>Thanks!</p>