I found the solution to the problem. I want to clarify once again that this issue only occurs with iOS 18+.
I think it's a lifecycle thing. By adding the UIHostingController that contains the SwiftUI view (which in turn contains the Player) as child and notifying the addition to the parent, the player controls become visible again.
New lines:
addChild(hostingController)
hostingController.didMove(toParent: self)
Below is a complete code example:
addChild(hostingController) hostingController.view.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(hostingController.view)
hostingController.didMove(toParent: self)
/// set constraints
Topic:
Media Technologies
SubTopic:
Video
Tags: