Setting the AVAudioPlayer volume to the user's ringer volume?

I have a problem with the AVAudioPlayer volume.

I can set theAudio.volume property to 1.0, but I would prefer to just play the sound on the one on which the user set his iphone call.

How to get rid of the volume property by default, it is 1.0.

This seems trivial, but I just could not find a link to it.

Thanks a bunch!

+3
source share
2 answers

The volume that you set for the AVAudioPlayer instance is only a relative volume, for example, if you want to play two sounds, one at half the volume of the other, you set the first one to 0.5, and the second to 1.0.

. ( - ?)

MPVolumeView , .

+4

,

AudioSessionAddPropertyListener(kAudioSessionProperty_CurrentHardwareOutputVolume, audioVolumeChangeListenerCallback, self);

- , , API-. . , !

+1

Source: https://habr.com/ru/post/1704251/


All Articles