我想播放此 URL 的视频http://www.youtube.com/watch?v=JPUWNcGDyvM&feature=player_embedded我上次暂停的地方...我可以播放视频但是当我离开此页面并返回查看这个视频将从之前开始。但我想在我上次暂停的地方继续播放这个视频。代码..
- (void)viewDidLoad
{
player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@video.mp4",urlVideo]]];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(movieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:player];
//---play movie---
[player prepareToPlay];
[player pause];
player.view.frame = CGRectMake(0, 0, 320, 367);
[self.view addSubview:player.view];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(movieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:player];
[super viewDidLoad];
}
我的 movieFinishedCallbackm 方法是:-
- (void) movieFinishedCallback:(NSNotification*) aNotification {
player = [aNotification object];
[[NSNotificationCenter defaultCenter]
removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:player];
}