MPMovieplayercontroller在流式传输时自动暂停,不再播放

时间:2015-11-30 10:43:48

标签: ios mpmovieplayercontroller

我正在使用MPMoviePlayerController来播放URL的视频。以下是我的代码:

NSString* url = [[promotionalDetailResponse objectAtIndex:index] valueForKey:@"Url"];

        NSURL *streamURL = [NSURL URLWithString:url];
        mPlayerVC = [[MPMoviePlayerViewController alloc] initWithContentURL:streamURL];
        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(moviePlaybackComplete:)
                                                     name:MPMoviePlayerPlaybackStateDidChangeNotification
                                                   object:nil];

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


        mPlayerVC.moviePlayer.fullscreen=YES;
        mPlayerVC.moviePlayer.shouldAutoplay=YES;
        [self presentMoviePlayerViewControllerAnimated:mPlayerVC];

流式传输时暂停,不会自动播放。我必须手动播放。但是,一旦完成流式传输,它应该会自动开始播放。

1 个答案:

答案 0 :(得分:1)

您应该提及源类型如下:

{{1}}