I am using this code for loading video in UIWebView
:
youTubeVideoHTML = @"<html><head>\
<body style=\"margin:0\">\
<embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \
width=\"%0.0f\" height=\"%0.0f\"></embed>\
</body></html>";
videoWebView.delegate = self;
// Populate HTML with the URL and requested frame size
NSString *html = [NSString stringWithFormat:youTubeVideoHTML, videoURL, videoWebView.frame.size.width, videoWebView.frame.size.height];
// Load the html into the webview
[videoWebView loadHTMLString:html baseURL:nil];
[self.view addSubview:videoWebView];
It works fine, but on orientation change, it shows same width and height that in previous orientation.
If I use this code:
NSString *html = [NSString stringWithFormat:youTubeVideoHTML, videoURL, videoWebView.frame.size.width, videoWebView.frame.size.height];
// Load the html into the webview
[videoWebView loadHTMLString:html baseURL:nil];
in willAnimateRotationToInterfaceOrientation
then video stops playing and reloads the URL.
Is there any way to resize the video without reloading the page?