可以通过以下方式设置TRTCVoiceRoomEnteryControl的delegate:

let enteryControl = TRTCVoiceRoomEnteryControl(sdkAppId: 12345, userId: "your_userId")
enteryControl.delegate = self

然后实现TRTCVoiceRoomEnteryControlDelegate协议中的方法:

extension YourViewController: TRTCVoiceRoomEnteryControlDelegate {
    func voiceRoomCreateRoom(roomId: String, success: @escaping () -> Void, failed: @escaping (Int32, String) -> Void) {
        // 在此处处理创建房间的逻辑
        // 成功时调用 success()
        // 失败时调用 failed(code, message)
    }

    func voiceRoomDestroyRoom(roomId: String, success: @escaping () -> Void, failed: @escaping (Int32, String) -> Void) {
        // 在此处处理销毁房间的逻辑
        // 成功时调用 success()
        // 失败时调用 failed(code, message)
    }
}

在实现的方法中,根据具体的业务逻辑处理创建房间和销毁房间的操作

oc 调用swift TRTCVoiceRoomEnteryControlswift TRTCVoiceRoomDemo Created by abyyxwang on 202063 Copyright © 2020 tencent All rights reservedimport UIKitimport TXLiteAVSDK_TRTCpublic protocol TRTCVoic

原文地址: https://www.cveoy.top/t/topic/iHvH 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录