-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
possible to do caching? #48
Comments
Hi @narendra-ct sorry it took [self.player asyncSetupSourceGetter:^(NSUInteger index) {
NSDictionary *song = [self.playlist objectAtIndex:index];
if ([self songExists:song]) {
[self.player setupPlayerItemWithUrl:[self getSongUrl:song] Order:index];
NSLog(@"Local File");
}else{
NSLog(@"Remote File");
[self getMp3Url:song onFinish:^(NSString *url) {
[self.player setupPlayerItemWithUrl:[NSURL URLWithString:url] Order:index];
}];
}
} ItemsCount:[self.playlist count]];
|
Hi @saiday, can you help me on one issue : Hysteria Player is caching very well and you did a very good job . Cached audio is playing when application is live if i quit the application at that time already played audios cache is clearing so, Thanks, |
I had no solutions on this topic yet, but I have a suggestion on it. AVPlayerItem have a property |
Hi saiday , do you know how to save the file to document directory? it seems we only have AVPlayerItem and the AVPlayerItem has a AVAsset property. In theory we could use AVAssetExportSession to export the AVAsset out to document directory, but like http://stackoverflow.com/questions/6259095/caching-with-avplayer-and-avassetexportsession, I always get AVAssetExportSessionStatusFailed. |
Noticed, will take a look. Thank you. On Monday, May 5, 2014, Wenhu notifications@github.com wrote:
|
Guys, check this out: http://vombat.tumblr.com/post/86294492874/caching-audio-streamed-using-avplayer playbackBufferFull doesn't mean the entire video is loaded, just the buffer. You'll see AVAsset's resource loader make periodic requests later to refill it as it runs low. Wall of text here, but I just spent a week on this exact thing, and have some notes that might help. There are a few versions of the the code above floating around. A Google search for "avassetresourceloaderdelegate cache" turns up a few. You can improve the performance with some codecs by opening a second connection that hops around and grabs specific byte ranges to fulfill resource loader requests for content far ahead of the main connection's, which is downloading the whole thing in order so you've got a NSMutableData instance you can write to file once the connection finishes. Side note, you could do some clever things and maybe have the primary connection skip sections that have already been downloaded, but then you're worrying about combining sparse data and the overhead of opening new connections. Also, if you do this, be careful with AVQueuePlayer. AVAssets on the same player share a resource loader (the docs only mention that's the case with copies of the same asset, but it's not limited to that). AVQueuePlayer starts loading data for the next item before it's playing, so you can end up fulfilling requests for one asset with the original asset's data if you're not careful. I found it easier to have two players and swap our their player layers. |
Hii,
. Thanks for giving good sample and i planned to download some audios to play on offline mode , is there any possibility please help me.
Thanks,
Narender
The text was updated successfully, but these errors were encountered: