UIWebView Movie Player getting dismissed iOS 6 bug

前端 未结 2 1431
花落未央
花落未央 2020-12-29 16:47

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

[MPAVController] Autoplay: Enablin         


        
相关标签:
2条回答
  • 2020-12-29 17:41

    I just had this very same issue in one of our apps. Turns out we were setting the UIWebView's HTML to an empty string in -(void)viewWillDisappear. Apparently this method is now being called in iOS 6 when displaying a fullscreen video from an UIWebView, so that's probably where your issue comes from.

    0 讨论(0)
  • 2020-12-29 17:49

    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 have fixed the Same As Below.

    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.

    0 讨论(0)
提交回复
热议问题