Search code examples
ioshtmluiwebviewmpmovieplayercontroller

Video Embedded in HTML5 won't play in UIWebView


I am loading up a website that has a video embedded in the code on the 5th 'page'. This video plays just fine in the full Safari, but I'm having an issue in my app. The code for loading it is:

- (void)viewWillAppear:(BOOL)animated {
        NSURL *url = [NSURL URLWithString:_entry.articleUrl];    
        [_webView loadRequest:[NSURLRequest requestWithURL:url]];
    timer = [NSTimer scheduledTimerWithTimeInterval:(1.0/2.0) target:self selector:@selector(tick) userInfo:nil repeats:YES];

}

When I get to the page with the video, it shows up in the frame: enter image description here but when I click on the play button, the app begins messing up.

After clicking on it, the MPMoviePlayerController briefly appears, but instantly gets dismissed and it reloads the original URL, taking the user back to the first page of the issue. Any thoughts to what may be happening here, or better ways for me to code the app to make sure the video plays in the proper controller?


Solution

  • The issue ending up being that when the view disappeared it was setting it to an about:blank page. So, when the movie controller took over the view to play, it passed that line of code.