Created
April 5, 2015 01:49
-
-
Save osmszk/4e155b867a9199c806d2 to your computer and use it in GitHub Desktop.
Play Movie
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
@property (strong,nonatomic) MPMoviePlayerController *player; | |
- (void)viewDidLoad | |
{ | |
NSURL *url = [NSURL URLWithString:@"http://www.gomplayer.jp/img/sample/mp4_h264_aac.mp4"]; | |
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:url]; | |
player.controlStyle = MPMovieControlStyleNone; | |
self.player = player; | |
[[NSNotificationCenter defaultCenter] addObserver:self | |
selector:@selector(moviePreloadDidFinish:) | |
name:MPMediaPlaybackIsPreparedToPlayDidChangeNotification | |
object:player]; | |
[[NSNotificationCenter defaultCenter] addObserver:self | |
selector:@selector(moviePlayerPlaybackDidFinish:) | |
name:MPMoviePlayerPlaybackDidFinishNotification | |
object:player]; | |
player.view.frame = CGRectMake(0, 0, 320, 200); | |
[self.view addSubview:player.view]; | |
[player prepareToPlay]; | |
} | |
- (void)moviePreloadDidFinish:(id)sender | |
{ | |
} | |
- (void)moviePlayerPlaybackDidFinish:(id)sender | |
{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment