0

I have an iOS app which I am developing, this app has videos which are copyright material. I am allowed to use them to be seen within the app but not to be seen when connected to a TV. ie. via HDMI or component - instead when a video is playing and someone connects a tv out lead to the device i need to display a screen like a splash screen saying it is not allowed etc...

So my question is how can i catch when a tv out device has been connected to the device? or how can i know when tv out has been requested to the MPMoviePlayerController (which is what im using to display the video)?

I have searched everywhere for this and can not find any answer!

Thanks.

GameDev
  • 445
  • 7
  • 21

1 Answers1

3

Check out Technical Q&A QA1738: How to Opt Out of Video Mirroring. Here is what you basically need to do:

UIScreen *aScreen;

NSArray *screens = [UIScreen screens];
for (aScreen in screens) 
{
    if ([aScreen respondsToSelector:@selector(mirroredScreen)] 
              && [aScreen mirroredScreen] == [UIScreen mainScreen]) 
    {
        // The main screen is being mirrored.
    }
    else 
    {
        // The main screen is not being mirrored, or
        // you are not running on a compatible device.
    }
}
Martin Gordon
  • 36,329
  • 7
  • 58
  • 54
  • thanks im assuming i would need some kind of notification to fire off to first detect new screen then to run this code above? – GameDev Sep 02 '11 at 15:12
  • Yes, if you look at the ExternalDisplay code linked in the article, you'll see that they register for UIScreenDidConnectNotification and UIScreenDidDisconnectNotification. – Martin Gordon Sep 02 '11 at 15:24