Product Cover Image

Learning AV Foundation: A Hands-on Guide to Mastering the AV Foundation Framework

By Bob McCune

Published by Addison-Wesley Professional

Published Date: Oct 27, 2014


AV Foundation for iOS and OS X® Programming—Get Started Fast!


If you develop media-rich iOS or OS X apps, you can do amazing things with Apple’s AV Foundation. However, the framework is extremely large, reliant on cutting-edge language features, and poorly documented. Now, there’s a more productive way to master these immensely powerful technologies: Bob McCune’s Learning AV Foundation.

McCune’s live presentations and GitHub projects have already helped thousands of Apple developers get started with AV Foundation. Building on his experience, McCune helps you gain true mastery by creating real-world apps, hands-on.

You’ll build a voice memo app, custom video player, video editor, and an image/video camera app. As you proceed, you’ll master all the techniques you need to write your own advanced media apps from scratch. Throughout, McCune provides carefully crafted challenges and complete starter apps—all designed to help you deepen your understanding and make the most of Apple’s breakthrough media framework.



  • Understanding how AV Foundation fits in Apple’s media environment and each of its key areas of functionality
  • Enabling your apps with audio playback and recording features
  • Enhancing video playback to deliver a richer, more dynamic experience
  • Using AV Kit to match your user interfaces with iOS Videos or OS X QuickTime Player
  • Developing media capture apps with real-time video processing using OpenGL ES and Core Image
  • Implementing custom video players
  • Integrating advanced capture features such as video zooming, face detection, barcode scanning, and high frame rate capture
  • Mixing multiple audio tracks and automating volume control
  • Building sophisticated non-linear, non-destructive editing apps
  • Adding advanced video editing capabilities, such as video transitions and animation effects

Table of Contents

Preface     xiii

Part I: AV Foundation Essentials     1


Chapter 1: Getting Started with AV Foundation     3

  What Is AV Foundation?     3
  Where Does AV Foundation Fit?     4
  Decomposing AV Foundation     6
  Understanding Digital Media     7
  Digital Media Compression     13
  Container Formats     18
  Hello AV Foundation     19
  Summary     23
  Challenge     24

Chapter 2: Playing and Recording Audio     25

  Mac and iOS Audio Environments     25
  Understanding Audio Sessions     26
  Audio Playback with AVAudioPlayer     28
  Building an Audio Looper     30
  Configuring the Audio Session     34
  Handling Interruptions     36
  Responding to Route Changes     40
  Audio Recording with AVAudioRecorder     42
  Building a Voice Memo App     45
  Enabling Audio Metering     52
  Summary     57
Chapter 3: Working with Assets and Metadata     59

  Understanding Assets     59
  Creating an Asset     60
  Asynchronous Loading     63
  Media Metadata     65
  Working with Metadata     70
  Building the MetaManager App     76
  Saving Metadata     98
  Summary     101
  Challenge     101

Chapter 4: Playing Video    103

  Playback Overview    103
  Playback Recipe    107
  Working with Time    109
  Building a Video Player    110
  Time Observation    118
  Creating a Visual Scrubber    124
  Showing Subtitles    129
  Airplay    133
  Summary    136
  Challenge    136

Chapter 5: Using AV Kit     137
  AV Kit for iOS     137
  AV Kit for Mac OS X     140
  First Steps     140
  Control Styles     144
  Going Further     147
  Working with Chapters     151
  Enabling Trimming     157
  Exporting     159
  Movie Modernization     161
  Summary     165
  Challenge     166

Part II: Media Capture     167


Chapter 6: Capturing Media     169

  Capture Overview     169
  Simple Recipe     174
  Building a Camera App     175
  Summary     208
  Challenge     208

Chapter 7: Using Advanced Capture Features     209

  Video Zooming     209
  Face Detection     216
  Machine-Readable Code Detection     228
  Using High Frame Rate Capture     241
  Processing Video     247
  Understanding CMSampleBuffer     249
  Summary     257
  Challenge     258

Chapter 8: Reading and Writing Media     259

  Overview     259
  Building an Audio Waveform View     265
  Advanced Capture Recording     276
  Summary     293
  Challenge     293

Part III: Media Creation and Editing     295


Chapter 9: Composing and Editing Media     297

  Composing Media     297
  Working with Time     300
  Basic Recipe     303
  Introducing 15 Seconds     307
  Building a Composition     311
  Exporting the Composition     316
  Summary     321
  Challenge     322

Chapter 10: Mixing Audio     323

  Mixing Audio     323
  Mixing Audio in the 15 Seconds App     327
  Summary     333
  Challenge     333

Chapter 11: Building Video Transitions      335

  Overview      335
  Conceptual Steps      337
  15 Seconds: Adding Video Transitions      348
  Summary      360
  Challenge      360

Chapter 12: Layering Animated Content     361

  Using Core Animation     361
  Using Core Animation with AV Foundation     363
  15 Seconds: Adding Animated Titles     367
  Preparing the Composition     378
  Summary     383
  Challenge     384


Learning AV Foundation: A Hands-on Guide to Mastering the AV Foundation Framework

This title is currently unavailable on myPearsonStore.