iOS use the volume buttons as input(iOS 使用音量按钮作为输入)
问题描述
我最近下载了一个应用程序,它使用音量 -"按钮切换值,并使用音量 +"按钮开始/停止视频录制.该应用名为 SloPro,可在应用商店中找到.我认为不允许修改 iPhone 硬件的行为.关于如何做到这一点的任何想法?
I've recently downloaded an app that uses the 'Volume -' button to toggle a value, and it uses the 'Volume +' button to start/stop recording of video. The app is called SloPro, and can be found in the app store. I thought it wasn't allowed to modify the behaviour of the iPhone's hardware. Any ideas on how this is done?
推荐答案
参见Audio Session Services References 了解更多详细信息,但基本上您使用 AudioSessionInitialize
开始一个音频会话.然后使用 AudioSessionSetActive
使其处于活动状态.然后使用 AudioSessionAddPropertyListener
监听音量的变化,您可以在其中传递类型为 AudioSessionPropertyListener
的回调.
See the Audio Session Services References for more details, but basically you start an audio session with AudioSessionInitialize
. Then you make it active with AudioSessionSetActive
. Then listen for changes in the volume with AudioSessionAddPropertyListener
where you can pass a callback that has type AudioSessionPropertyListener
.
查看以下网站以获取示例:http://fredandrandall.com/blog/2011/11/18/taking-control-of-the-volume-buttons-on-ios-like-camera/
Check the following website out for an example: http://fredandrandall.com/blog/2011/11/18/taking-control-of-the-volume-buttons-on-ios-like-camera/
这篇关于iOS 使用音量按钮作为输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:iOS 使用音量按钮作为输入


- Android - 拆分 Drawable 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01