iphone开发 如何用代码设置视频播放器的音量

NSURL *videoURL = [NSURL fileURLWithPath:selectedQuestion.GraphicsUrl];
[[NSNotificationCenter defaultCenter] addObserver:self 
                                      selector:@selector(moviePlayBackDidFinish:)
                                      name:MPMoviePlayerPlaybackDidFinishNotification object:nil];


// Register to receive a notification that the movie is now in memory and ready to play
[[NSNotificationCenter defaultCenter] addObserver:self 
                                      selector:@selector(moviePreloadDidFinish:)
                                      name:MPMoviePlayerLoadStateDidChangeNotification object:nil];


videoPlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:videoURL];


[[MPMusicPlayerController applicationMusicPlayer] setVolume:1.0];


MPMoviePlayerController *moviePlayer = [videoPlayer moviePlayer];
[moviePlayer prepareToPlay];
[moviePlayer play];


videoPlayer.view.frame = imgQuestion.frame;

[videoView addSubview:videoPlayer.view];

注意:这个方法在真机上测试没有问题,但是在模拟器上不能成功。

你可能感兴趣的:(object,测试,iPhone)