Tuesday, August 23, 2011

Using a Pico projector to demo iPhone app

Laser Projector
Microvision makes a SHOWWX+ projector virtually the same size as an iPhone http://www.microvision.com/showwxplus/.  There are other pico projectors on the market, but the Microvision SHOWWX+ model was chosen specifically because it uses lasers to display the image which also means the image is always in focus, which is a big plus for a portable projector.

While the SHOWWX+ seems to be made for the iPhone/iPad/iPod Touch devices, many apps do not support video output, which means the apps simply won't display output on the projector.  For example, Hulu Plus and the native app Photos don't support video output.  However, Netflix, YouTube and iPod Videos works great.  There are a handful of workarounds, one of which including jailbreaking the phone.  But for my purposes, I just want to demo my apps using a projector.

Implementing Video Out for my app
Luckily Rob Tyrell has already blazed a trail for iOS developers to follow to add video output capability to an existing iOS app with a library called TVOutManager.  It's as simple as adding the TVOutManager.h and TVOutManager.m into the classes and updating the app delegate AppDidFinishLaunching method, by adding
[[TVOutManager sharedInstance] startTVOut];
Then build and run the application, plug in the projector and see your app on both the iOS device and the projector.

I did have a problem with my app at first and while I could see my app on both the iPhone and the projector, panning and zooming would not render on the projector until the transition completed which made the app appear choppy, but only on the projector.  This was resolved by setting kUseBackgroundThread to YES in TVOutManager.m
#define kUseBackgroundThread YES

My app is hard coded for a portrait mode so I did make a minor adjustment to TVOutManager.m deviceOrientationDidChange, and commented out all of the code for orientation changes.