视频通话带来的不便.Agora.io.最好的解决方案是什么



如何通知客户端主机脱机。以及如何集成类似Whatsapp的视频通话UI。有人能提出最好的解决方案吗?

这将是应用程序逻辑的一部分。有几种方法可以实现这一点,但有一种方法是查看特定用户是否在前台运行应用程序,并将其作为标志记录在数据库中。

例如,这里使用的是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演示应用中包含的UI之一轻松自定义

最新更新