Created
June 22, 2013 09:39
-
-
Save ikekou/5840178 to your computer and use it in GitHub Desktop.
[Objective-C] URLを指定して動画を再生(MPMoviePlayerViewController使う場合)
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
/*-------------------------------------------------------------------------------- | |
URLを指定して動画を再生 | |
--------------------------------------------------------------------------------*/ | |
- (void)playMovie:(NSURL *)url { | |
// MPMoviePlayerViewController作成 | |
self.moviePlayerView = [[MPMoviePlayerViewController alloc] initWithContentURL:url]; | |
// 自動再生しない | |
MPMoviePlayerController *p=self.moviePlayerView.moviePlayer; | |
p.shouldAutoplay=NO; | |
// コントロールなし | |
p.controlStyle=MPMovieControlStyleNone; | |
// ループ | |
p.repeatMode=MPMovieRepeatModeOne; | |
// 再生してみる | |
[p play]; | |
// モーダルとして表示させる | |
[self presentMoviePlayerViewControllerAnimated:self.moviePlayerView]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment