我最近下载了一个应用程序,它使用音量 -"按钮切换值,并使用音量 +"按钮开始/停止视频录制.该应用名为 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 使用音量按钮作为输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!