Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have UIWebView inside a modal popover that's a PresentationPageSheet style. When Youtube videos are played in full screen the expected behaviour is for them to popover full screen. Instead they just play inside the popover controllers dimensions. enter image description here

share|improve this question
    
Of course they only expand to fill their container! It would be dangerous for any web frame to be able to expand full-screen and leap put of its bounds on iOS, it implies that the DOM knows too much about the windowing system. –  CodaFi Jun 9 '13 at 3:33

1 Answer 1

The simple answer is that you have to embed the video inside an iframe.

if (self.youTubeID) {
    NSString *embeddedYouTubeURL = [NSString stringWithFormat:@"http://www.youtube.com/embed/%@",self.youTubeID];
    //NSString *controls = @"?controls=2&autohide=1";
    self.webView.opaque = NO;
    self.webView.backgroundColor = [UIColor blackColor];
    NSString *html = [NSString stringWithFormat:@"<!DOCTYPE HTML><head></head><html><body><iframe width='%f' height='%f' src='%@' allowfullscreen></iframe></body></html>", self.webView.frame.size.width *2, self.webView.frame.size.height*2, embeddedYouTubeURL];
    [self.webView loadHTMLString:html baseURL:nil]; }
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.