ios 在录制过程中按下主页按钮时,红色横幅突然出现并消失

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13339078/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 21:10:23  来源:igfitidea点击:

Red banner comes and disappear suddenly when press home button during recording on going

iphoneios

提问by Hardik Darji

I face one issue during recording is on going, if i press home button, i noticed " Red banner comes and disappear suddenly" and AVAudioRecorder can not create file properly. Please help what is this ?. is it something like network connectivity related ?

我在录制过程中遇到一个问题,如果我按下主页按钮,我注意到“红色横幅突然出现并消失”并且 AVAudioRecorder 无法正确创建文件。请帮忙这是什么?. 它与网络连接有关吗?

Red banner comes and disappear suddenly when press home button during recording on going

在录制过程中按下主页按钮时,红色横幅突然出现并消失

Please help.

请帮忙。

采纳答案by CodaFi

The "red banner" indicates that your application is currently using the microphone hardware. It is shown by applications that have active control over the main recording context, and hides when your application releases it's hold on the recording context (such as when the home button is pressed). Because you cannot predict when the home button will be pressed to exit your application, you will need to either support background recording to persist the banner (then gracefully release your context after a second or two to have the status bar animate back to black), or somehow terminate your context before the application closes.

“红色横幅”表示您的应用程序当前正在使用麦克风硬件。它由对主记录上下文具有主动控制权的应用程序显示,并在您的应用程序释放它对记录上下文的保持时隐藏(例如按下主页按钮时)。因为您无法预测何时按下主页按钮以退出您的应用程序,您将需要支持后台录制以保留横幅(然后在一两秒后优雅地释放您的上下文以使状态栏动画恢复为黑色),或者在应用程序关闭之前以某种方式终止您的上下文。