MPMoviePlayer显示纯黑色屏幕

时间:2013-01-17 12:28:03

标签: iphone objective-c ios6 media-player

我目前正在开发一款需要播放视频的应用。一切都很好。但是如果我的应用程序被发送到后台然后再次发送到前台,它会显示一个黑色的固定屏幕。

请为我提供解决此问题的方法。

    [player.view setFrame:CGRectMake(0, 0, 480, 278)];
    [player.view setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
    outputURL = [NSURL fileURLWithPath:filePath];
    [player setContentURL:outputURL];
    [player setShouldAutoplay:NO];
    player.repeatMode = MPMovieRepeatModeNone;
    player.controlStyle =  MPMovieControlStyleNone ;

    player.scalingMode = MPMovieScalingModeAspectFit;

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinish) name:MPMoviePlayerPlaybackDidFinishNotification object:player];
    [player prepareToPlay];
    [player pause];
    [self.view addSubview: player.view];

1 个答案:

答案 0 :(得分:0)

看看这个解决方案 For MPMoviePlayer