0

MPMoviePlayerController 有问题,因为当我以全屏模式启动它时,它存在,但歌曲仍在播放。我添加了 MPMoviePlayerDidExitFullscreenNotification 通知,它说当视频开始播放时它存在全屏。这是我的代码:

_multimediaPlayer = [[MPMoviePlayerController alloc] init];
_multimediaPlayer.controlStyle = MPMovieControlStyleDefault;
_multimediaPlayer.initialPlaybackTime = 0;

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(videoPlayBackDidFinish:) 
                                                 name:MPMoviePlayerPlaybackDidFinishNotification 
                                               object:nil];

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(videoPlayerDidExitFullscreen:) 
                                                 name:MPMoviePlayerDidExitFullscreenNotification
                                               object:nil];

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(videoPlayerPlaybackStateChanged:) 
                                                 name:MPMoviePlayerPlaybackStateDidChangeNotification
                                               object:nil];

    NSString *path = [NSString stringWithFormat:@"%@/mag_%d/%@", [FMUtils documentsFolderPathWithFile:nil], _magID, _pageObject.fileName];
    if ([FMUtils fileExistsAtPath:path]) {
        _multimediaPlayer.contentURL = [NSURL fileURLWithPath:path];
    } else {
        _multimediaPlayer.contentURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", self.dataURL, _pageObject.fileName]];
    }

    CGSize objectViewSize = self.frame.size;
    _multimediaPlayer.view.frame = CGRectMake(0, 0, objectViewSize.width, objectViewSize.height);
    [self addSubview:_multimediaPlayer.view];

    if (_pageObject.blink)  {
        [_multimediaPlayer setFullscreen:YES animated:YES];
    }

    [_multimediaPlayer play];

大多数情况下,它发生在视频未下载并且需要流式传输时。

你知道为什么会这样吗?

4

1 回答 1

0

当我不听 MPMoviePlayerPlaybackStateDidChangeNotification 时问题已解决。

于 2010-05-19T08:28:42.397 回答