Answer the question
In order to leave comments, you need to log in
How to make a progress bar indicating how much is already cached for the ios player?
Hello!
I'm writing my first app for iOS :) I'm
using AVPlayer and caching. How can I make a progress bar of the current position of the file being played while indicating how much has already been cached (in a darker color, for example). Naturally with the ability to drag and drop to play from another moment.
Thanks in advance!
Answer the question
In order to leave comments, you need to log in
Or file KVO: watch AVPlayerItem.loadedTimeRanges, we need a null object in the array, we get the right time like this: CMTimeRangeGetEnd(range!.CMTimeRangeValue)
or pull such a function
func availableDuration() -> CMTime
{
let range = self.player?. currentItem?.loadedTimeRanges?.first as? NSValue
if (range != nil){
return CMTimeRangeGetEnd(range!.CMTimeRangeValue)
}
return kCMTimeZero
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question