iOS后台录音

标签 ios objective-c bluetooth background avfoundation

我知道如果我在前台开始录音 session ,在功能 -> 背景模式中激活音频、Airplay 和画中画;我什至可以在后台继续录制,但前提是我在前台开始录制 session 然后进入后台。

我的问题是我想从后台开始录音 session ,这可能看起来不太好,而不是 Apple 想要的,但用例是这样的:

我有一个带按钮的低功耗蓝牙设备和一个 iOS 应用程序。这两个是配对的(蓝牙 LE 设备和运行 iOS 应用程序的 iPhone)并且 iOS 应用程序正在监听蓝牙 LE 设备上的事件,例如按下按钮的事件。

现在,当用户点击蓝牙 LE 设备上的按钮时,iOS 应用程序会捕获事件,即使应用程序处于后台,我也可以运行代码,但我无法开始录音。

我的问题是:这可能吗?要从后台开始录音?即使我们在这里有用户交互,不是在 iOS 应用程序上,而是在蓝牙 LE 上,所以它不像录音在后台开始,用户没有意识到,他按下了蓝牙 LE 设备上的按钮,他知道他在做什么。

Apple 工程师的任何帮助、文档、推文,任何东西都将不胜感激。谢谢。

更新:MFI 不是必需的。 https://mfi.apple.com/MFiWeb/getFAQ.action#1-2 .

如果您查看该部分:

“哪些类型的配件和技术不属于 MFi 计划的一部分?”

你会看到:

“仅使用低功耗蓝牙 (BTLE) 的配件(注意:支持 BTLE 的 HomeKit 配件和支持 BTLE 的 MFi 助听器是 MFi 计划的一部分)”

被提及,这意味着 MFI 在这种情况下不是必需的

最佳答案

From Apple Documentation

An app that plays or records audio continuously (even while the app is running in the background) can register to perform those tasks in the background. You enable audio support from the Background modes section of the Capabilities tab in your Xcode project. (You can also enable this support by including the UIBackgroundModes key with the audio value in your app’s Info.plist file.) Apps that play audio content in the background must play audible content and not silence.

Typical examples of background audio apps include:

Music player apps Audio recording apps Apps that support audio or video playback over AirPlay VoIP apps

For tasks that require more execution time to implement, you must request specific permissions to run them in the background without their being suspended. In iOS, only specific app types are allowed to run in the background:

  • Apps that record audio content while in the background

编辑:

还有关于您的“蓝牙设备”:

查看 ExternalAccessory 的文档.

请注意,您需要申请并获得 special developer program 的批准。为了能够创建外部配件。

关于iOS后台录音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42020124/

相关文章:

objective-c - Objective-C编译器错误

c++ - 通过系统虚拟串口向蓝牙发送字节

ios - 附近使用 Swift 3.0 的蓝牙设备

android - 在 iOS 和 Android 上将(非交互式)动画(使用 Maya 制作)加载到 OpenGL ES 的推荐方法

当前位置的 iPhone 蜂窝三角测量

ios - 显示启动画面时 UIStatusBar 颜色变为白色

ios - 如何在 iOS 中创建流体图形动画

iphone - UIBarButtonItem外观iOS5字体

ios - Ellisys蓝牙嗅探Apple Airpods

android - 如何拦截蓝牙耳机的通话按钮?