Skip to content

Instantly share code, notes, and snippets.

@gshackles
Created January 14, 2014 23:29
Show Gist options
  • Save gshackles/8428032 to your computer and use it in GitHub Desktop.
Save gshackles/8428032 to your computer and use it in GitHub Desktop.
Hacktastic detection of full screen video playing
/*
* 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