Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

turn off device volume - iOS [duplicate]

Possible Duplicate:
Mute/Silence an iOS device programmatically?

I need to turn off the device volume programmatically. Does anyone know a way?

So far I have discovered, that maybe i can use AudioSessionSetProperty() function, and use the property "kAudioSessionProperty_CurrentHardwareOutputVolume", but this property is only read only. SO i am not sure if this will work:

float value = 0.0f;
AudioSessionSetProperty(kAudioSessionProperty_CurrentHardwareOutputVolume, sizeof(float), &value);

There are already apps in the App-Store that does this, e.g. AutoSilent:

http://itunes.apple.com/nl/app/autosilent/id474777148?mt=8

like image 420
revolutionary Avatar asked Oct 23 '22 18:10

revolutionary


1 Answers

You can't do this with iOS. The only way to mute an iOS device is by using the hardware switch. You can detect it and mute your app accordingly, but can't mute the entire device from your app.

like image 104
Adam Avatar answered Nov 04 '22 21:11

Adam