Chapter 28. Video

Basic video playback is performed in a view owned by an MPMoviePlayerController. You’ll need to link to MediaPlayer.framework and import <MediaPlayer/MediaPlayer.h>. There are two relevant classes supplied by the Media Player framework:

MPMoviePlayerController

Vends and controls a view that plays a movie.

The behavior of this class has changed very greatly from one system version to the next. It is difficult to use it compatibly with multiple system versions. In this chapter, I describe only its current behavior, with no attempt to discuss earlier differences or to advise you on backward compatibility.

MPMoviePlayerViewController
Owns an MPMoviePlayerController, and presents its view as a fullscreen view.

A simple interface for trimming video (UIVideoEditorController) is also supplied.

Sophisticated video playing and editing can be performed through AV Foundation. I won’t go deeply into AV Foundation in this book, but I’ll introduce it at the end of this chapter: I’ll talk a little about AVPlayer, an alternative class for playing a movie or a sound, and I’ll provide some code that demonstrates AV Foundation’s video- and audio-editing capabilities.

A mobile device does not have unlimited power for decoding and presenting video in real time. A video that plays on your computer might not play at all on an iOS device. See the “Media Layer” chapter of Apple’s iOS Technology Overview for a list of specifications and limits within which video is eligible for playing. ...

Get Programming iOS 5, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.