Created
June 23, 2009 03:29
-
-
Save doyle/134340 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This gist demonstrates how to play a movie on the iPhone | |
// This code sample assumes you have a file called "Movie.m4v" in your Resources folder, and | |
// have /included the MediaPlayer Framework (/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks/MediaPlayer.framework) | |
#import <MediaPlayer/MediaPlayer.h> | |
... | |
-(IBAction)playMovie:(id)sender{ | |
NSBundle *bundle = [NSBundle mainBundle]; | |
NSString *moviePath = [bundle pathForResource:@"Movie" ofType:@"m4v"]; | |
NSURL *movieURL = [NSURL fileURLWithPath:moviePath]; | |
MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:movieURL]; | |
[mp play]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment