Reputation: 1973
I need to play a video when the application starts
My code works perfectly for Iphone Ipad Simulator
But not on the device physically Ipad
What's wrong??
- (void)viewDidLoad
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
NSURL* url = [[NSBundle mainBundle] URLForResource:@"Intro3" withExtension:@"mp4"];
m_player = [[MPMoviePlayerController alloc] initWithContentURL:url];
[m_player.backgroundView setBackgroundColor:[UIColor blackColor]];
[m_player.view setBackgroundColor:[UIColor blackColor]];
[m_player setControlStyle:MPMovieControlStyleNone];
[[m_player view] setFrame:[self.view bounds]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
[m_player play];
[self.view addSubview:[m_player view]];
}
else{
---play video in iphone---
}
}
Upvotes: 1
Views: 195
Reputation: 1973
The code works perfectly !!!
The problem was that the resolution of the video was too big.
Resize and worked =)
Upvotes: 2
Reputation: 1604
I recommend you to use MPMoviePlayerViewController instead .
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
NSURL* url = [[NSBundle mainBundle] URLForResource:@"Intro3" withExtension:@"mp4"];
MPMoviePlayerViewController * controller = [[MPMoviePlayerViewController alloc]initWithContentURL:url];
[self presentMoviePlayerViewControllerAnimated:controller];
[controller release];
}
Upvotes: 0