我想從我的資源文件中加載25秒的mp4電影,但是當我播放它時,我的MPMoviePlayerPlaybackDidFinishNotification選擇器立即用MPMovieFinishReasonPlaybackEnded調用。當我登錄我的播放狀態時,顯示如下:MPMoviePlayerController立即結束
MPMoviePlaybackStatePlaying
MPMoviePlaybackStatePaused
MPMoviePlaybackStateStopped
MovieFinishReasonPlaybackEnded
MPMoviePlaybackStatePlaying
MPMoviePlaybackStatePaused
即使我只調用play方法一次。我希望有一個人可以幫助我。
- 編輯,以顯示我的代碼:
MPMoviePlayerController* player = [[[MPMoviePlayerController alloc] initWithContentURL:movieURL] autorelease];
if (player)
{
self.moviePlayerController = player;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:player];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayerPlaybackStateDidChange:)
name:MPMoviePlayerPlaybackStateDidChangeNotification
object:player];
player.contentURL = movieURL;
player.movieSourceType = MPMovieSourceTypeFile;
player.controlStyle = MPMovieControlStyleNone;
player.fullscreen = YES;
switch (orientation) {
case UIInterfaceOrientationLandscapeLeft:
player.view.transform = CGAffineTransformMakeRotation(90.0f * (M_PI/180.0f));
break;
case UIInterfaceOrientationLandscapeRight:
player.view.transform = CGAffineTransformMakeRotation(-90.0f * (M_PI/180.0f));
break;
default:
break;
}
player.view.frame = self.view.bounds;
[self.view addSubview:player.view];
}
[self.moviePlayerController play]
我試圖從鏈接Movie.m4v,它仍然無法正常工作。 – Jebadiah
然後,您可能將不得不顯示您的代碼,以便任何人都可以幫助您。 – Darren
只需編輯我的問題。謝謝。 – Jebadiah