Chapter 6. Advanced Programming Topics: Canvas and Video

The unique platform capabilities of iPhone and iPod touch enable developers to create innovative applications inside of Mobile Safari that go beyond the normal "Web app" fare. Mobile Safari's support for the canvas element opens drawing and animation capabilities in an ordinary HTML page that was previously available only by using Flash or Java. What's more, deep inside the heart of these two Apple devices lies the best portable audio and video media player that money can buy. As an application developer, you can take advantage of these iPod capabilities by seamlessly integrating multimedia into your mobile applications.

However, once you begin to open up these capabilities of Mobile Safari or the device itself, you need to be sure that you are working with an iPhone and iPod touch rather than a desktop browser. So, I'll start by showing you how to identify the user agent for iPhone and iPod touch.

Identifying the User Agent for iPhone and iPod touch

When you are trying to identify the capabilities of the browser requesting your Web site or application, you generally want to avoid detecting the user agent and use object detection instead. However, if you are developing an application designed exclusively for iPhone/iPod touch or need Safari-specific features, such as canvas, then user agent detection is a valid option. Therefore, this chapter assumes you are creating a Mobile Safari—specific application. Chapter 8 discusses using ...

Get Professional iPhone™ and iPod® touch Programming: Building Applications for Mobile Safari™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.