Developing Android Applications with Adobe AIR [69]
Audiotool (http://www.audiotool.com) is an online music production studio that enables people worldwide to partake in a shared adventure of creating, sharing, and listening to music.
SoundCloud (http://soundcloud.com/) is a community site for creating, recording, and sharing sounds.
Isle of Tune (http://isleoftune.com/) is a musical sequencer. You build roads with houses and trees. Cars make music based on the landscape through which they are passing.
RUNXT LIFE (http://www.runxt.be/#/life/) is a generative music application based on the cellular automation theory Game of Life. The musical game evolves without human input.
Voice Notes (http://coenraets.org/blog/air-for-android-samples/voice-notes-for-android/) is an application for recording voice messages.
Chapter 12. Video
If it can be written, or thought, it can be filmed.
—Stanley Kubrick
Watching quality video has become common on the Internet, thanks to the Adobe Flash Player 9, which introduced high-definition video and full-screen support in 2007. Since then, we have seen the evolution of a new type of user who does not watch, or own, a television and relies on the Internet for her viewing.
Mobile devices—and tablets in particular—are expected to offer the same service and convenience. Device manufacturers and software engineers are hard at work to meet this expectation.
Until then, video developers, more than any others, need to gauge limitations and test options for the best user experience. In this chapter, we will go over the different areas to consider for the best video delivery and experience.
Preparing Video
A codec is software used to encode and decode a digital video signal. Engineers try various solutions to maintain video quality while reducing the amount of data, using state-of-the-art compression algorithm design.
A large portion of your work will comprise preparing and testing various configurations.
Codecs
At the time of this writing, AIR for Android supports codecs for On2 VP6, H.263 (Sorenson Spark), and H.264.
H.264, also called MPEG-4 Part 10 or AVC for Advanced Video Coding, delivers high-quality video at lower bit rates than H.263 and On2. It is more complicated to decode, however, and requires native GPU playback or a fast compressor to ensure smooth playback.
H.264 supports the following profiles: Baseline, Extended, Main, and various flavors of High. Test the profiles, as not all of them work with hardware-accelerated media decoding. It appears that only Baseline is using this at the time of this writing.
AAC (Advanced Audio Coding) is the audio codec generally paired with H.264. Nellymoser and Speex are supported, but do not utilize hardware decoding. Review Chapter 11 to learn more about this.
MPEG-4 (Moving Picture Experts Group) H.264 is an industry-standard video compression format. It refers to the container format, which can contain several tracks. The file synchronizes and interleaves the data. In addition to video and audio, the container includes metadata that can store information such as subtitles. It is possible to contain more than one video track, but AIR only recognizes one.
Encoding
You can use Adobe Media Encoder CS5 or a third-party tool such as Sorenson Squeeze or On2 Flix to encode your video.
It is difficult to encode video for every device capacity and display size. Adobe recommends grouping devices into low-end, medium-end, and high-end groups.
If your video is embedded or attached to your application, prepare and provide only one file and use a medium-quality solution to serve all your users. If your video is served over a network, prepare multiple streams.
Gather as much information as possible from the user before selecting the video to play. The criteria are the speed of the network connection and the performance of the device. To determine if the application is running over WiFi or 3G, please refer to How to Know if GPS or WiFi Is Active in Chapter 10. To get information on the device used, please refer to the section titled Capabilities in Chapter 5.
We will