I have AVPlayerViewController wrapped in UIViewControllerRepresentable and I call it PlayerViewSUI:
public struct PlayerViewSUI: UIViewControllerRepresentable {
public func makeUIViewController(context: Context) -> AVPlayerViewController {
let controller = AVPlayerViewController()
controller.player = player
controller.showsPlaybackControls = showsPlaybackControls
controller.delegate = context.coordinator
return controller
}
}
The problem is if I add a tap gesture to PlayerViewSUI, it completely disables touches in AVPlayerViewController, including it's play button.
PlayerViewSUI(player: player)
.frame(maxWidth: .infinity)
.background {
Color.black
}
.padding(.vertical, 20)
.ignoresSafeArea()
.navigationBarHidden(hideNavigationBar)
.toolbarBackground(.visible, for: .navigationBar)
.onTapGesture(perform: {
print("Tapped")
})
I have tried simultaneous gesture as well to no avail. What is the solution out here?