0

Can we add button on AVPlayerViewController and show overlay over that or we need to customize the controls.

Ladislav
  • 7,223
  • 5
  • 27
  • 31
Diksha
  • 439
  • 7
  • 22

1 Answers1

1

You can use View Controller Containment to add AVPlayerViewControllers view to your UIViewController then you can add anything you want over the AVPlayerViewControllers view since it is just another view in the view hierarchy...

let avPlayerVC = AVPlayerViewController()
//configure the playerVC
addChildViewController(avPlayerVC)
avPlayerVC.view.frame = frame//or use autolayout to constran the view properly
view.addSubview(avPlayerVC.view)
avPlayerVC.didMove(toParentViewController: self)

//add controls over it -> I called it ControlsView
let controls = ControlsView()
view.addSubview(controls)
Ladislav
  • 7,223
  • 5
  • 27
  • 31