无需用户交互即可更改 iPhone 音量,这可能吗?
我看过这个线程但这仅在我希望用户自己选择卷时才有用。我希望我的应用程序逐渐改变音量。
谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你不能。 查看此帖子< /a>
你必须记住,iPhone 首先被设计为手机,其次才是电脑。由于电话是紧急通信设备,其功能实际上关系到生死,因此任何可能干扰电话功能的编程功能都会受到限制。如果程序可以覆盖硬件音量设置,则可能会导致用户错过关键呼叫,从而可能造成灾难性后果。没有任何应用程序比用户对手机更需要音量控制。
您始终可以调整应用程序自身声音的输出。例如,
AVAudioPlayer
具有音量设置。您只是无法控制硬件和其他应用程序的音量。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.如果您使用 AVAudioPlayer 要播放声音,您只需设置音量属性即可。
如果您使用 AudioServicesPlaySystemSound,那么你就不能。
If you are using AVAudioPlayer to play your sounds, you can just set the volume property.
If you are using AudioServicesPlaySystemSound, then you cant.