处理录音期间警报造成的中断

发布于 2024-10-08 23:14:58 字数 516 浏览 4 评论 0原文

我正在开发一个录音应用程序,其中可能会被电话、短信和/或系统警报中断。至于电话,我意识到必须停止录音,并且已经成功解决了这个问题。我的挑战似乎是其他警报,例如电池电量低状态、警报、短信等。目前,我已经设法在警报中断弹出时立即暂停并保存录音,但我正在寻找更有效的选择。

在大多数使用临时分发模式的现实场景中,我注意到我的用户在录制声音时甚至不会监视 iPhone 或 iPod 屏幕。此外,如果我们在 iPod Touch 上测试此应用程序,则警报的声音非常微弱,他们会错过警报并继续录制,直到几分钟后或可能在会话结束时才意识到录制的内容被打断了。

我的问题是:

  1. 如果出现任何系统警报或短信警报,是否可以在后台继续录音?
  2. 如果没有,是否可以让应用程序在后台播放特定的声音,该声音将继续播放,直到用户意识到出现问题,查看屏幕,如果他们消除系统警报,那么应用程序就会出现到前台,因此停止音频警报,因为应用程序现已获得焦点,然后可以选择从中断处继续录制。

任何帮助将不胜感激。任何其他处理这种情况的想法都是最受欢迎的。

I am working on a voice recording app wherein there could be interruption by phone calls, text messages, and/or system alerts. As for phone calls, I realize the recording has to be stopped and have worked this out successfully. My challenge seems to be with other alerts such as low-battery status, alarms, text messages, etc. For now, I have managed to pause and save recording as soon as an alert interrupt pops up, but am looking at more efficient options.

In most real-world scenarios on ad-hoc distribution mode, I notice that my users do not even monitor the iPhone or iPod screen when recording their voices. Also, in case we test this app on the iPod Touch, then the sounds for the alerts are pretty feeble and they miss out on the alerts and continue recording only to realize after a few minutes or maybe at the end of the session that the recording was interrupted.

Here are my questions:

  1. Is it possible to continue recording voice in the background in the event of any system alerts or text message alerts popping up?
  2. If not, would it be possible to make the app play a particular sound in the background that would continue to play until the user realizes something is wrong, looks into the screen, and if they dismiss the system alert then it would make the app come to the foreground and so stop the audio alert as the app has now gained focus, then can choose to continue recording from where they left off.

Any help would be greatly appreciated. Any other idea to handle this situation is most welcome.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

月亮是我掰弯的 2024-10-15 23:14:58

您可以尝试实现应用程序委托方法

-(void)applicationWillResignActive:(UIApplication *)application{
    [recorder playSound];
    [recorder pause];
}

-(void)applicationDidBecomeActive:(UIApplication *)application{
    [recorder record];
}

将这些方法放入 appDelegate 类中。

如果您想实现自己的警报,请在应用程序WIllResignActive中执行此操作,但我不确定您是否应该这样做,因为所有警报(如短信、推送通知或电池警告)都会触发振动和声音。

You could try to implement application delegate methods

-(void)applicationWillResignActive:(UIApplication *)application{
    [recorder playSound];
    [recorder pause];
}

-(void)applicationDidBecomeActive:(UIApplication *)application{
    [recorder record];
}

Put those methods in the appDelegate class.

If you want to implement your own alert do it in the applicationWIllResignActive, but I am not sure if you should do it, cause all the alerts like SMS, push notifications or battery warning trigger vibrations and sounds.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文