I’m using AVPlayer in my iOS app to stream video content(using HLS). Everything works fine until I switch the network connection from WiFi to cellular, or vice versa. When the network switch happens, the AVPlayer stops playing for about 30-60 seconds and then resumes playing automatically. This pause is quite disruptive to the user experience.
In my iOS app, I’m using AVPlayer to stream video content. I expected the AVPlayer to handle network changes (from WiFi to cellular or vice versa) seamlessly without interrupting the playback. However, the player pauses for about 30-60 seconds before resuming, which disrupts the user experience.
Here’s what I’ve tried so far:
-
Using Reachability to handle network changes: I attempted to pause the player before the network switch and then play it again after the switch. However, this did not eliminate the pause.
-
Adjusting player settings: I experimented with various player settings such as
automaticallyWaitsToMinimizeStallingandpreferredForwardBufferDuration, but none of these changes seemed to affect the pause. -
Replacing the current item: I tried using
replaceCurrentItem(with:)when a network switch occurs, hoping that a new player item might avoid the pause. Unfortunately, this did not solve the problem. -
Recreating the AVPlayer: I also tried recreating the AVPlayer instance when a network switch is detected. This also did not prevent the pause.
Despite these attempts, I’m still facing the same issue. I was expecting that one of these methods would at least reduce the delay, but the player still pauses for a significant amount of time during a network switch. I’m looking for a way to either prevent this pause or reduce the delay to provide a smoother user experience. Any suggestions or insights would be greatly appreciated.




