Last active
July 30, 2018 01:56
-
-
Save akisute/0ab3c3596e6f4fb4a5aa to your computer and use it in GitHub Desktop.
Dismissing fullscreen movie player from <video> tag in UIWebView
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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