views:

28

answers:

1
self.player = [[AVPlayer playerWithURL:[NSURL URLWithString:@"http://myurl.com/track.mp3"]] retain];

I am trying make a UIProgressView for the above track. How do I obtain the file size and current file size from that URL? Please help, thanks!

A: 

I think you do not want to know anything about file-sizes, but you're more interested in times.

Try self.player.currentItem.asset.duration for duration of currently playing item, self.player.currentTime for current time.

Michal
Yep, Im making the slider with the duration. But if the user slides pass what is loaded, then bad news. So I want progress of the downloaded/playing track, is that right? Does that make sense?
slowman21
I understand, I'm not sure about this, but you might want to enable seeking only within ranges specified in `self.player.currentItem.loadedTimeRanges`.
Michal
Yea I will need to do that too. But still would be nice for the users to see what has loaded. Like a real streamer.
slowman21
Hey Michal, can you explain a little bit how to use loadedTimeRange? I don't know how to get the duration from CMTimeRange.
slowman21