iphone - MPMoviePlayerController - How can I decre

2020-07-24 04:11发布

问题:

I'm using MPMoviePlayerController to play a video which has audio as well. It's working fine. I'm hiding the default controls. So no controls are showing on the video. I want to place a slider on the video (I successfully placed a slider as well over the video). With the slider, I want to control the volume of the video that is being played. How can I control volume of video?

回答1:

See the documentation for MPVolumeView. Here is a sample code that I use in my view controller.

MPVolumeView *systemVolumeSlider =
    [[MPVolumeView alloc] initWithFrame: CGRectMake(10, 10, 200, 40)];
[self.view addSubview: systemVolumeSlider];
[systemVolumeSlider release];