关闭设备音量 - iOS设备 [英] turn off device volume - iOS

查看:180
本文介绍了关闭设备音量 - iOS设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
  <一href=\"http://stackoverflow.com/questions/10371312/mute-silence-an-ios-device-programmatically\">Mute/Silence iOS设备编程?

我需要以编程方式关闭设备音量。有谁知道的方式?

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

到目前为止,我已经发现,也许我可以使用AudioSessionSetProperty()函数,并使用属性kAudioSessionProperty_CurrentHardwareOutputVolume
但此属性仅只读的。所以我不知道这是否会工作:

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);

有应用程式已经在App商店做这个,例如AutoSilent:

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

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

推荐答案

您无法与iOS做到这一点。静音iOS设备的唯一方法是通过硬件开关。可以detect它并据此静音您的应用程序,但不能从您的应用程序静音整个设备。

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.

这篇关于关闭设备音量 - iOS设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆