【问题标题】:Get Current Active user from the Zoom iOS SDK Custom Meeting implementation从 Zoom iOS SDK 自定义会议实施中获取当前活跃用户
【发布时间】:2021-04-30 08:23:17
【问题描述】:

我已经实现了 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)")
    }
}

我需要知道谁是当前活跃用户,即使是我在说话。

【问题讨论】:

  • 你可以尝试使用 onSinkMeetingActiveVideoForDeck 代替 onSinkMeetingActiveVideo 吗?
  • @cristallo 出于某种原因它从未调用过。委托中只调用了onSinkMeetingActiveVideo
  • 嗯,我很困惑。您使用的是最新的 SDK 吗?

标签: ios swift iphone zoom-sdk


【解决方案1】:

您可以从会议服务 MobileRTCMeetingService 中检索此类信息。

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]。

MobileRTCAudioStatus

MobileRTCMeetingUserInfo

请注意,您可以同时让多个用户发言。

如果您对活动扬声器用户感兴趣,还有另一个回调可能会很有用:它是 MobileRTCVideoServiceDelegate 中的 onSinkMeetingActiveVideoForDeck

MobileRTCVideoServiceDelegate

根据文档,每次有新扬声器时都应该触发它。 ZOOM UI 使用它来更改当前发言人用户周围的黄色框。

【讨论】:

    【解决方案2】:

    我根据文档,为了获取当前活动视频用户信息,您应该使用以下类:MobileRTCMeetingUserInfo。

    查看视频状态类 MobileRTCVideoStatus 的文档:https://marketplacefront.zoom.us/sdk/meeting/ios/interface_mobile_r_t_c_video_status.html

    您会看到这与 MobileRTCMeetingUserInfo 相关: https://marketplacefront.zoom.us/sdk/meeting/ios/interface_mobile_r_t_c_meeting_user_info.html

    在该课程中,您将找到当前用户的信息。

    希望你能解决你的问题! 问候! 加斯顿·蒙特斯。

    【讨论】:

      猜你喜欢
      • 2021-07-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-24
      • 1970-01-01
      • 2020-11-14
      • 1970-01-01
      相关资源
      最近更新 更多