英文:
How to handle Voip calls in background in IOS
问题
我有一个 WebRTC 连接,在应用程序前台时运行正常,但当应用程序处于后台时,音频会断开。
我相信我漏掉了一些东西,因为在许多 VoIP 应用中它可以正常工作,而无需特殊权限。
我了解到可以安排一个后台任务,但我认为这是用来定期执行某些操作,而不是处理通话的。
英文:
I had a webrtc connection that's works fine when app is in foreground , but when app is in background the audio disconnect.
I believe i am missing something as it works in a lot of voip apps with no special permission
I read about schedule a background task but i think this is meant to execute something periodic ever x minutes , not to handle a call
答案1
得分: 1
您可能需要使用CallKit将通话信息传递给系统。
有一些包
试图解决这个问题,但您可能需要根据自己的需求进行调整,例如通过分叉或从它们的实现中获取一些灵感(也许这篇文章会有所帮助),如果这不符合您的用例。过去,我使用Flutter手动在Swift中实现了VoIP呼叫应用。
英文:
You may need to use CallKit to pass the call information to the system.
There are some packages
that try to deal with this issue, but you may need to adapt it to your own needs, e.g. by forking or getting some inspiration from their implementation (maybe this article will help) if that doesn't match your use case. In the past I implemented VoIP calling app with Flutter and I had to use CallKit manually in Swift.
答案2
得分: 0
你需要在后台保持连接的同时添加VoIP功能。请查看您应用程序配置中的“签名与能力”选项卡,选择“后台模式”,并启用“Voice over IP”。
话虽如此,我建议您通过CallKit探索完整的处理VoIP的文档。通常情况下,您会需要更多功能而不仅仅是启用后台模式。
英文:
You need to add an VoIP capability to maintain a connection in the background. See the Signing & Capabilities pane in you app configuration, select Background modes, and enable "Voice over IP."
That said, I recommend exploring the full documentation on handling VoIP via CallKit. You'll generally want more than just enabling a background mode.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论