6

The Problem

I am using an AVPlayerLooper to replay an HTTP Live Streaming video indefinitely. The video replays perfectly for the first three loops. But on the fourth loop and all loops thereafter, the video "hiccups." In other words, when the video is near its end time, the video flashes, plays the last few frames for about a second, then flashes again and restarts. This also leads to the notification AVPlayerItemDidPlayToEndTime being called twice and the playerLooper.loopCount being incremented with each call.

How can I stop my videos from hiccuping?

Additional Information:

  • Only some of my videos have this problem. Others work seamlessly.
  • The AVPlayerLooper is designed to allow for seamless looping of HTTP Live Streaming videos. It works by making three copies of the provided template AVPlayerItem and plays them in succession using an AVQueuePlayer (also provided) following what is referred to as the "treadmill pattern". It seems that after each item copy is played once we run into the problem above.
josephap
  • 2,075
  • 17
  • 24
  • 2
    have you ever found a solution for this problem? I'm also experiencing it, with a local video file... I've tried a couple of videos and all of these exhibited the same property, however the hiccups started after first loop. I am testing it on iOS simulator only as I don't have access to a device and won't have access to a real device in the upcoming weeks/months, so maybe it's just simulator thing, but reading your post makes me wonder if it's a bug in the AVPlayerLooper – Lukas1 Mar 28 '18 at 19:12
  • I've also experienced this issue, AVPlayerLooper doesn't reset the seek time of the items correctly before playing them again, I've recreated the expected behaviour using a custom AVQueuePlayer subclass that adds a **newly** created player item when one finishes. Reusing items leads to the same issue, as it's actually a bug in AVQueuePlayer and not AVPlayerLooper – dvkch Dec 17 '18 at 10:24
  • I reported this to apple https://openradar.appspot.com/46784549 – dvkch Dec 19 '18 at 23:37

0 Answers0