title: Adding UIButton to AVPlayer in iOS (Swift) When Video Plays in WebView
body: <p>I'm putting together an iOS app (using Swift) that contains a webview. A user will click on a video in the webview and the video will load, at which time I want to display a button on the video. I've been able to display the button but it is not responding to touches and I'm not sure why. I made the button huge just to make sure it was being hit. Here's my code. I extended AVPlayerViewController. </p>
  
  <p>Thanks in advance for your time and patience.</p>
  
  <pre><code>extension AVPlayerViewController {
  
      open override func viewDidLoad() {
  
          let btn = UIButton(type: .roundedRect)
          btn.backgroundColor = UIColor.red
          btn.setTitle("Do stuff", for: .normal)
          btn.frame = CGRect(x: 0, y: 330, width: 300, height: 300)
          btn.addTarget(self, action: #selector(self.pressButton(button:)), for: .touchUpInside)
          btn.isUserInteractionEnabled = true
          btn.isEnabled = true
          btn.clipsToBounds = true
  
          self.contentOverlayView?.addSubview((btn as? UIButton)!)
          self.showsPlaybackControls = false
  
  
      }
  
  
      func pressButton(button: UIButton) {
          print("Worked")
      }
  
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/hp9Zh.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hp9Zh.jpg" alt="Screen Shot of iOS App"></a></p>