The iPhone Retina is capable of displaying 1080p video content. This format is compatible with various resolutions, but most often it is defined as 1920 x 1080. This is also the size of a video with a built-in camera, so it can be played back even more than indicated in the documentation. allowable size.
I was able to verify this with the following code. Create a basic project with one view and add the video file to the group of supporting files.
ViewController.h
#import <UIKit/UIKit.h> #import <MediaPlayer/MediaPlayer.h> @interface CDTViewController : UIViewController{ MPMoviePlayerController *moviePlayer; } -(IBAction) playMovie; @end
ViewController.m
@implementation CDTViewController - (void)viewDidLoad { [super viewDidLoad]; } -(void)playMovie { NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"IMG_3803" ofType:@"MOV"]]; moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url]; if ([moviePlayer respondsToSelector:@selector(loadState)]) { [moviePlayer setControlStyle:MPMovieControlStyleEmbedded]; [moviePlayer setFullscreen:NO]; [moviePlayer prepareToPlay]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayerLoadStateDidChange:) name:MPMoviePlayerLoadStateDidChangeNotification object:nil]; } } - (void)moviePlayerLoadStateDidChange:(NSNotification *)notification { if ([moviePlayer loadState] == MPMovieLoadStateStalled) {
Do not forget to add the MediaPlayer.framework project to the project. This example assumes a play button in an xib file that has this: s touchUpInside event attached to playMovie IBAction.
source share