我正在开发一个项目,在该项目中,单击按钮时将播放视频。在我使用此按钮操作之前,MPMoviePlayer 运行良好。但在实施之后,视频播放正常,但播放器无法识别触摸,甚至不显示播放时间。只显示这样( - - )。
我正在处理这段代码:
-(void) sceneBegins:(id)sender
{
....
theMoviePlayer = [MPMoviePlayerController new];
[theMoviePlayer setContentURL:movieURL];
theMoviePlayer.controlStyle = MPMovieControlStyleEmbedded;
theMoviePlayer.backgroundView.hidden = YES;
[theMoviePlayer setMovieSourceType:MPMovieSourceTypeFile];
theMoviePlayer.shouldAutoplay = YES;
[theMoviePlayer prepareToPlay];
[theMoviePlayer.view setFrame:View.bounds];
[theMoviePlayer.view setUserInteractionEnabled:YES];
theMoviePlayer.scalingMode = MPMovieScalingModeAspectFit;
[View addSubview:theMoviePlayer.view];
theMoviePlayer.view.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
[theMoviePlayer play];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sceneChange:)
name:MPMoviePlayerPlaybackDidFinishNotification object:theMoviePlayer];
....
}
当视频停止播放时,它也不会进入停止通知方法。