无需用户交互即可更改 iPhone 音量,这可能吗?

发布于 2024-08-16 12:36:08 字数 170 浏览 3 评论 0原文

我看过这个线程但这仅在我希望用户自己选择卷时才有用。我希望我的应用程序逐渐改变音量。

谢谢。

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

泡沫很甜 2024-08-23 12:36:08

你不能。 查看此帖子< /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.

坏尐絯 2024-08-23 12:36:08

如果您使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文