Created
January 14, 2014 23:29
-
-
Save gshackles/8428032 to your computer and use it in GitHub Desktop.
Hacktastic detection of full screen video playing
This file contains 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
/* | |
* surely there must be a better way? | |
* | |
* PresentedViewController.ToString() == "UIViewController" | |
* PresentedViewController.GetType() == typeof(UIViewController) | |
* new MonoTouch.ObjCRuntime.Class(PresentedViewController.GetType()).Name == "UIViewController" | |
*/ | |
public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations(UIApplication application, UIWindow forWindow) | |
{ | |
bool isFullScreenVideoPlaying = forWindow != null && forWindow.RootViewController != null | |
&& forWindow.RootViewController.PresentedViewController != null | |
&& forWindow.RootViewController.PresentedViewController.ToString().StartsWith("<MPInlineVideoFullscreenViewController"); | |
return isFullScreenVideoPlaying | |
? UIInterfaceOrientationMask.All | |
: UIInterfaceOrientationMask.Portrait; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment