In previous versions of iOS, loading AVPlayerViewController (as well as SwiftUI VideoPlayer) with a video would display the first frame and include a play icon in the center but this has gone away in iOS 16. I’ve been relying on that UI element as an affordance for "There’s a video here, tap it".
Plus, now tapping the video shows the playback controls over the video for a few seconds instead of just starting playback.
Does anyone know if:
- There’s a property or configuration option to show the play icon?
- I should be providing my own play icon overlay placed over the video manually?
- This is a bug in iOS 16?
3
Answers
Make sure to add the
AVPlayerViewController
as a child view controller of your own view controller like this as mentioned here:Swift:
Objective-C:
For Swift UI need to use
}
I think a work around for this issue can be adding
and changing it back after one second.
So the code will look like something like this:
The downside of using this work around is that you’ll be using private api calls which can result in your app being rejected by Apple.