Breaking News
Loading...
Monday, February 25, 2013

how to play video in iOS

8:10 PM

NSString *resourcePath = [[NSBundle mainBundle] pathForResource:@"ddd" ofType:@"mp4"];
NSURL *url = [NSURL fileURLWithPath:resourcePath];
MPMoviePlayerViewController *moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
moviePlayer.view.frame = CGRectMake(0, 0, 500, 500);
moviePlayer.moviePlayer.shouldAutoplay=YES;
moviePlayer.moviePlayer.controlStyle = MPMediaTypeMusicVideo;
[moviePlayer.moviePlayer setFullscreen:YES animated:YES];
[self.view addSubview:moviePlayer.view];
[moviePlayer.moviePlayer play];

0 comments:

 
Toggle Footer