视频通话不便。集市。最好的解决方案?
Posted
技术标签:
【中文标题】视频通话不便。集市。最好的解决方案?【英文标题】:inconvenience with video call. Agora.io. the best solution? 【发布时间】:2018-08-06 20:02:42 【问题描述】:应该如何通知客户端 master 离线。以及如何集成类似于 Whatsapp 的视频通话 UI。谁能提出最佳解决方案?
【问题讨论】:
【参考方案1】:这将成为您应用逻辑的一部分。有几种方法可以实现这一点,但一种方法是查看特定用户是否在前台运行应用程序并将其作为标志记录在数据库中。
例如这里使用的是 Firebase:
func applicationWillResignActive(_ application: UIApplication)
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
// user is offline
let ref = Database.database().reference.child("isOnline").child(user)
ref.setValue(false) // NO
func applicationDidBecomeActive(_ application: UIApplication)
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
let ref = Database.database().reference.child("isOnline").child(user)
ref.setValue(true) // YES
对于视频通话 UI,您实际上可以使用 Agora.io demo apps 中包含的 UI 之一轻松自定义它
【讨论】:
以上是关于视频通话不便。集市。最好的解决方案?的主要内容,如果未能解决你的问题,请参考以下文章