I'm displaying an MJPEG stream in a UIWebView. I have two different sizes I want to use for the UIWebView. The video size is constant.
So setScalesPageToFit isn't flexible enough, and I have no control over the source to change the viewport meta tag. So I'm left thinking that I need to do this via javascript (of which I have very little knowledge). However I'm stuck with two issues:
1) What javascript to call to change the scale/width of the uiwebview. I've tried variations on:
[webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('body')[0].style.width='320px'"];
[webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('body')[0].style.webkitTransform='scale(1.0)'"];
2) I can't stringByEvaluatingJavaScriptFromString from webViewDidFinishLoad, since this doesn't get called when streaming. So I'm calling it straight after my loadRequest.
[edit] I've also now tried calling this a couple seconds later via NSTimer (although i can't really use this approach since I don't know when the video feed arrives). Anyway I see some impact on the scale, but the next frame that arrives seems to reset the scale.