1

How can I check if my AVPlayer is buffering?

I want to detect if my AVPlayer is buffering for the .m3u8 format URl, so that I can show a loader or something when downloading video. But I can't seem to find anything in the documentation for AVPlayer.

  • find https://stackoverflow.com/questions/32845291/how-do-i-replace-mpmovieplayer-notifications, https://stackoverflow.com/questions/24030003/show-progress-bar-until-video-loads-ios7/24036738#24036738 use notification... – karthikeyan Jun 19 '17 at 09:58

1 Answers1

0

You can use KVO to observe the keyPath timeControlStatus. There are three different statuses;

  • AVPlayerTimeControlStatusWaitingToPlayAtSpecifiedRate
  • AVPlayerTimeControlStatusPlaying
  • AVPlayerTimeControlStatusPaused
Patrick
  • 6,495
  • 6
  • 51
  • 78
lucky
  • 1
  • 1