关于在MPMoviePlayerViewController中播放mov文件的iOS7问题 [英] iOS7 issue on Playing mov file in MPMoviePlayerViewController

查看:183
本文介绍了关于在MPMoviePlayerViewController中播放mov文件的iOS7问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够在ios 6.1.3及更低版本中使用以下编码播放.mov文件,但在iOS7中它会自动关闭。

I was able to play .mov file using following coding in ios 6.1.3 and below but in iOS7 it closed automatically.

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];

}

使用上面的编码,我可以播放.mp4文件iOS7和所有。 apple是否限制了mov文件?

Using above coding I can able to play .mp4 file in iOS7 and all. Does apple restricted mov files?

推荐答案

我可能遇到与您相同的问题。如果查看日志,会出现以下错误:

I may be having the same issue as you. If you look at your logs, do you get the following error:

_itemFailedToPlayToEnd: { 
    kind = 1; 
    new = 2; 
    old = 0;
}

我唯一的另一个想法是使用新的类,如AVPlayer或甚至是第三方派对来播放我的媒体。我没有看到代码和代码中的任何设置不正确。它与iOS 7有关。

The only other idea I have is to use a new class such as AVPlayer or even a third party class to play my media. I don't see any settings that are incorrect in your code nor my code. It is iOS 7 related though.

这篇关于关于在MPMoviePlayerViewController中播放mov文件的iOS7问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆