我正在使用MPMoviePlayerController,但我得到的問題是,它的重複只有兩次,但我不得不重複它不斷如何做,請任何人建議我更好的方式。如何在iphone中播放視頻?
-(void)viewDidLoad
{
player = [[MPMoviePlayerController alloc] initWithContentURL:outPutUrl];
player.view.frame = CGRectMake(0, 0, 320, 480);
player.repeatMode = MPMovieRepeatModeOne;
[player setShouldAutoplay:YES];
[player prepareToPlay];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayerDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:player];
[player setControlStyle:MPMovieControlStyleNone];
[self.imgView addSubview:player.view];
[player play];
}
-(void)moviePlayerDidFinish:(NSNotification *)note
{
if (note.object == player)
{
NSLog(@"this is note%@",note.object);
NSInteger reason = [[note.userInfo objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey] integerValue];
if (reason == MPMovieFinishReasonPlaybackEnded)
{
[player play];
}
}
}
粘貼outPutUrl – 2013-04-08 12:39:31
我有過去outPutUrl路徑已經跑了兩次,但沒有運行第三次。 – IOSDev 2013-04-08 12:41:22
一旦粘貼outPutUrl在這裏.. – 2013-04-08 12:43:49