I’ve implemented custom controls for AVPlayer in my iOS app. These controls work as expected outside of Picture-in-Picture (PiP) mode. However, when the player enters PiP mode and the user taps the fast-forward button multiple times:
The PiP view displays a seek bar with the updated duration.
The seek bar starts loading the video.
Upon switching back to the app from PiP, the seek bar displays an incorrect current duration.
Details:
- I’m using AVPlayerViewController with custom controls in SWIFTUI.
- I’ve implemented a periodicTimeObserver to update the current duration, but it doesn’t seem to be called when fast-forwarding in PiP.
Questions:
- How can I ensure my custom controls reflect the correct current duration after fast-forwarding in PiP mode?
- Are there any known limitations with periodicTimeObserver in this scenario?
- Could there be alternative approaches to keep the current duration accurate during PiP interactions?