ios - 从 Zoom iOS SDK 自定义会议实施中获取当前活跃用户
问题描述
我已经实现了 Zoom iOS SDK 以使用自定义 UI。一切都按预期工作,但我无法弄清楚如何获取当前活动用户的用户 ID。
我已经实现了下面的委托方法,它讲述了当前活动的视频用户,但不幸的是,它显示了会议中除我之外的所有其他参与者。
func onSinkMeetingActiveVideo(_ userID: UInt) {
if let service = MobileRTC.shared().getMeetingService(), let username = service.userInfo(byID: userID)?.userName {
print("\(#function) : \(userID) : \(username)")
}
}
我需要知道谁是当前的活跃用户,即使是我在说话。
解决方案
您可以从会议服务 MobileRTCMeetingService 中检索此类信息。
func getActiveUserId() -> UInt? {
if let meetingService = MobileRTC.shared().getMeetingService() {
return meetingService.activeUserID()
}
return nil
}
额外说明:在 Zoom 中还有一个固定用户的概念,它会覆盖活动视频单元中的活动用户。可以通过以下方式检索固定的用户 ID:
func getPinnedUserId() -> UInt? {
if let meetingService = MobileRTC.shared().getMeetingService(), let userList = meetingService.getInMeetingUserList(){
for userId in userList {
if let userId = userId as? UInt, meetingService.isUserPinned(userId) {
return userId
}
}
return nil
}
return nil
}
因此,为了确定哪个是活动视频单元格中视频的用户 ID,您必须同时检查两者,优先考虑固定用户。
let currentVideoUserId = getPinnedUserId() ?? getActiveUserId()
在会议期间,您将永远不会成为您自己的视频单元中的活跃用户,因为即使您正在发言,您将继续在活跃的视频单元中看到其他人。
另一方面,如果您想知道谁在说话,那么您必须检索用户列表并检查 audioStatus [MobileRTCAudioStatus]。
请注意,您可以同时让多个用户发言。
如果您对活跃的演讲者用户感兴趣,还有另一个回调可能很有用:它是 MobileRTCVideoServiceDelegate 中的 onSinkMeetingActiveVideoForDeck
根据文档,每次有新扬声器时都应该触发它。ZOOM UI 使用它来更改当前扬声器用户周围的黄色框。
推荐阅读
- actionscript-3 - 如何从附加到 .fla 文件的 main.as 类文件运行另一个 .as 文件的构造函数代码?
- meteor - 如何使用流星中的集群包在本地扩展应用程序?
- d3.js - d3,折线图,错误:
属性 d:预期数量 - ios-charts - iOS Charts - 显示 CandleStick 图表的最高值和最低值
- stage - 蓝色棱镜:在文本框中输入文本时,相邻按钮未启用
- ios - 如何使用 UISearchBar 过滤 NSDictionary?
- php - 中间件功能不存在
- python - 3D GIF 中的颜色条
- javascript - Angular - 将两个可观察结果合二为一
- google-bigquery - BigQuery 获取本周和上周的数据