我能够在 ios 6.1.3 及更低版本中使用以下编码播放 .mov 文件,但在 iOS7 中它会自动关闭。
MPMoviePlayerViewController *mp1 = [[ MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:url]];
if (mp1)
{
self.moviePlayer= mp1;
[mp1 release];
self.moviePlayer.view.userInteractionEnabled=YES;
self.moviePlayer.moviePlayer.repeatMode = MPMovieRepeatModeOne;
self.moviePlayer.view.frame = CGRectMake(0, 0, 320, 460);
[self.moviePlayer.moviePlayer setScalingMode:MPMovieScalingModeAspectFit];
self.moviePlayer.moviePlayer.controlStyle = MPMovieControlStyleDefault;
//Register for the playback finished notification.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(myMovieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:self.moviePlayer.moviePlayer];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myMovieFinishedCallback:) name:MPMoviePlayerDidExitFullscreenNotification object:self.moviePlayer.moviePlayer];
//setup device rotation notification observer
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(didRotate:)
name:UIDeviceOrientationDidChangeNotification
object:nil];
[self.masterVC presentMoviePlayerViewControllerAnimated:moviePlayer];
[self.moviePlayer.moviePlayer prepareToPlay];
[self.moviePlayer.moviePlayer play];
[self.moviePlayer.moviePlayer setFullscreen:TRUE];
}
使用上面的编码,我可以在 iOS7 中播放 .mp4 文件。苹果是否限制 mov 文件?