Last active
December 24, 2015 07:03
-
-
Save ykws/5160b0e1a4074f2e3cb4 to your computer and use it in GitHub Desktop.
Play Movie on iOS with full screen, landscape and no control
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
#import "MovieViewController.h" | |
#import <MediaPlayer/MediaPlayer.h> | |
@interface MovieViewController () | |
@property (strong, nonatomic) MPMoviePlayerController *player; | |
@end | |
@implementation MovieViewController | |
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
self.player = [[MPMoviePlayerController alloc] initWithContentURL:[[NSBundle mainBundle] URLForResource:@"movie" withExtension:@"mp4"]]; | |
[self.player prepareToPlay]; | |
self.player.controlStyle = MPMovieControlStyleNone; | |
self.player.view.transform = CGAffineTransformConcat(self.player.view.transform, CGAffineTransformMakeRotation(M_PI_2)); | |
self.player.view.frame = self.view.bounds; | |
[self.view addSubview:self.player.view]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment