Since you are using MPMoviePlayerController and not UIWebView, you can place your mp4 or file in your resources and Xcode / iOS will find it. Make sure the directory / group the file is in is not yellow. You do not want this to be a relative path.
Just drag and drop the resource into your project. A copy of the items to the destination is selected, the first option of folders is selected and, most importantly, added to the target!
Ok try the code below:
NSBundle *bundle = [NSBundle mainBundle]; NSString *moviePath = [bundle pathForResource:@"disc" ofType:@"mp4"]; NSURL *movieURL = [[NSURL fileURLWithPath:moviePath] retain]; theMoviPlayer = [[MPMoviePlayerController alloc] initWithContentURL:movieURL]; theMoviPlayer.controlStyle = MPMovieControlStyleFullscreen; theMoviPlayer.view.transform = CGAffineTransformConcat(theMoviPlayer.view.transform, CGAffineTransformMakeRotation(M_PI_2)); UIWindow *backgroundWindow = [[UIApplication sharedApplication] keyWindow]; [theMoviPlayer.view setFrame:backgroundWindow.frame]; [backgroundWindow addSubview:theMoviPlayer.view]; [theMoviPlayer play];
ApolloSoftware
source share