硬件音量按钮会更改应用程序音量

硬件音量按钮会更改应用程序音量

本文介绍了硬件音量按钮会更改应用程序音量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以在我的应用程序,我想通过使用硬件按钮更改应用程序音量报警,但每当我使用按钮来打开或关闭音量,它只改变铃声音量不影响我的应用程序音量。

So in my app i would like to change the in app volume leves for an alarm by the use of the hardware buttons but whenever i use the buttons to turn up or down the volume it ONLY changes the "ringer" volume wich does NOT effect my in app volume.

在设置 - >声音下,更改按钮开关是开的,一切正常,如果我关闭它,但大多数用户也想要打开。所以当我在我的应用程序,我想要音量按钮更改应用程序音量而不是铃声音量。

Under Settings -> Sounds the "change with buttons" switch is ON and everything works fine if i turn it off but most users will want to have it on as well. So when im in my app i want the volume buttons to change the app volume not the ringer volume.

希望它有意义

感谢

推荐答案

默认情况下,硬件按钮会更改闹钟音量,除非您有一个打开的音频会话使用按钮。我建议打开一个AVAudioSession让他们改变它,或者在你的应用程序中放置一个卷滑块,让他们改变音量。

By default the hardware buttons will change the alarm volume unless you have an open audio session when they use the buttons. I would recommend opening an AVAudioSession to have them change it or placing a volume slider somewhere in your app to have them change the volume.

这是一个很难解决的问题因为用户没有被告知什么是错误,很多时候看不到看到的铃声音量是什么正在改变。

This is a difficult problem to solve perfectly because users aren't told what is wrong and many times don't look to see that the ringer volume is what is being changed.

这篇关于硬件音量按钮会更改应用程序音量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-16 05:21