iphone - MPMoviePlayerController - How can I decrease volume of the video programmatically

ぐ巨炮叔叔 提交于 2019-12-09 22:15:22

问题


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];


来源:https://stackoverflow.com/questions/3870465/iphone-mpmovieplayercontroller-how-can-i-decrease-volume-of-the-video-progra

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!