下面的代碼的工作非常適合我的申請。希望它會爲你做同樣的事情。 最主要的是設置mpMoviePlayerController幀的幀。如果你不這樣做,它幾乎不會顯示視頻。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[UIApplication sharedApplication] setStatusBarHidden:YES];
// Register to receive a notification when the movie has finished playing.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:nil];
// Register to receive a notification when the movie scaling mode has changed.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(movieScalingModeDidChange:)
name:MPMoviePlayerScalingModeDidChangeNotification
object:nil];
kDomain = [NSString stringWithString:@"http://www.virtua-book.com/"];
[navigationController setNavigationBarHidden:YES];
NSURL *ur=[[NSURL alloc] initFileURLWithPath:[[NSBundle mainBundle] pathForResource:@"IPAD" ofType:@"mp4"]];
mpMCtr=[[MPMoviePlayerController alloc] initWithContentURL:ur];
mpMCtr.fullscreen=YES;
[mpMCtr setScalingMode:MPMovieScalingModeFill];
[mpMCtr setShouldAutoplay:YES];
[mpMCtr setControlStyle:MPMovieControlStyleNone];
[mpMCtr setMovieSourceType:MPMovieSourceTypeFile];
mpMCtr.view.frame = CGRectMake(0, 0, 1024, 768);
[mpMCtr setRepeatMode:MPMovieRepeatModeNone];
[mpMCtr play];
[ur release];
// Override point for customization after app launch
[navigationController.view addSubview:mpMCtr.view];
[window addSubview:[navigationController view]];
[window makeKeyAndVisible];
return YES;
}
// Notification called when the movie finished playing.
- (void) moviePlayBackDidFinish:(NSNotification*)notification
{
[mpMCtr.view removeFromSuperview];
}
好,好,我發現,這樣的:已被棄用。解決方案是multimediaPlayer.controlStyle = MPMovieControlStyleDefault;但它仍然不起作用。 –
2010-03-30 14:56:38
這是一個答案,應該發佈爲答案..你可以稍後編輯你的答案,因爲你有更多的信息 – 2010-04-05 04:00:43
對不起,現在我做到了。 :P – 2010-06-29 11:54:28