I have been able to decrease the volume of Ringer by using AVSystemController's setVolume method. However, it doesn't mute the device, there is still 5% volume left. I might need to control the Silent switch but didn't find anything about it.
Please note I don't want answers like The app will be rejected by Apple as I do not intend it to upload.
It is technically possible to change the system volume through the private AVSystemController class in Celestial.framework
Get Framework from here.
Related
i have to play a sound when an uibutton is clicked. My problem is that when device is with volume down, so user pull down volume in hw way, my sound will have volume down. Is there a possibility to have my sound with max volume though volume is down? I hope my answer is well formed
Whether this is possible or not, it would be a very bad practice. Apps should always respect user's choice, including volume. Think of a user that's using your app in a very quite environment (e.g. hospital, airplane, etc.), so the user turns the volume down - yet your app still makes loud noises. I'm guessing this would rather alienate the user.
My guess is that normally it's not possible though. Have a look at this article: http://developer.apple.com/library/ios/#codinghowtos/AudioAndVideo/_index.html - specifically, look for How do I control playback level? topic.
On iOS you can configure the audio session parameters but there are behaviours that the system will not let you change (when the user receives a call or silences the device for example). The system will send you notifications so you can react gracefully but as others have said, when users silence their device it should be silent, no matter what the developpers want (especially with tons of apps running in the background...).
I have a universal app that uses a combination of SystemSounds and AVAudioPlayer sounds. Everything works fine on all of my devices. However, I've had a couple reports from users that the system sounds play at what seems to be the device's full volume level regardless of the actual volume level set for the device. In other words, pressing the hardware buttons on the side of the device changes the AVAudioPlayer sounds, but the system sounds remain at full volume at all times.
Here's the info I've been able to gather so far:
One of the users' devices is an iPod touch 4th generation and the other is an iPad 2. I don't have access to that iPod model, but I did test with an iPad 2 with no problems. I haven't had reports from iPhone users, so I don't think it's an issue of confusion between the music volume and ringer volume, because these devices don't have a ringer.
I've asked the users to fully quit the app using the task manager, and also to restart their devices, but the problem remained after both of these steps.
I'm initializing an audio session with the MediaPlayback category and with MixWithOthers enabled, to control the AVAudioPlayer sounds. I have another that only uses system sounds and doesn't initialize an audio session, so I asked one of the users to try that app. He reported that the sounds are stuck at full volume with that app, too.
Can anyone suggest why this might be happening? Or is there any further troubleshooting I should ask these users to do, since I can't repeat the problem myself?
Update: Perhaps I could ask users to compare the volume behavior in my apps to the volume in a default Apple app or a simple, free app they could install -- does anyone know of an app that uses system sounds? Then I could at least tell if the problem is specific to my app or general to the device.
"Let me amend something here as I just discovered a new setting that FIXES this problem. Go to settings > sounds > "change with buttons". Turn it on. Problem solved!" # https://discussions.apple.com/thread/2790023?threadID=2790023 ??
The app FoneHome is able to do both:
ignore the ringer switch when it's set to silence
play at a high volume regardless of system volume setting
I see documentation about the playback Audio Session category not respecting the ringer switch but not the volume. Can someone enlighten me?
It is technically possible to change the system volume through the private AVSystemController class in Celestial.framework, but causes problems with Apple's approval process. FoneHome recently was taken down - its possible that the back and forth between them and Apple was because of this reason.
I've seen this thread but this is only useful if I wanted the user to pick the volume himself. I wanted my application to change the volume gradually.
Thanks.
You can't. See this thread
You have to remember that the iPhone is designed as phone first and a computer second. Since phones are emergency communication devices whose functioning can literally be a matter of life and death, any programing functionality that might interfere with phone function is restricted. If a program could override the hardware volume settings it could cause a user to miss a critical call with possibly disastrous consequences. No app needs volume control more than users need their phone.
You can always adjust the output of your app's own sound. The AVAudioPlayer for example has a volume setting. You just can't control the volume of the hardware and other apps.
If you are using AVAudioPlayer to play your sounds, you can just set the volume property.
If you are using AudioServicesPlaySystemSound, then you cant.
I've seen techniques to make sure that an app respects the mute switch, but is it possible to set the iPhone to mute (no sounds from any apps) using the SDK?
No.
Applications developed using the official SDK cannot change (and in most cases cannot even access) system-wide settings.
It is possible, but only using private API's. I only went as far as muting the ringer, but you should be able to control the master level as well.
See How to disable iOS System Sounds
It is technically possible to change the system volume through the private AVSystemController class in Celestial.framework, but will prevent your app from getting Apple's approval
As only one app can be running at a time, the only possible use I can think of for this would be to mute other people's apps, and it should be fairly clear why Apple prevents that.
What would I do if an app muted the iPhone and I didn't know it happened? It can't physically move the mute switch on the side of the phone, so that wouldn't match, and I'd have to figure out a) that the phone was muted and b) how to unmute it without the switch.
I can change volume using AVSystemController, it sets to minimum which is 0.06x. Is there class/API to mute it completely? toggleActiveCategoryMuted does not work