You are previewing Beginning iOS Media App Development.
O'Reilly logo
Beginning iOS Media App Development

Book Description

Beginning iOS Media App Development is a ground-breaking tutorial that explores the near limitless, programmable audio-visual capabilities of the iPhone, iPad and iPod touch using real-world examples and thorough explanations of the code. This book includes detailed step-by-step instructions and important background information from experienced media and utility app developer, Ahmed Bakir.

You'll learn about content creation, playback, and advanced topics, including AirPlay, AVKit, and Swift. Each chapter is framed with a project that illustrates the concepts being discussed and pulls in lessons from other popular apps. You'll even learn about the latest iOS 8 and Xcode 6 media features.

After reading this book, you should be able to build your first rich media app or utility app that utilizes multimedia for the App Store. And if you're a game developer, this book will provide you with tools to help make your game app look even better by integrating native iOS features.

Table of Contents

  1. Cover
  2. Title
  3. Copyright
  4. Dedication
  5. Contents at a Glance
  6. Contents
  7. About the Author
  8. About the Technical Reviewer
  9. Acknowledgments
  10. Introduction
  11. Chapter 1: Welcome to iOS Media App Development
    1. What Is the Purpose of This Book?
    2. What Makes Media App Development Different?
    3. What Do I Need to Know to Use This Book?
    4. What Do I Need to Get Started?
      1. An Active iOS Developer Program Account Is Required to Use This Book
    5. Building Your First iOS Media App
      1. About the Application
      2. Setting Up the Application
      3. Adding Images to Your App
      4. Handling User-Interface Events
      5. Running the Application on a Device
      6. Debugging Common Problems
    6. Summary
  12. Part 1: Images
    1. Chapter 2: Adding Images to Your App
      1. Using the UIImage Class to Represent Image Data
        1. Loading Bundled Files
        2. Using Asset Catalogs To Manage Images
        3. Loading Images at Runtime
      2. Using the UIImageView Class to Display Images
        1. Initializing an Image View
        2. Setting Image-Scaling Options
      3. Using the UIImagePickerController Class to Select Images
        1. Working with Protocols and Delegates
        2. Using the Image Picker to Access Saved Pictures
        3. Using the Image Picker to Take Pictures
        4. Understanding User Interface Limitations of the Image Picker
        5. Presenting the Photo Album on an iPad
      4. Summary
    2. Chapter 3: Doing Useful Things with Your Images
      1. Manipulating Images
        1. Resizing an Image
        2. Cropping an Image
      2. Saving Images
        1. Saving Images to Files
        2. Saving Images to the Photo Library
      3. Loading Images from the Internet
        1. Adding an Activity Indicator
      4. Adding Effects to Your Images
        1. Adding Gradients
        2. Making Your Images Move with Your Device
        3. Adding Blurring to Your Images
      5. Summary
    3. Chapter 4: Advanced Photo Interfaces
      1. Building a Custom Camera Interface
        1. Initializing the Hardware Interface
        2. Accessing the Live Camera Feed
        3. Capturing a Still Image
        4. Accessing Hardware Controls
      2. Building a Custom Image Picker
        1. Instantiating an Asset Library as a Data Source
        2. Using the UICollectionView Class to Enumerate Assets
        3. Enabling Multiple Selection
        4. Creating an Interface for Returning Image Data
      3. Summary
  13. Part 2: Audio
    1. Chapter 5: Playing and Recording Audio Files
      1. Playing Audio Files
        1. Getting Started
        2. Configuring an Audio Session
        3. Selecting an Audio File
        4. Setting Up the Audio Player
        5. Building a Playback Interface
      2. Recording Audio Files
        1. Getting Started
        2. Configuring the Audio Session
        3. Setting Up the Audio Recorder
        4. Building the Recording Interface
      3. Summary
    2. Chapter 6: Using External Audio Sources
      1. Importing Music from iTunes
        1. Getting Started
        2. Initializing the Music Player
        3. Specifying a Media Queue (Playlist)
        4. Creating an Item Selection Interface
        5. Building a Playback Interface
        6. Displaying Song Information (Metadata)
      2. Streaming Music
        1. Getting Started
        2. Connecting to a Stream
        3. Playing Streaming Audio
      3. Playing Event Sounds (Including Vibration)
        1. Getting Started
        2. Creating a System Sound
        3. Playing a System Sound
        4. Making the Device Vibrate
      4. Summary
    3. Chapter 7: Advanced Audio Topics
      1. Backgrounding Audio
        1. Setting Background Modes
        2. Selecting a Compatible Session Type
      2. Using the Now Playing Center
        1. Displaying Metadata
        2. Enabling Playback Controls (Remote Controls)
      3. Building a More Robust Audio Session
        1. Handling Audio Interruptions
        2. Handling Hardware (Route) Changes
      4. Using AirPlay
      5. Summary
  14. Part 3: Video
    1. Chapter 8: Playing and Recording Video
      1. Playing Video Files
        1. Getting Started
        2. Initializing the Video Player
        3. Adding Notification Handling to Your Class
        4. Configuring the Video Player
        5. Starting Playback
      2. Recording Video Files
        1. Getting Started
        2. Configuring the Image Picker for Video
        3. Saving Video Recordings
      3. Summary
    2. Chapter 9: Building a Custom Video-Playback Interface
      1. Getting Started
      2. Building the User Interface
      3. Using the AVPlayer Class for Media Playback
        1. Creating MediaPlayer-like Notifications
      4. Building Playback Controls
        1. Toggling Playback
        2. Skipping Forward/Backward
        3. Using the Playback Scrubber
        4. Dismissing the Playback Interface
      5. Adding User-Interface Updates
        1. Updating Playback Progress
        2. Automatically Hiding the Playback Controls
      6. Summary
    3. Chapter 10: Building a Custom Video-Recording Interface
      1. Getting Started
      2. Setting Up the Hardware Interface
      3. Building the User Interface
        1. Setting Up the Video Layer
        2. Adding Controls for Capture Settings
        3. Starting/Stopping Recording
      4. Completing a Recording
        1. Saving Video Output
        2. Showing the Preview Interface
        3. Modifying Your Protocol for Video
      5. Summary
  15. Part 4: iOS8 and Beyond
    1. Chapter 11: User Interface Development with Xcode 6
      1. Using Size Classes to Build Adaptive User Interfaces
      2. Using Quick Look for Runtime Previews
      3. Adding Interface Builder Previews to Your Classes
        1. Using Interface Builder to Debug Your Views
      4. Summary
    2. Chapter 12: Using the AVKit Framework for Media Playback
      1. Getting Started
      2. Using the AVPlayer Class to Play a Media File
        1. Presenting the AVPlayerViewController
      3. Using the AVQueuePlayer Class to Play a Playlist
      4. Working with Media Playback Events
        1. Loading Complete Event
        2. Playback Complete Event
        3. Error Handling
      5. Adding an Overlay View (Watermark)
      6. Summary
    3. Chapter 13: Tracking Fitness with HealthKit and Core Motion
      1. Getting Started
      2. Using Core Motion to Track Activity
        1. Requesting Motion Activity Permission
        2. Starting a Workout
        3. Integrating Background Updates
        4. Stopping a Workout
      3. Using HealthKit to Sync Data
        1. Requesting Permission to Use HealthKit
        2. Retrieving Data from HealthKit
        3. Getting Real-Time Updates
        4. Logging an Activity
      4. Summary
    4. Chapter 14: Getting Started with Swift
      1. Getting Started
        1. Creating a New Project
        2. Importing Objective-C Classes into Your Project
        3. Building a Storyboard
      2. Basic Swift Syntax
        1. Calling Methods (Hello World)
        2. Defining Variables
        3. Instantiating Objects
        4. Accessing Properties and Methods (Including Objective-C)
        5. Casting
        6. Using String Formatters
        7. Using Arrays
        8. Using Conditional Logic
        9. Using Loops
        10. Defining Methods
        11. Calling Enumerated Types
        12. Using Unusual Punctuation (Question Mark and Exclamation Mark Operators)
      3. Building a Class
        1. Connecting Items to Interface Builder
        2. Adding Delegate Support
        3. Adding Key-Value Observer Support
        4. Adding Notification Support
      4. Summary
  16. Index