tencent cloud

文档反馈

监听会议状态

最后更新时间:2024-08-29 17:26:14
    本文介绍 TUIRoomKit 组件会议状态回调的使用。

    会议状态监听

    如果您的业务需要监听会议的状态,例如会议开始、结束等会议过程中的事件,可以参见如下代码:
    Android(Java)
    Android(Kotlin)
    iOS (Swift)
    iOS (OC)
    ConferenceDefine.ConferenceObserver observer = new ConferenceDefine.ConferenceObserver() { @Override public void onConferenceStarted(TUIRoomDefine.RoomInfo roomInfo, TUICommonDefine.Error error, String message) { } @Override public void onConferenceJoined(TUIRoomDefine.RoomInfo roomInfo, TUICommonDefine.Error error, String message) { } @Override public void onConferenceExisted(String roomId) { } @Override public void onConferenceFinished(String roomId) { } }; ConferenceSession.sharedInstance().addObserver(observer);
    val observer: ConferenceObserver = object : ConferenceObserver() { override fun onConferenceStarted(roomInfo: TUIRoomDefine.RoomInfo?, error: TUICommonDefine.Error?, message: String?) { } override fun onConferenceJoined(roomInfo: TUIRoomDefine.RoomInfo?, error: TUICommonDefine.Error?, message: String?) { } override fun onConferenceExisted(roomId: String?) { } override fun onConferenceFinished(roomId: String?) { } } ConferenceSession.sharedInstance().addObserver(observer)
    
    class EnterRoomViewController: UIViewController {
    override func viewDidLoad() {
    super.viewDidLoad()
    ConferenceSession.sharedInstance.addObserver(observer: self)
    }
    }
    
    
    extension EnterRoomViewController: ConferenceObserver {
    // 发起会议回调
    func onConferenceStarted(roomInfo: TUIRoomInfo, error: TUIError, message: String) {
    // Your code here
    }
    
    // 加入会议回调
    func onConferenceJoined(roomInfo: TUIRoomInfo, error: TUIError, message: String) {
    // Your code here
    }
    
    // 会议被解散回调
    func onConferenceFinished(conferenceId: String) {
    // Your code here
    }
    
    // 退出会议回调
    func onConferenceExited(conferenceId: String) {
    // Your code here
    }
    }
    @interface EnterRoomViewController () <ConferenceObserver>
    
    @end
    
    @implementation EnterRoomViewController
    - (void)viewDidLoad {
    [super viewDidLoad];
    [[ConferenceSession sharedInstance] addObserver:self];
    }
    #pragma mark - ConferenceObserver
    // 发起会议回调
    - (void)onConferenceStartedWithRoomInfo:(TUIRoomInfo *)roomInfo error:(TUIError *)error message:(NSString *)message {
    // Your code here
    }
    
    // 加入会议回调
    - (void)onConferenceJoinedWithRoomInfo:(TUIRoomInfo *)roomInfo error:(TUIError *)error message:(NSString *)message {
    // Your code here
    }
    
    // 会议被解散回调
    - (void)onConferenceFinishedWithConferenceId:(NSString *)conferenceId {
    // Your code here
    }
    
    // 退出会议回调
    - (void)onConferenceExitedWithConferenceId:(NSString *)conferenceId {
    // Your code here
    }
    
    @end
    
    联系我们

    联系我们,为您的业务提供专属服务。

    技术支持

    如果你想寻求进一步的帮助,通过工单与我们进行联络。我们提供7x24的工单服务。

    7x24 电话支持