Skip to content

Instantly share code, notes, and snippets.

@akisute
Last active July 30, 2018 01:56
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akisute/0ab3c3596e6f4fb4a5aa to your computer and use it in GitHub Desktop.
Save akisute/0ab3c3596e6f4fb4a5aa to your computer and use it in GitHub Desktop.
Dismissing fullscreen movie player from <video> tag in UIWebView
- (void)exitFullScreenVideo
{
// Works in iOS, not sure in OS X
[self.webView stringByEvaluatingJavaScriptFromString:@"Array.prototype.forEach.call(document.getElementsByTagName('video'),function(v){v.webkitExitFullscreen();});"];
// Didn't work in iOS, works in OS X
[self.webView stringByEvaluatingJavaScriptFromString:@"if(document.webkitFullscreenElement){document.webkitExitFullscreen();}"];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment