TRTCVoiceRoomEnteryControl \u662f\u8054\u7cfb\u81ea\u7531\u4e91\u8ba1\u7b97\u5e73\u53f0\u7684\u4e00\u4e2a\u7c7b\uff0c\u7528\u4e8e\u63a7\u5236\u8054\u7cfb\u81ea\u7531\u7684\u8bed\u97f3\u623f\u95f4\u7684\u8fdb\u5165\u6743\u9650\u3002\n\n\u5728\u8fd9\u91cc\uff0c\u6211\u4eec\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728\u8fd9\u4e2a\u73af\u5883\u4e2d\u4f7f\u7528\u8fd9\u4e2a\u7c7b\u3002\n\n\u5728 Swift\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u5f0f\u521b\u5efa\u4e00\u4e2a TRTCVoiceRoomEnteryControl\u5bf9\u8c61\uff1a\n\nswift\nlet enteryControl = TRTCVoiceRoomEnteryControl()\n\n\nTRTCVoiceRoomEnteryControl\u63d0\u4f9b\u4e86\u4ee5\u4e0b\u65b9\u6cd5\u6765\u63a7\u5236\u7528\u6237\u8fdb\u5165\u8bed\u97f3\u623f\u95f4\u7684\u6743\u9650\uff1a\n\n1\uff0e\u8bbe\u7f6e\u623f\u95f4\u662f\u5426\u9700\u8981\u5bc6\u7801\uff1a\n\nswift\nenteryControl.setRoomPassword(password: String)\n\n\n2\uff0e\u8bbe\u7f6e\u623f\u95f4\u662f\u5426\u9700\u8981\u9a8c\u8bc1\uff1a\n\nswift\nenteryControl.setRoomAuth(auth: Bool)\n\n\n3\uff0e\u8bbe\u7f6e\u6307\u5b9a\u7528\u6237\u7684\u8fdb\u5165\u6743\u9650\uff1a\n\nswift\nenteryControl.setUserId(userId: String, authority: TRTCVoiceRoomDef.TRTCRoleType)\n\n\n4\uff0e\u83b7\u53d6\u6307\u5b9a\u7528\u6237\u7684\u8fdb\u5165\u6743\u9650\uff1a\n\nswift\nlet authority = enteryControl.getUserId(userId: String)\n\n\n5\uff0e\u5220\u9664\u6307\u5b9a\u7528\u6237\u7684\u8fdb\u5165\u6743\u9650\uff1a\n\nswift\nenteryControl.removeUserId(userId: String)\n\n\nTRTCVoiceRoomEnteryControl\u8fd8\u63d0\u4f9b\u4e86\u4e00\u4e9b\u56de\u8c03\u65b9\u6cd5\uff0c\u7528\u4e8e\u76d1\u542c\u623f\u95f4\u8fdb\u5165\u6743\u9650\u7684\u53d8\u5316\uff1a\n\nswift\nenteryControl.delegate = self\n\n// \u5b9e\u73b0\u00a0TRTCCloudDelegate\u00a0\u534f\u8bae\u4e2d\u7684\u56de\u8c03\u65b9\u6cd5\nfunc onRoomPasswordEnter(roomId: String) {\n\t// \u623f\u95f4\u5bc6\u7801\u9a8c\u8bc1\u901a\u8fc7\uff0c\u53ef\u4ee5\u8fdb\u5165\u623f\u95f4\n}\n\nfunc onRoomAuthEnter(roomId: String) {\n\t// \u623f\u95f4\u9a8c\u8bc1\u901a\u8fc7\uff0c\u53ef\u4ee5\u8fdb\u5165\u623f\u95f4\n}\n\nfunc onUserIdEnter(userId: String, authority: TRTCVoiceRoomDef.TRTCRoleType) {\n\t// \u7528\u6237\u8fdb\u5165\u623f\u95f4\uff0c\u00a0authority\u00a0\u53c2\u6570\u8868\u793a\u7528\u6237\u7684\u8fdb\u5165\u6743\u9650\n}\n\nfunc onUserIdLeave(userId: String) {\n\t// \u7528\u6237\u79bb\u5f00\u623f\u95f4\n}\n\n\n\u4ee5\u4e0a\u5c31\u662f TRTCVoiceRoomEnteryControl\u5728 Swift\u4e2d\u7684\u57fa\u672c\u4f7f\u7528\u65b9\u6cd5\u3002

腾讯云 TRTC 语音房间进入权限控制 - Swift 使用指南

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

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