Reputation: 31
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.
Upvotes: 3
Views: 499
Reputation: 29896
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.
Upvotes: 1
Reputation: 5602
As i understand you want to control the volume separately in the App without affecting Device volume. It sounds difficult & i don't think its achievable.
There is an option you can try out here i have explained:
Important Note:
EDIT:
If you want to make App volume as it is while pressing device volume button. You can try out this steps. It looks not tested but might work.
I hope it will help you.
Upvotes: 0