功能介绍
TUIRoomKit 支持房间加密,您可以通过接入 TUIRoomKit 来预定或创建一个密码房间,若 TUIRoomKit 的 UI 交互不满足您的产品需求,您可以接入 TUIRoomEngineSDK 自定义实现房间密码相关的交互功能,具体请参见 关键代码。
使用说明
创建密码房间
成功接入 TUIRoomKit 并登录成功后可创建密码房间。不同平台创建密码房间请参见:
ConferenceDefine.StartConferenceParams params = new ConferenceDefine.StartConferenceParams("222222"); // 请替换 "222222" 为您自定义的房间号 params.passWord = "123456";// 请替换 "123456" 为您设置的密码(小于等于6位的纯数字)。 Intent intent = new Intent(this, ConferenceMainActivity.class); intent.putExtra(KEY_START_CONFERENCE_PARAMS, params); startActivity(intent);
注意:
进入房间仅支持小于等于6位的纯数字密码。
import TUIRoomKitfunc quickStartConference() {let vc = ConferenceMainViewController()let params = StartConferenceParams(roomId: "111111") // 请替换 "111111" 为您自定义的房间号params.password = "123456" // 请替换 "123456" 为您自定义的房间密码(小于等于6位的纯数字)。vc.setStartConferenceParams(params: params)navigationController?.pushViewController(vc, animated: true)}
#import "TUIRoomKit/TUIRoomKit-Swift.h"- (void)quickStartConference {ConferenceMainViewController * vc = [[ConferenceMainViewController alloc]init];StartConferenceParams * params = [[StartConferenceParams alloc]initWithRoomId: @"111111" // 请替换 "111111" 为您自定义的房间号isOpenMicrophone:YESisOpenCamera:NOisOpenSpeaker:YESisMicrophoneDisableForAllUser:NOisCameraDisableForAllUser:NOisSeatEnabled:NOname:@"YourRoomName"password:@"123456"]; // 请替换 "123456" 为您自定义的房间密码[vc setStartConferenceParamsWithParams:params];[self.navigationController pushViewController:vc animated:YES];}
注意:
进入房间仅支持小于等于6位的纯数字密码。
// 注意包的名称,如果您使用 vue2 版本请更改包名为 @tencentcloud/roomkit-web-vue2.7import { conference } from '@tencentcloud/roomkit-web-vue3';conference.start('123456', { // 请替换 '123456' 为您的房间号roomName: 'TestRoom',isSeatEnabled: false,isOpenCamera: false,isOpenMicrophone: false,password: '123456', // 请替换 '123456' 为您设置的密码});
注意:
进入房间仅支持小于等于6位的纯数字密码。
预定密码房间
受邀成员进入房间:可通过会议列表或房间号,无需密码直接进入房间。
未受邀成员进入房间:只能通过房间号进入房间,且需要输入正确密码。
Android & iOS | | |
预定密码房间 | 未受邀成员加入房间输入密码 | 受邀成员可直接进入房间 |
| | |
Web | | |
预定密码房间 | 未受邀成员加入房间输入密码 | 受邀成员可直接进入房间 |
| | |
说明:
功能定制
如果当前的 UI 不满足您的需求,您可以通过修改源码来实现您满意的 UI 效果,不同平台请参考:
您可以通过修改 Android/TUIRoomKit/tuiroomkit/src/main/java/com/tencent/cloud/tuikit/roomkit/view/page/widget/ScheduleConference/view目录下的源代码,来实现您满意的 UI 效果。为了您更方便的定制 UI,这里对房间密码的文件做了介绍。
// 位置:Android/TUIRoomKit/tuiroomkit/src/main/java/com/tencent/cloud/tuikit/roomkit/view/page/widget/ScheduleConference/view
view├── EnterConferencePasswordView.java // 输入密码弹窗的界面└── SetConferenceEncryptView.java // 预定会议设置密码的界面
view├── ConferencePasswordView.swift // 输入密码弹窗的界面└── ScheduleConferenceDataHelper.swift // 预定会议中设置密码弹出界面样式
您可以通过修改如下位置目录下的源代码,来实现您满意的 UI 效果。为了您更方便的定制 UI,这里对房间密码的文件做了介绍。
// 位置:TUIRoomKit/Web/roomkit/vue3/src/TUIRoom/components/PreRoom├── PasswordDialog.vue // 输入密码弹窗的界面ScheduleConference/ScheduleConferencePanel├── ScheduleConferencePanelPC.vue // 预定会议设置密码的界面 Web└── ScheduleConferencePanelH5.vue // 预定会议设置密码的界面 H5
您可以通过修改如下位置目录下的源代码,来实现您满意的 UI 效果。为了您更方便的定制 UI,这里对房间密码的文件做了介绍。
// 位置:TUIRoomKit/Electron/roomkit/vue3/src/TUIRoom/components/PreRoom├── PasswordDialog.vue // 输入密码弹窗的界面ScheduleConference/ScheduleConferencePanel├── ScheduleConferencePanelPC.vue // 预定会议设置密码的界面 Web└── ScheduleConferencePanelH5.vue // 预定会议设置密码的界面 H5
说明:
关键代码
创建密码房间,不同平台请参考:
public abstract void createRoom(TUIRoomDefine.RoomInfo roomInfo, TUIRoomDefine.ActionCallback callback);
示例代码如下:
TUIRoomDefine.RoomInfo roomInfo = new TUIRoomDefine.RoomInfo();roomInfo.roomId = "222222"; // 请替换 "222222" 为您的房间号。roomInfo.password = "123456" // 请替换 "123456" 为您设置的密码。TUIRoomEngine.sharedInstance().createRoom(roomInfo, new TUIRoomDefine.ActionCallback() { @Override public void onSuccess() {// 创建房间成功回调 } @Override public void onError(TUICommonDefine.Error error, String message) {// 创建房间失败回调 } });
- (void)createRoom:(TUIRoomInfo *)roomInfo onSuccess:(TUISuccessBlock)onSuccess onError:(TUIErrorBlock)onError NS_SWIFT_NAME(createRoom(_:onSuccess:onError:));
示例代码如下:
import RTCRoomEnginefunc createRoom() {let roomInfo = TUIRoomInfo()roomInfo.roomId = "111111" // 请替换 "111111" 为您自定义的房间号roomInfo.password = "123456" // 请替换 "123456" 为您自定义的房间密码TUIRoomEngine.sharedInstance().createRoom(roomInfo) {print("CreateRoom success")} onError: { code, message inprint("CreateRoom error, code:\\(code), message:\\(message)")}}
#import "RTCRoomEngine/TUIRoomDefine.h"#import "RTCRoomEngine/TUIRoomEngine.h"- (void)createRoom {TUIRoomInfo * roomInfo = [[TUIRoomInfo alloc] init];roomInfo.roomId = @"111111"; // 请替换 "111111" 为您自定义的房间号roomInfo.password = @"123456"; // 请替换 "123456" 为您自定义的房间密码[[TUIRoomEngine sharedInstance] createRoom:roomInfo onSuccess:^{NSLog(@"CreateRoom success");} onError:^(TUIError code, NSString * _Nonnull message) {NSLog(@"CreateRoom error, code:%ld, message:%@", (long)code, message);}];}
示例代码如下:
// 注意包的名称,如果您使用 vue2 版本请更改包名为 @tencentcloud/roomkit-web-vue2.7import { conference } from '@tencentcloud/roomkit-web-vue3';conference.start('123456', { // 请替换 '123456' 为您设置的密码roomName: 'TestRoom',isSeatEnabled: false,isOpenCamera: false,isOpenMicrophone: false,password: '123456', // 请替换 '123456' 为您设置的密码});
预定密码房间,不同平台请参考:
public abstract void scheduleConference(ConferenceInfo conferenceInfo, TUIRoomDefine.ActionCallback callback);
TUIConferenceListManager manager = TUIRoomEngine.sharedInstance().getExtension(CONFERENCE_LIST_MANAGER);TUIConferenceListManager.ConferenceInfo conferenceInfo = new TUIConferenceListManager.ConferenceInfo();conferenceInfo.basicRoomInfo.roomId = "222222"; // 请替换 "222222" 为您预定房间的房间号。conferenceInfo.basicRoomInfo.password = "123456"; // 请替换 "123456" 为您设置的密码。manager.scheduleConference(conferenceInfo, new TUIRoomDefine.ActionCallback() { @Override public void onSuccess() {// 预定房间成功回调 } @Override public void onError(TUICommonDefine.Error error, String message) {// 预定房间失败回调 } });
- (void)scheduleConference:(TUIConferenceInfo *)conferenceInfo onSuccess:(TUISuccessBlock)onSuccess onError:(TUIErrorBlock)onError NS_SWIFT_NAME(scheduleConference(_:onSuccess:onError:));
import RTCRoomEnginefunc scheduleConference() {let manager = TUIRoomEngine.sharedInstance().getExtension(extensionType: .conferenceListManager) as? TUIConferenceListManagerlet conferenceInfo = TUIConferenceInfo()conferenceInfo.basicRoomInfo.roomId = "111111" // 请替换 "111111" 为您自定义的房间号conferenceInfo.basicRoomInfo.password = "123456" // 请替换 "123456" 为您自定义的房间密码manager?.scheduleConference(conferenceInfo, onSuccess: {print("ScheduleConference success")}, onError: { code, message inprint("ScheduleConference failed, code:\\(code), message:\\(message)")})}
#import "RTCRoomEngine/TUIRoomEngine.h"#import "RTCRoomEngine/TUIConferenceListManager.h"- (void)scheduleConference {TUIConferenceListManager * manager = [[TUIRoomEngine sharedInstance] getExtension: TUIExtensionTypeConferenceListManager];TUIConferenceInfo * conferenceInfo = [[TUIConferenceInfo alloc] init];conferenceInfo.basicRoomInfo.roomId = @"111111"; // 请替换 "111111" 为您自定义的房间号conferenceInfo.basicRoomInfo.password = @"123456"; // 请替换 "123456" 为您自定义的房间密码[manager scheduleConference:conferenceInfo onSuccess:^{NSLog(@"ScheduleConference success");} onError:^(TUIError code, NSString * _Nonnull message) {NSLog(@"ScheduleConference failed, code:%ld, message:%@", (long)code, message);}];}
进入密码房间
public abstract void enterRoom(String roomId, TUIRoomDefine.RoomType roomType, TUIRoomDefine.EnterRoomOptions options, TUIRoomDefine.GetRoomInfoCallback callback);
String roomId = "222222"; // 请替换 "222222" 为您加入的房间号TUIRoomDefine.EnterRoomOptions options = new TUIRoomDefine.EnterRoomOptions(); options.password = "123456"; // 请替换 "123456" 为您加入房间的密码。TUIRoomEngine.sharedInstance().enterRoom(roomId, TUIRoomDefine.RoomType.CONFERENCE, options, new TUIRoomDefine.GetRoomInfoCallback() { @Override public void onSuccess(TUIRoomDefine.RoomInfo engineRoomInfo) {// 进入房间成功回调 } @Override public void onError(TUICommonDefine.Error error, String message) {// 进入房间失败回调if (error == TUICommonDefine.Error.WRONG_PASSWORD) {// 密码错误,这里执行进房密码错误的业务。 } } });
- (void)enterRoom:(NSString *)roomId roomType:(TUIRoomType)roomType options:(TUIEnterRoomOptions *)options onSuccess:(TUIRoomInfoBlock)onSuccess onError:(TUIErrorBlock)onError NS_SWIFT_NAME(enterRoom(_:roomType:options:onSuccess:onError:));
import RTCRoomEnginefunc enterRoom() {let roomId = "111111" // 请替换 "111111" 为您自定义的房间号let options = TUIEnterRoomOptions()options.password = "123456" // 请替换 "123456" 为您自定义的房间密码TUIRoomEngine.sharedInstance().enterRoom(roomId, roomType: .conference, options: options) { roomInfo inprint("EnterRoom success")} onError: { code, message inprint("EnterRoom failed, code:\\(code), message:\\(message)")}}
#import "RTCRoomEngine/TUIRoomEngine.h"- (void)enterRoom {NSString * roomId = @"111111"; // 请替换 "111111" 为您自定义的房间号TUIEnterRoomOptions * options = [[TUIEnterRoomOptions alloc] init];options.password = @"123456"; // 请替换 "123456" 为您自定义的房间密码[[TUIRoomEngine sharedInstance] enterRoom:roomId roomType:TUIRoomTypeConference options:options onSuccess:^(TUIRoomInfo * _Nullable roomInfo) {NSLog(@"EnterRoom success");} onError:^(TUIError code, NSString * _Nonnull message) {NSLog(@"EnterRoom failed, code:%ld, message:%@", (long)code, message);}];}
示例代码如下:
// 注意包的名称,如果您使用 vue2 版本请更改包名为 @tencentcloud/roomkit-web-vue2.7import { conference } from '@tencentcloud/roomkit-web-vue3';conference.join('123456', { // 请替换 '123456' 为您加入的房间号isOpenCamera: false,isOpenMicrophone: false,password: '123456', // 请替换 '123456' 为您进入房间的密码});