Disabling Video Out of App Videos on iOS devices - iphone

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.

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.
}
}

Related

Swift image size based on device displayed on

I have a view controller I made. There is a lot of information displayed on it, including labels and images. I want to set it so if the device used is the iPhone 4 then an image does not display, to help conserve the view controller real estate. How do I do this in Swift?
For detecting devices (like iPhone 4):
var device = UIDevice.currentDevice().model
This string would show the device model. For instance, iPhone3,1 represents that it is an iPhone 4.
You can find the string for each device (including iPod and iPad) in this page: UIDevice currentDevice model possible values
if device == "iPhone3,1" {
imageview.hidden = true
}
The above method only works on real devices, but not simulators.
If you only want to hide the UIImageView on certain screen sizes regardless of the device type, you can use the method below.
if UIScreen.mainScreen().nativeBounds.height == 960.0 {
// code for iPhone 4 or 4S
} else {
// code for the rest
}
Checking the width like what Leonardo Savio Dabus answered would not work, since iPhone 5 has the same width as iPhone 4, but iPhone 5 has a larger screen than iPhone 4.
You can use this code to detect the device during runtime:
var device = UIDevice.currentDevice().model

AS3 detect ipad or iphone in Flash Professional CS6

Using Flash Professional CS6, I've created a game that looks and plays great on an iPad 2 and 3. So now I'm ready to make the app "Universal" by making one that works better for the smaller screen on iPhones.
What I'd like to do, is detect in my first frame something like this:
if iPhone {
gotoAndPlay(2, "Scene 1");
}
else if iPad {
gotoAndPlay(3, "Scene 2");
}
else {
trace("Not an iOS Device");
}
If seen posts from 2010 where people retrieved the height and width of the device in px, but surely there's a better way right?
Capabilities class has useful info. The os property should help determine the device but you'll need to experiment to see what each device returns.
However, i would suggest basing logic on screen size rather than device type - that way its more flexible.

UIImagePickerController on iPhone 4 device

This is no typical programming question.
I am currently developing an app using the latest SDK. This app will use the UIImagePickerController for taking pictures with the built-in camera.
I know the new iPhone 4 has 2 cameras built in. But the simulator doesn't support the camera in any way, so there's is now way to test the camera controller on a new iPhone. I do have a iPhone 3G to test my app with.
But what I want to know now, if someone can provide me a screenshot of the UIImagePickerController in camera mode running on his iPhone 4? But I really need an image from the UIImagePickerController not from the common camera application on the iPhone, because those two image pickers aren't the same! I can see this on my iPhone 3G: the built-in camera application and the UIImagePickerController are having a totally different UI.
Why I am asking for that? Because I want to know if there is a built-in switch in UIImagePickerController to switch between the front and rear camera. I know there is such a switch if you want to take a picture using the common iPhone 4 camera application, but I don't know if this switch also exists in UIImagePickerController from the SDK.
Thanks for your help!
C YA
Here you go. I managed to catch it with the zoom control and focus square.

TV out an iphone application

Using the UIScreen API is it possible to display the same app screen on both ipod screen and external display. I have tried using UIScreen but application is displaying only on external display, not on ipod screen. Please guide me on right way
See:
http://www.expertisemobile.com/2010/06/24/presenting-your-apps-on-the-big-screen-screen-mirroring-for-ios/

does not show external video out in ios4

I need to send video output to an external video screen from my iphone app. I am using the Apple Composite AV Cable. I get video output when I am playing a video through the ipod app, but when I do
[[UIScreen screens] count];
I only get one screen, the main phone screen. For my app I need to have a completely separate window like the process here:
Support for External Displays and Projectors
An iPad can now be connected to an external display through a supported cable. Applications can use this connection to present content in addition to the content on the device’s main screen. Depending on the cable, you can output content at up to a 720p (1280 x 720) resolution. A resolution of 1024 by 768 resolution may also be available if you prefer to use that aspect ratio.
To display content on an external display, do the following:
Use the screens class method of the UIScreen class to determine if an external display is available.
If an external screen is available, get the screen object and look at the values in its availableModes property. This property contains the configurations supported by the screen.
Select the UIScreenMode object corresponding to the desired resolution and assign it to the currentMode property of the screen object.
reate a new window object (UIWindow) to display your content.
Create a new window object (UIWindow) to display your content.
Assign the screen object to the screen property of your new window.
Configure the window (by adding views or setting up your OpenGL ES rendering context).
Show the window.
All that is here in a more readable format. I am working on an iphone, not an ipad, but the documentation says that external screens are now supported for iphones in ios4.
How can I get the phone to realize there is another screen attached? thanks
For posterity,
my problem was that I was using an iPhone 3GS. The ios4 video out stuff needs an iPhone 4 (it also works in 3.2 for the ipad i hear). With an iphone 4 I was able to get composite video out.
[[UIApplication sharedApplication] performSelector: #selector(startTVOut) withObject:nil afterDelay:.1]