0

我正在尝试添加从服务器中提取的视频,并在我的应用程序中播放。

视频现在可以播放,但我没有任何用于音量的 UI 控件。全屏等

任何人都可以帮忙吗?这是我的代码

NSURL *url = [NSURL URLWithString:@"http://www.gzerodesign.com/sharksclips/video.mp4"];
    moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];

    // Register to receive a notification when the movie has finished playing.
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(moviePlayBackDidFinish:)
                                                 name:MPMoviePlayerPlaybackDidFinishNotification
                                               object:moviePlayer];

    if ([moviePlayer respondsToSelector:@selector(setFullscreen:animated:)]) {
        // Use the new 3.2 style API
        moviePlayer.controlStyle = MPMovieControlModeDefault;
        moviePlayer.shouldAutoplay = YES;
        [[moviePlayer view] setFrame:[[self view] bounds]];
        [self.view addSubview:moviePlayer.view];
        [moviePlayer setFullscreen:YES animated:YES];
        [moviePlayer play]; 
    } else {
        // Use the old 2.0 style API
        moviePlayer.movieControlMode = MPMovieControlModeHidden;
        [moviePlayer play];  
    }  
4

2 回答 2

1

我只体验过 New 3.2 风格的 API。

moviePlayer.controlStyle = MPMovieControlModeDefault;

注释掉

// moviePlayer.controlStyle = MPMovieControlModeDefault;

你可能有全屏按钮和跳过按钮。但不显示音量。

我没有尝试,但是,我搜索了这个。

MPMoviePlayerViewController 不显示音量滑块?

于 2013-01-31T01:49:01.687 回答
0

删除代码中的这一行:

moviePlayer.controlStyle = MPMovieControlModeDefault;

&还有这一行:

moviePlayer.movieControlMode = MPMovieControlModeHidden;

然后检查。

于 2013-01-31T02:50:32.937 回答