iOS AVPlayer Stops and Resumes After 30-60 Seconds When Switching Between WiFi and Cellular


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:

  1. 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.

  2. Adjusting player settings: I experimented with various player settings such as automaticallyWaitsToMinimizeStalling and preferredForwardBufferDuration, but none of these changes seemed to affect the pause.

  3. 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.

  4. 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.

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img