Hello,
At the moment I try to add a Button to an AVPlayer. From the documentation it isn't clear to me how you can do this.
Here is an example what I mean:

The apple developer app has this copy button. But it isn't clear to me how to add one by reading just the documentation. It is clearly an AVPlayer and not a custom controller implementation, because a vanilla player looks nearly the same:

Any idea how to archive this without implementing a controller ui by myself? I just want to add a way to adjust video quality without reinventing the wheel.
I was able to place a button there, but I was not able to resize it:

This is what I did to archive this:
let childViewController = SelfSizingHostingController(rootView: self.child)
childViewController.view.translatesAutoresizingMaskIntoConstraints = false
childViewController.view.contentMode = .scaleAspectFitt
if let test = uiViewController.view.subviews.first?.subviews[1].subviews[4] {
test.contentMode = .scaleAspectFit
let routePickerView = AVRoutePickerView() // just try to test if only special views work
for subview in routePickerView.subviews {
subview.removeFromSuperview()
}
routePickerView.addSubview(childViewController.view)
if let parentVC = test.parentViewController {
uiViewController.buttonIsAdded = true
parentVC.addChild(childViewController)
self.copyConstraints(sourceView: test.subviews.first!, toView: routePickerView)
test.insertSubview(routePickerView, at: 0)
childViewController.didMove(toParent: parentVC)
}
}
~Nils