Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios MPMoviePlayer全屏关闭导致黑色视图/块_Ios_Video_Mpmovieplayer - Fatal编程技术网

Ios MPMoviePlayer全屏关闭导致黑色视图/块

Ios MPMoviePlayer全屏关闭导致黑色视图/块,ios,video,mpmovieplayer,Ios,Video,Mpmovieplayer,我正在播放MPMoviePlayer的视频,而不是全屏,当我进入全屏时,视频将继续播放并显示全屏。 但当我再次关闭全屏时,我只能在播放“小”视频的地方看到黑色背景。它对触摸或任何东西都没有反应 我从不在我的播放器上调用stop,并且没有声明viewdiddissapear或类似的函数。 电影播放器也没有发布 我想在关闭全屏时继续播放视频。有什么想法吗 **编辑 它适用于iPad1,但不适用于iPad2。。。奇怪的我需要它在所有的功能 电影播放器初始化: NSURL *fileURL = [NSU

我正在播放MPMoviePlayer的视频,而不是全屏,当我进入全屏时,视频将继续播放并显示全屏。 但当我再次关闭全屏时,我只能在播放“小”视频的地方看到黑色背景。它对触摸或任何东西都没有反应

我从不在我的播放器上调用stop,并且没有声明viewdiddissapear或类似的函数。 电影播放器也没有发布

我想在关闭全屏时继续播放视频。有什么想法吗

**编辑 它适用于iPad1,但不适用于iPad2。。。奇怪的我需要它在所有的功能

电影播放器初始化:

NSURL *fileURL = [NSURL fileURLWithPath:filePath];
self.moviePlayer = [[MPMoviePlayerController alloc] init];
self.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
self.moviePlayer.controlStyle = MPMovieControlStyleEmbedded;
self.moviePlayer.contentURL = fileURL;
self.moviePlayer.backgroundView.backgroundColor = [UIColor blackColor];
self.moviePlayer.shouldAutoplay = YES;
[self.moviePlayer.view setFrame:CGRectMake(1024, floorf((self.view.bounds.size.height / 2) - (318 / 2)), 425, 318)];
[self.moviePlayer prepareToPlay];


[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(MPMoviePlayerLoadStateDidChange:)
                                             name:MPMoviePlayerLoadStateDidChangeNotification
                                           object:self.moviePlayer];

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(MPMoviePlayerDidFinish:)
                                             name:MPMoviePlayerPlaybackStateDidChangeNotification
                                           object:self.moviePlayer];

[self.view addSubview:self.moviePlayer.view];
[self.view bringSubviewToFront:self.moviePlayer.view];

[UIView animateWithDuration:0.25
                      delay:0.0
                    options:UIViewAnimationCurveEaseOut
                 animations:^{
                     self.moviePlayer.view.transform = CGAffineTransformIdentity;
                     self.moviePlayer.view.position = CGPointMake(floorf(787 - (self.moviePlayer.view.frame.size.width / 2)),
                                                      self.moviePlayer.view.position.y);
                 }
                 completion:nil];
通知

- (void)MPMoviePlayerLoadStateDidChange:(NSNotification *)notification
{
NSLog(@"Loadstate changed");
if((self.moviePlayer.loadState & MPMovieLoadStatePlaythroughOK) == MPMovieLoadStatePlaythroughOK)
{
    [self.moviePlayer play];
}
}

- (void)MPMoviePlayerDidFinish:(NSNotification *)notification
{
MPMovieFinishReason finishReason = (MPMovieFinishReason) [notification.userInfo objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey];

switch(finishReason)
{
    case MPMovieFinishReasonPlaybackError: NSLog(@"Stopped playback due to error");
    case MPMovieFinishReasonPlaybackEnded: NSLog(@"I just quitted");
    case MPMovieFinishReasonUserExited: NSLog(@"User quitted");
}
}