views:

158

answers:

2

Is there any way to emulate the Videos app such that we still maintain controls on the device (iPad/iPhone), but sends the video out through the cables to the TV? I looked into screen mirroring, but it's way too slow for videos, and regardless, the UIGetScreenImage() used by screen mirroring is no longer allowed by Apple.

The Videos app seems to have exactly what I need, but I don't see anything simple to make that happen.

Update (10/15/10): So apparently movies played through UIWebView have TV-Out support, while MPMoviePlayerController movies don't.

http://rebelalfons.posterous.com/iphone-os-support-for-tv-out

However, there is a caveat: this does not work on older devices updated to the most recent iOS. That is, iPod touches, iPhone 3G & 3GS don't work, while iPhone 4 and iPads do. Hoping there's some more stuff that we can use to fill in the gaps in compability, since I know its possible. Apps like AirVideo and StreamToMe currently support this functionality.

+1  A: 

I am not sure if there is an official way to do this. But as for your examples, AirVideo uses method Swizzling (check out: http://www.cocoadev.com/index.pl?MethodSwizzling) to override checks in Movie Player, and acting like Videos app

I guess some with some reverse engineering on SDK, you can find where the checks are made, and swizzle that method, with your custom one.

Deniz Mert Edincik
I'm wondering where you found out that AirVideo uses method swizzling?
David Liu
you can inspect downloaded application with a text editor, (or otool preferably) where you can see method names. With some reverse engineering, I guess you can find out how they do the swizzling.
Deniz Mert Edincik
A: 

In 3.2 and later (postdating the site you link to), UIScreen has a class method, 'screens' that'll return an array of one object — the main screen — if no external display is available, or two screens — the main screen and the external screen — if a TV lead is connected. The task should be as simple as positioning the views you want to appear on the external screen within its frame and the controls you want on the device within the other.

Have you tried that?

Edited for one additional comment: also as of 3.2, it is explicitly permissible to create an MPMovieController and then grab the view from it to treat as a normal UIView rather than doing a full 'present'. So that's how you'd get a movie view that you can position as you wish.

Tommy
UIScreens are not detected properly on older devices, which mean this method cannot be used.
David Liu
I highly recommend you file a bug report in that case. I've had a nothing but positive experience with Apple's bug reporting process.
Tommy
I already have. They've specifically stated that older devices lack the hardware to detect more UIScreens (although they clearly have the capability to detect TV-Out, which I suppose need not necessarily be a UIScreen).
David Liu