ตัวอย่างนี้จะเป็นการนำไฟล์วีดีโอมาเล่นใน iPhone OS 3
1. สร้าง new Project ชื่อ SampleVideoPlayer
2. ทำการเพิ่ม Mediaplayer.framework ใน Frameworks Folder โดยเลือก Frameworks Folder -> Add ->Existing Frameworks -> MediaPlayer.framework
3. เปิดไฟล์ SampleVideoPlayerController.m ให้เพิ่ม #import <MediaPlayer/MediaPlayer.h> จากนั้นให้เพิ่ม Code ดังตัวอย่างด้านล่าง
-(void) viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
NSBundle *bundle = [NSBundle mainBundle];
NSString *moviePath = [bundle pathForResource:@"ISUHD4" ofType:@"mov"];
NSURL *movieURL = [NSURL fileURLWithPath:moviePath];
MPMoviePlayerController *theMovie =


MPMoviePlayerController alloc

initWithContentURL:movieURL

;
theMovie.scalingMode = MPMovieScalingModeAspectFill;
[theMovie play];
}
จากนั้นให้ Compile และ run คุณจะได้ Application ที่สามารถเล่นวีดีโอได้แล้วครับ
Download ตัวอย่าง Source Code จาก Attached File ด้านล่างได้ครับ