iOS使用音量按钮作为输入 [英] iOS use the volume buttons as input

查看:119
本文介绍了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?

推荐答案

参见音频会话服务参考了解更多详情,但基本上你使用 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使用音量按钮作为输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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