Reputation: 1920
https://dl.dropboxusercontent.com/u/52719649/69090d547c8d47dd27b6d271649c59ae.mp4
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"SampleVideo.mp4"];
NSURL *url = [NSURL fileURLWithPath:path];
self.controller = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
[self.controller.moviePlayer setControlStyle:MPMovieControlStyleDefault];
[self presentMoviePlayerViewControllerAnimated:self.controller];
[self.controller.moviePlayer play];
Upvotes: 0
Views: 577
Reputation: 24041
you need to recompress the video as the current compression is incorrect:
here is a guidance form Apple:
- H.264 Baseline Profile Level 3.0 video, up to 640 x 480 at 30 fps. (The Baseline profile does not support B frames.)
- MPEG-4 Part 2 video (Simple Profile)
the audio might need to be changed according to:
(...) this class supports AAC-LC audio at up to 48 kHz, and MP3 (MPEG-1 Audio Layer 3) up to 48 kHz, stereo audio.
for MPMoviePlayerController
(Class Reference in Apple's Documentation).
Upvotes: 1
Reputation:
You should use AVPlayer
and AVPlayerViewController
instead. Follow this simple guide in order to play videos natively in your app:
http://www.techotopia.com/index.php/IOS_8_Video_Playback_using_AVPlayer_and_AVPlayerViewController
Upvotes: 0