0
votes

I'm trying to play a video using MPMoviePlayerController. On some iPads, the video plays, on other iPads it does not.

Here is the code:

NSURL *url = [NSURL fileURLWithPath:[self videoPath]];
self.moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:url];
self.moviePlayerController.view.frame = self.view.bounds;
self.moviePlayerController.repeatMode = MPMovieRepeatModeOne;
self.moviePlayerController.controlStyle = MPMovieControlStyleNone;
[self.moviePlayerController prepareToPlay];
... add to subview, play ...

MPMoviePlayerController lists the following compression restrictions:

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)

Originally, we were using H.264 at a higher resolution and the video worked with some our testers. Unfortunately, I was unable to get the video to play on my iPad (4th Generation). We kept the existing resolution and tried MPEG-4 Part 2 video but again, the video did not work. The only way we could get the video to work reliably was drastically reducing the resolution down to 480 x 640. The result looks horrible.

I added the notifications to monitor the load state and for the videos that failed to work, the modes would go from MPMovieLoadStateUnknown to MPMovieLoadStatePlayable back to MPMovieLoadStateUnknown. The videos that worked fine would go from MPMovieLoadStateUnknown to MPMovieLoadStatePlayable to MPMovieLoadStatePlayable|MPMovieLoadStatePlaythroughOK.

I checked the errorLogs and accessLogs and they were both empty.

Any thoughts on what I might check next in order to get the higher resolution video to work on the iPads?

1

1 Answers

0
votes

Okay, so Apple's MPMoviePlayerController documentation is a bit out of date. I referred to each iPad's technical specs and it revealed the source of the issue:

Video formats supported: H.264 video up to 1080p, 30 frames per second, High Profile level 4.1 with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; MPEG-4 video up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Simple Profile with AAC-LC audio up to 160 Kbps per channel, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; Motion JPEG (M-JPEG) up to 35 Mbps, 1280 by 720 pixels, 30 frames per second, audio in ulaw, PCM stereo audio in .avi file format

I was using videos at a higher resolution than 1080p using H.264 compression, and MPEG-4 higher than the supported resolution. Once we lowered the resolution everything worked perfectly.