2013-10-03 177 views
1

我使用此代碼嘗試播放視頻。然而,視頻從未播放,回調從來沒有說它已完成。我看不到任何我想念的東西或者它不應該在的地方。我檢查了路徑,這很好。視頻回放視圖確實出現。它只是沒有發揮在這一點上。MPMoviePlayerController不播放視頻

有什麼建議嗎?

NSURL *movieURL = [[NSBundle mainBundle] URLForResource:@"IntroMovie" withExtension:@"mov"]; 

NSLog(@"%@", movieURL); 

MPMoviePlayerController *moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:movieURL]; 

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playbackFinished:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayerController]; 

[moviePlayerController prepareToPlay]; 

[moviePlayerController.view setFrame:self.view.bounds]; 
[self.view addSubview:moviePlayerController.view]; 

[moviePlayerController play]; 
+0

你使用ARC還是非ARC? –

+0

我使用ARC並定位iOS 7 –

+0

請參閱http://stackoverflow.com/questions/7493860/problem-playing-mov-file-in-mpmovieplayercontroller – karthika

回答

7

問題在於,您的moviePlayerController由於ARC而正在清理。

嘗試是否有助於爲MPMoviePlayerController引入strong屬性。

+0

謝謝,只要我介紹一個解決我的問題的財產。 –

相關問題