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

2024-08-12移动开发问题
10

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

问题描述

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

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.

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

The End

相关推荐

硬件音量按钮更改应用程序音量
Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)...
2024-08-12 移动开发问题
10

Cocos2d - 如何检查不同层中对象之间的交集
Cocos2d - How to check for Intersection between objects in different layers(Cocos2d - 如何检查不同层中对象之间的交集)...
2024-08-12 移动开发问题
8

恢复游戏 cocos2d
Resume game cocos2d(恢复游戏 cocos2d)...
2024-08-12 移动开发问题
6

突出显示朗读文本(在 iPhone 的故事书类型应用程序中)
Highlight Read-Along Text (in a storybook type app for iPhone)(突出显示朗读文本(在 iPhone 的故事书类型应用程序中))...
2024-08-12 移动开发问题
9

Cocos2D + 仅禁用 Retina iPad 图形
Cocos2D + Disabling only Retina iPad Graphics(Cocos2D + 仅禁用 Retina iPad 图形)...
2024-08-12 移动开发问题
10

如何将 32 位 PNG 转换为 RGB565?
How to convert 32 bit PNG to RGB565?(如何将 32 位 PNG 转换为 RGB565?)...
2024-08-12 移动开发问题
21