HLS: AVPlayer not reacting to connection loss on partly buffered assets

When connection is cut before track is fully buffered and player reaches end of loaded time ranges, audio stops but status is not updated:

  • elapsed Time continues to send events
  • player.timeControlStatus = playing
  • currentItem!.isPlaybackLikelyToKeepUp = true
  • player.status = readyToPlay
  • player.currentItem!.status = readyToPlay
  • currentItem!.isPlaybackLikelyToKeepUp = true

But an event is logged in errorLog()

  • "NSURLErrorDomain"
  • errorStatusCode -1009

This results in weird behaviour where a progress bar is continuing to show progress without any sound. It even continues beyond the total track duration.

Reproducible on demo app https://github.com/timstudt/PlayerApp:

  1. start playback
  2. let buffer til e.g. 70sec (loadedTimeRanges)
  3. activate flight mode
  4. seek to 60sec (returns = successful)
  5. watch:

when player reaches 70sec mark, audio stops, but elapsed time continues.

Note: w/o seeking the player stalls correctly on 70sec mark.

FB9613919

HLS: AVPlayer not reacting to connection loss on partly buffered assets
 
 
Q