在iOS 4的今典合作,播放電影:MPMoviePlayer - 黑屏 - iOS 5的 - 沒有視頻播放
-(IBAction)playMovie:(id)sender
{
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"testbild1" ofType:@"m4v"]];
MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
UIView *testview = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
[testview addSubview:moviePlayer.view];
[self.view addSubview:testview];
//[self.view addSubview:moviePlayer.view];
//[moviePlayer setFullscreen:YES animated:YES];
}
- (void)moviePlaybackComplete:(NSNotification *)notification
{
MPMoviePlayerController *moviePlayerController = [notification object];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayerController];
[moviePlayerController.view removeFromSuperview];
//[moviePlayerController release];
}
現在,我只得到一個blackscreen。沒有控制,沒有。視頻路徑是正確的,我測試了這一點。如果我通過按鈕點擊添加一個白色的子視圖,它就可以工作。所以這個方法被調用。
在此先感謝!
我做,我這樣說是相同的(但在其他項目中)有意和完美地工作。所以我認爲就是這樣。感謝您的貢獻。 – DAS
這不適用於我 – ios
這可以與PhoneGap一起使用嗎?我不確定如何/在哪裏實施使用該框架 – bafromca