Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Play video from cache in iphone programmatically

I am developing an iPhone application in which I will store stream video from URL directly to cache in local, now I need to play video in movie-player while it was in downloading in cache. I followed this http://lists.apple.com/archives/cocoa-dev/2011/Jun/msg00844.html, but I couldn't do exact. I am able to download video in cache but I couldn't play video from cache. So how can I play while its downloading?

like image 749
Warrior Avatar asked Sep 13 '11 13:09

Warrior


1 Answers

Just change your web url to local path url...

Try this code...

NSBundle *bundle = [NSBundle mainBundle];
    NSString *moviePath = [bundle pathForResource:@"Movie" ofType:@"m4v"];
NSURL *movieURL = [[NSURL fileURLWithPath:moviePath] retain];
MPMoviePlayerController *theMovie = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
theMovie.scalingMode = MPMovieScalingModeAspectFill;
[theMovie play];
like image 63
Sonu Avatar answered Oct 08 '22 21:10

Sonu