I have an app running on iOS 5.1 built with Xcode 4.31 that plays *.mov files just fine using the standard mpmovieplayercontroller. But when I try to use a .m4v or .mp4 version of the video, they do not get bundled. If I delete the app from the test device (an iPad or the iPad simulator) I can see the .mov get copied over during the build and deploy, but the ne .m4v or .mp4 versions do not get copied over.

I added some debugging code which seems to confirm that the m4v or mp4 media is not present in the app:

if (moviePath) {
    theMovieURL = [NSURL fileURLWithPath:moviePath];
    NSLog(@"theMovieURL: %@", theMovieURL);
}else {
     NSLog(@" there is no theMovieURL");
    return;
}

and it does print out the log message in the else block when I try to use m4v or mp4. I've tried completely different test videos and get the same result every time. Any .mov video works fine, no m4v or mp4 files work at all. The app needs to include a rather large video, so I want to use an optimized version - H.264 vids in mp4 or m4v seem to be less than half the file size, so just using a .mov version is not an option.

Thanks for any insight you can provide.

Edit/update: I looked in my Library/.../[Simulator].../[App name].app directory and found *.mov files and no *.m4v or *.mp4 files.

有帮助吗?

解决方案

Apple's *.mov file format is a container format. You can save your *.mp4 or *.m4v files as a *.mov, as it essentially just "wraps around" the source *.mp4 or *.m4v and barely affects file size.

EDIT:
Also, many *.mp4 files can simply be renamed to *.mov and still play just fine.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top