iOS Reference Library Apple Developer
Search

Introduction

Overview

Multimedia technologies in iOS let you access the sophisticated audio and video capabilities of iOS devices. Use Core Audio to generate, record, mix, process, and play audio in your application. The open-source OpenAL interface supports high-performance positional audio playback, ideal for games. The Media Player framework supports full-screen playback of video files and provides playback of the audio items in a user’s iPod library. Starting in iOS 3.0, you can add video recording capability to your application.

The Basics

Before you begin writing audio code:

Before you begin writing video code:

Next Steps

You select among the various APIs for audio and video based on the needs of your application. All iOS developers need to learn about audio sessions.

Using Audio Sessions

Audio Session Services in iOS let you manage your application’s behavior in the context of interruptions such as incoming phone calls, and to handle audio routing changes such as when users unplug headsets. This technology also lets you specify your audio intentions, for example, whether or not you want your audio to continue when the user moves the Ring/Silent switch to silent.

Every iOS application that uses audio should employ Audio Session Services. For more information, read Audio Session Programming Guide. For an example of how to use this technology in a recording and playback application, see the SpeakHere sample.

Playing Audio

Depending on your needs, you play audio in iOS using the AVAudioPlayer class, Audio Queue Services, OpenAL, the I/O audio unit or System Sound Services. You can also play audio items from the user’s iPod library using the iPod Library Access API.

Using Streamed Audio

You can capture and play streamed audio.

Recording Audio

To record sounds on iOS devices, use the AVAudioRecorder class as described in AVAudioRecorder Class Reference.

You can also record sounds using Audio Queue Services, documented in Audio Queue Services Programming Guide and Audio Queue Services Reference. See the SpeakHere sample, which demonstrates how to record sound in all audio formats supported in iOS.

Playing Video

The MPMoviePlayerController class supports video playback in either H.264 (Baseline Profile Level 3.0) format or MPEG-4 Part 2 video (Simple Profile) format. Playback is full-screen and is primarily intended for game developers who want to play animations.

You can also use the MPMoviePlayerController class to play videos streamed from the Internet, as demonstrated in the MoviePlayer sample.

Read “Playing Video Files” in iOS Application Programming Guide for more on adding video playback to your application.

Recording Video

Starting in iOS 3.0, you can record video, with included audio, on supported devices. Employ the UIImagePickerController class, just as for capturing still images. Read “Recording Video” in iOS Application Programming Guide and see UIImagePickerController Class Reference.

Additional Resources

The iPhone Dev Center provides guides, reference documentation, technical notes, and sample code for adding multimedia support to your application.

The Core Audio mailing list (coreaudio-api@lists.apple.com) is an excellent place to discuss Core Audio and OpenAL issues with fellow developers.

The iPhone Developer Forums let you ask questions and read answers about any and all iOS development topics.



Last updated: 2010-07-09

Did this document help you? Yes It's good, but... Not helpful...