문제

I'm silencing the iPhone ringer with AVSystemController, but I don't know how to determine the current level of the ringer. Any ideas?

PS Yes I know that using AVSystemController might get the app banned from the App Store. It's not an issue.

도움이 되었습니까?

해결책

You cannot change device volume programatically, however MPVolumeView (volume slider) is there to change device volume but only through user interaction, like making your own slider and labeling it 'volume' or something.

MPVolumeView is a control in toolbox, you need to add MediaPlayer.framework in your project then MPVolumeView will be displayed in toolbox in interface builder. MPVolumeView uses device volume, including ringing volume. AVAudioPlayer is only for application level volume.

Also, there is a little thing you can do:

  musicPlayer = [[MPMusicPlayerController iPodMusicPlayer];
  musicPlayer.volume = 1; // device volume will be changed to maximum value

Hope this helps.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top