Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Divert iPhone's volume control to app when app is running

I am using AVSpeechSynthesizer to convert text to speech in my app. This app reads the text after certain intervals.

Whenever the app is speaking, if I press the device's volume buttons, it changes the volume of the current speech as well as the media volume of the device. (i.e. if any music is playing and AVSpeechSynthesizer starts speaking, music pauses and it resumes as soon the speech is over. So meanwhile if I change the volume, it gets applied to the music player's volume also.)

So is it possible force the volume control buttons to change the app volume alone when app is running?

PS. The app is for iOS 8.0+.

Any help would be appreciated.

Thanks.

like image 935
Preety Avatar asked Dec 01 '25 00:12

Preety


1 Answers

No, you cannot intercept the hardware volume and adjust only your app volume, it's not designed for that. The OS would then need to track all volumes per apps, and e.g. what if you had AudioBus running with multiple app audio streams chained together.

You need to rethink your problem. To control your app's volume, add a volume control to the UI.

like image 118
some_id Avatar answered Dec 02 '25 15:12

some_id



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!