IPhone (SDK 2.2): enhancing playback volume rather than actively playing music from AVFoundation?

So, I have an application that plays many short sound clips. I need to know when the sounds are finished, and I need to use mp3, so I use AVFoundation to play the sound.

When sound is actively playing and the user uses the hardware volume buttons, the playback volume changes. The problem is that the application does NOT constantly play sounds, and when not, and use the hardware buttons, the RINGER volume is adjusted instead.

How to configure it, if the application is running, the user can adjust the playback volume?

Thanks!

+4
source share
4 answers

It turns out that this can be achieved by allocating AVAudioPlayer with any valid sound file and calling the prepareToPlay method without calling the play method.

Works great.

+5
source

Launch AudioSession and do not stop it when you are not playing sounds.

+4
source

so that you can turn off the call playback volume while the application is running? why will hardware controls only tweak application playback sounds?

I don’t think it’s possible if you don’t “always play sound”, for example, many games always play background music or what you have.

+1
source

Perhaps you can do this by constantly reproducing sound in 0 volumes while your application is running. Then you can play sound clips.

+1
source

All Articles