硬件音量按钮更改应用程序音量 [英] Hardware Volume buttons change in app volume

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

问题描述

因此,在我的应用程序中,我想通过使用硬件按钮来更改应用程序内的音量级别以进行警报,但每当我使用按钮调高或调低音量时,它只会改变铃声"音量不影响我的应用内音量.

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.

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

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