Pregunta

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.

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top