UIWebView电影播放器​​被解雇iOS 6错误

Enc*_*lon 3 iphone mpmovieplayercontroller uiwebview ios ios6

当我尝试在a中启动视频(通过YouTube)时UIWebView,视频会打开,然后调试器会说:

[MPAVController] Autoplay: Enabling autoplay
[MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 0, on player: 1)
Run Code Online (Sandbox Code Playgroud)

这是一个类似的问题:MPMoviePlayerController在几秒钟后停止播放

我唯一的问题是,有UIWebView,我不能建立一个MPMoviePlayerControllerprepareToPlay.至少不是我的知识.如果有人可以帮助解决这个问题,那将是惊人的!

Kam*_*had 11

我在ios6中遇到了同样的问题.Reason是在iOS6下面播放youTube视频时.viewWillDisappear方法没有调用.但是在iOS6中这种方法每当YouTube视频播放时都会调用.它可能是一个bug,我现在还不知道.

我修复了相同的下面.

设置全屏输入和退出通知的通知,以便您可以设置一些标志值以避免执行SOme代码.

// For FullSCreen Entry 

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youTubeVideofullScreen:) name:@"UIMoviePlayerControllerDidEnterFullscreenNotification" object:nil];

// For FullSCreen Exit
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youTubeVideoExit:) name:@"UIMoviePlayerControllerDidExitFullscreenNotification" object:nil];


- (void)youTubeVideofullScreen:(id)sender
   {   //Set Flag True.
      isFullscreen = TRUE;

   }

- (void)youTubeVideoExit:(id)sender
 {
      //Set Flag False.
     isFullscreen = FALSE;
 }


-(void)viewWillDisappear:(BOOL)animated{
   //Just Check If Flag is TRUE Then Avoid The Execution of Code which Intrupting the Video Playing.
 if(!isFullscreen)
   //here avoid the thing which you want. genrally you were stopping the Video when you will leave the This Video view.
   [super viewWillDisappear:animated];
 }
Run Code Online (Sandbox Code Playgroud)

我当然对你有所帮助.