iOS 使用音量按钮作为输入

iOS use the volume buttons as input(iOS 使用音量按钮作为输入)
本文介绍了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 使用音量按钮作为输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Pushing UIViewController above UITabBar(将UIView控制器推送到UITabBar上方)
java.lang.IllegalStateException: SimpleTypeImpl should not be created for error type(异常:不应为错误类型创建SimpleTypeImpl)
Android IllegalArgumentException: The tag for fragment_XXX is invalid. Received: layout-sw600dp/fragment_XXX_0(Android IlLegalArgumentException:Fragment_XXX的标签无效。收到:Layout-sw600dp/Fragment_XXX_0)
iOS convert audio sample rate from 16 kHz to 8 kHz(IOS将音频采样率从16 kHz转换为8 kHz)
Enforcing an audio sampling rate in iOS(在iOS中强制音频采样率)
HTTPS request using volley(使用 volley 的 HTTPS 请求)