0

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];
Nilesh Patel
  • 6,318
  • 1
  • 26
  • 40
prashant
  • 1,920
  • 14
  • 26

2 Answers2

1

you need to recompress the video as the current compression is incorrect:

  • H.264 Main Profile Level 4.0 video

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).

holex
  • 23,961
  • 7
  • 62
  • 76
0

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