Wednesday, December 8, 2010

Playing Video on iOS4 with the MediaPlayer Framework





Your Ad Here


This tutorial is good for iPhone SDK beginners, as each step assumes no prior-knowledge of the Xcode environment. Intermediate developers may wish to jump straight to step 4, and those who just want to see the code snippets for playing a video can jump to steps 6 and 7.

MediaPlayer Tutorial Overview:

Step 1. Create a New View-Based Project
This step will demonstrate the creation of a new view-based application template.
iOS Media Player Framework Step 1 - Creating a project in Xcode

Step 2. Convert the Video File to an iOS Compatible Format
This step discusses the video file formats and codecs supported by the iPhone OS, and the steps necessary to convert a video from an unsupported format to a supported format using iTunes.
iOS Media Player Framework Step 2 - Valid Video File Formats

Step 3. Add Project Resources
This step displays the various project files that will be used in the MoonWalk application and demonstrates the process of adding them into the project resources folder.
iOS Media Player Framework Step 3 - Adding Project Resources

Step 4. Add the MediaPlayer Framework & Configure MoonWalkViewController.h
This step will demonstrate adding the MediaPlayer framework to the project and will customize the Moon Walk header file with the method prototype used in the application.
iOS Media Player Framework Step 4 - Adding the Framework in MoonWalk ViewController

Step 5. Create the Interface with Interface Builder
This step will utilize Interface Builder to customize the application interface with the graphic files provided.
iOS Media Player Framework Step 5 - Building the Interface with Interface Builder

Step 6. Add the “play” Method Implementation to MoonWalkViewController
This step demos the use of the MPMoviePlayerController class in order to play the moon walk landing video.
iOS Media Player Framework Step 6 - MPMoviePlayerController
Step 7. Add an NSNotification Callback for MPMoviePlayerPlaybackDidFinishNotification
This step introduces the user to the NSNotificationCenter and resolves the memory leak created in step 6. The NSLog() method created in step 6 is demonstrated and a small bug introduced in that function is fixed.
iOS Media Player Framework Step 7 - NSNotificationCenter Example 
 
 

No comments:

Post a Comment

 
Submit Express Inc.Search Engine Optimization Services