Chapter 12. Media: audio and recording
This chapter covers
- Accessing the iPod library to play music
- Recording audio from the built-in microphone
- Playing sounds
- Recording, playing, and accessing video
In the previous chapter, we discussed the basics of images. This chapter will detail how to play and record various types of audio and video. This will include how to play back audio items in the user’s iPod library as well as how to record to and play from the user’s video library.
To further demonstrate these concepts, you’ll create two sample applications. The first application is a simple media player that lets the user choose a song from their iPod library and play it back within the application. The next will be a simple recording and playback application that lets the user record audio of an arbitrary length and play it back.
When Apple first released the iPhone SDK, the company provided complete access to the photo library but left out a huge piece of media stored on the iPhone: the iPod music library. Many people bought their fancy new iPhones for the sole purpose of combining their electronics (cell phone, iPod, GPS, and so on), and for Apple to leave out this access was quite a surprise to developers.
Apple saw the need for such control within an application and added some new classes to the Media Player framework to allow you to retrieve items from the iPod media library as well as play them.