I have a MPMoviewPlayerViewController
embedded into an UIView
object. When I start the player in the embedded mode everything works fine and as exp
Just add shouldAutoplay boolean to YES after generating the URL It worked for me.
like this:
NSString *path = [[NSBundle mainBundle] pathForResource:videoFileName ofType:@"mp4" inDirectory:nil];
NSURL *movieURL = [NSURL fileURLWithPath:path];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] init];
player.contentURL = movieURL;
player.controlStyle = MPMovieControlStyleNone;
player.shouldAutoplay = YES;
[player prepareToPlay];
player.fullscreen = YES;
[player.view setFrame:[[[[UIApplication sharedApplication] delegate] window] frame]]; // player's frame must match parent's
[[[[UIApplication sharedApplication] delegate] window] addSubview: player.view];
[player play];