An MPMoviePlayerController object defines a full-screen movie player. You can use this class to play back movies stored in your application’s bundle or support directories. You can also use it to play movies and audio files loaded from a network-based URL.
Because it takes time to load movie files into memory, this class automatically begins loading your movie file shortly after you initialize a new instance. When it is done preloading the movie file, it sends the MPMoviePlayerContentPreloadDidFinishNotification notification to any registered observers. If an error occurred during loading, the userInfo dictionary of the notification object contains the error information. If you call the play method before preloading is complete, no notification is sent and your movie begins playing as soon as it is loaded into memory.
As soon as you call the play method, the player initiates a transition that fades the screen from your current window content to the designated background color of the player. If the movie cannot begin playing immediately, the player object continues displaying the background color and may also display a progress indicator to let the user know the movie is loading. When playback finishes, the player uses another fade effect to transition back to your window content.
Whether you want to play a single movie or a series of movies in sequence, instantiate only a single MPMoviePlayerController object at a time. When playback completes, the system posts the MPMoviePlayerPlaybackDidFinishNotification notification. In your notification handler, release the MPMoviePlayerController object. To play another movie, allocate and initialize a new MPMoviePlayerController object.
For performance reasons you may want to play movies as local files. Do this by first downloading them to a local directory.
Supported Formats
This class supports any movie or audio files that already play correctly on an iPod or iPhone. For movie files, this typically means files with the extensions .mov, .mp4, .mpv, and .3gp and using one of the following compression standards:
– H.264 Baseline Profile Level 3.0 video, up to 640 x 480 at 30 fps. (The Baseline profile does not support B frames.)
– MPEG-4 Part 2 video (Simple Profile)
If you use this class to play audio files, it displays a white screen with a QuickTime logo while the audio plays. For audio files, this class supports AAC-LC audio at up to 48 kHz, and MP3 (MPEG-1 Audio Layer 3) up to 48 kHz, stereo audio.