Skip to content

Instantly share code, notes, and snippets.

@ykws
Last active December 24, 2015 07:03
Show Gist options
  • Save ykws/5160b0e1a4074f2e3cb4 to your computer and use it in GitHub Desktop.
Save ykws/5160b0e1a4074f2e3cb4 to your computer and use it in GitHub Desktop.
Play Movie on iOS with full screen, landscape and no control
#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