UIWebView电影播放器​​被解雇iOS 6错误 [英] UIWebView Movie Player getting dismissed iOS 6 bug

查看:198
本文介绍了UIWebView电影播放器​​被解雇iOS 6错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

When I try to initiate a video to play (via YouTube) in a UIWebView, the video opens, then the debugger says:

[MPAVController] Autoplay: Enabling autoplay
[MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 0, on player: 1)

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

Here's a similar question: MPMoviePlayerController stops playing after a few seconds

我唯一的问题是,使用 UIWebView ,我无法将 MPMoviePlayerController 设置为 prepareToPlay 。至少不是我的知识。如果有人可以帮助解决这个问题,那就太棒了!

My only problem is that with a UIWebView, I can't set up an MPMoviePlayerController to prepareToPlay. At least not as far as my knowledge goes. If anyone can help fix this problem, that would be amazing!

推荐答案

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

I have Faced The Same Problem in ios6 .Reason is that in below iOS6 when youTube Video Played. viewWillDisappear method did not call .But in iOS6 this methods called every time whenever YouTube video Play .It may be a bug ,i don't know at this time.

I固定下面的相同。

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

Set The Notification for FullScreen Entry And Exit Notification ,SO that you could set Some Flag Value For Avoiding the Execution of SOme Piece of code.

// 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];
 }

我肯定会对你有所帮助。

I am Sure It'll be helpful to you.

这篇关于UIWebView电影播放器​​被解雇iOS 6错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆