@tencentcloud/tuiroom-engine-electron 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,175 @@
1
+ ###TUIRoomEngine Electron SDK
2
+
3
+ ### 简介
4
+
5
+ TUIRoomEngine Electron SDK 依托腾讯云 [实时音视频 TRTC](https://cloud.tencent.com/document/product/647/16788) 和 [即时通信 IM](https://cloud.tencent.com/document/product/269/42440) 服务,为用户提供房间管理,多人实时音视频互动,屏幕分享,成员管理,即时聊天等功能。
6
+
7
+ + [官方文档](https://write.woa.com/document/96640299265654784)
8
+ + [体验 Demo](https://write.woa.com/document/93119368721211392)
9
+ + [github](https://github.com/tencentyun/TUIRoom/tree/main/Electron)
10
+
11
+ ### 安装
12
+ 使用 npm:
13
+
14
+ ```bash
15
+ npm i tuiroom-engine-electron --save
16
+ ```
17
+
18
+ 使用 yarn:
19
+
20
+ ```bash
21
+ yarn add tuiroom-engine-electron
22
+ ```
23
+
24
+ 使用 pnpm:
25
+
26
+ ```bash
27
+ pnpm i tuiroom-engine-electron --save
28
+ ```
29
+
30
+ ### 示例代码
31
+ ```javascript
32
+ import TUIRoomEngine from '@tencentcloud/tuiroom-engine-electron';
33
+
34
+ let roomEngine = null;
35
+
36
+ // 错误
37
+ function onError(error) {
38
+ console.error(error);
39
+ }
40
+
41
+ // 音量变化
42
+ function onUserVoiceVolumeChanged(eventInfo) {
43
+ console.log(eventInfo.userVolumeList);
44
+ }
45
+
46
+ // 网络质量变化
47
+ function onUserNetworkQualityChanged(eventInfo) {
48
+ console.log(eventInfo.userNetworkList);
49
+ }
50
+
51
+ // 被踢出房间
52
+ function onKickedOutOfRoom(eventInfo) {
53
+ console.log(`roomId: ${eventInfo.roomId}, ${eventInfo.message}`);
54
+ }
55
+
56
+ // 用户是否被禁止发消息
57
+ function onUserMuteStateChanged(eventInfo) {
58
+ console.log(`user ${eventInfo.userId} isMute:${eventInfo.muted}`);
59
+ }
60
+
61
+ // 用户签名 userSig 过期
62
+ function onUserSigExpired() {
63
+ console.log('userSig expire');
64
+ }
65
+
66
+ // 被踢下线
67
+ function onKickedOffLine(eventInfo) {
68
+ console.log(`user offline, reason: ${eventInfo.message}`);
69
+ }
70
+
71
+ // 房间信息变更
72
+ function onRoomInfoChanged(eventInfo) {
73
+ console.log(`roomInfo ${JSON.stringify(eventInfo)}`);
74
+ }
75
+
76
+ // 设备变化:设备切换、设备插拔事件
77
+ function onDeviceChange(eventInfo) {
78
+ console.log(`deviceChange ${JSON.stringify(eventInfo)}`);
79
+ }
80
+
81
+ async function init() {
82
+ TUIRoomEngine.once('ready', () => {
83
+ roomEngine = new TUIRoomEngine();
84
+ roomEngine.on(TUIRoomEvents.onError, onError);
85
+ roomEngine.on(TUIRoomEvents.onUserVoiceVolumeChanged, onUserVoiceVolumeChanged);
86
+ roomEngine.on(TUIRoomEvents.onUserNetworkQualityChanged, onUserNetworkQualityChanged);
87
+ roomEngine.on(TUIRoomEvents.onKickedOutOfRoom, onKickedOutOfRoom);
88
+ roomEngine.on(TUIRoomEvents.onUserMuteStateChanged, onUserMuteStateChanged);
89
+
90
+ roomEngine.on(TUIRoomEvents.onUserSigExpired, onUserSigExpired);
91
+ roomEngine.on(TUIRoomEvents.onKickedOffLine, onKickedOffLine);
92
+ roomEngine.on(TUIRoomEvents.onRoomInfoChanged, onRoomInfoChanged);
93
+
94
+ roomEngine.on(TUIRoomEvents.onDeviceChange, onDeviceChange);
95
+ });
96
+
97
+ // userSig 生成可参考 "服务开通" 部分
98
+ await TUIRoomEngine.init({ sdkAppId: 0, userId: '', userSig: '' });
99
+ await TUIRoomEngine.setSelfInfo({ userName: 'zhangsan', avatarUrl: 'https://testurl' });
100
+ }
101
+
102
+ init();
103
+
104
+ ```
105
+
106
+ #### API list
107
+
108
+ | API | 含义 |
109
+ | :-------------------------------- | :----------------- |
110
+ | [init](https://write.woa.com/document/93177225215877120#init) | 初始化 TUIRoomEngine |
111
+ | [setSelfInfo](https://write.woa.com/document/93177225215877120#setSelfInfo) | 设置当前用户基本信息(用户名、用户头像) |
112
+ | [createRoom](https://write.woa.com/document/93177225215877120#createRoom) | 创建房间 |
113
+ | [enterRoom](https://write.woa.com/document/93177225215877120#enterRoom) | 进入房间 |
114
+ | [destroyRoom](https://write.woa.com/document/93177225215877120#destroyRoom) | 销毁房间 |
115
+ | [exitRoom](https://write.woa.com/document/93177225215877120#exitRoom) | 离开房间 |
116
+ | [getRoomInfo](https://write.woa.com/document/93177225215877120#getRoomInfo) | 获取房间信息 |
117
+ | [updateRoomInfo](https://write.woa.com/document/93177225215877120#updateRoomInfo) | 更新房间信息 |
118
+ | [getUserList](https://write.woa.com/document/93177225215877120#getUserList) | 获取当前房间用户列表 |
119
+ | [getUserInfo](https://write.woa.com/document/93177225215877120#getUserInfo) | 获取用户的详细信息 |
120
+ | [takeSeat](https://write.woa.com/document/93177225215877120#takeSeat) | 获取麦位 |
121
+ | [leaveSeat](https://write.woa.com/document/93177225215877120#leaveSeat) | 释放麦位 |
122
+ | [getSeatList](https://write.woa.com/document/93177225215877120#getSeatList) | 获取麦位信息 |
123
+ | [requestToOpenRemoteCamera](https://write.woa.com/document/93177225215877120#requestToOpenRemoteCamera) | 请求远端用户打开摄像头 |
124
+ | [closeRemoteCamera](https://write.woa.com/document/93177225215877120#closeRemoteCamera) | 关闭远端用户摄像头 |
125
+ | [requestToOpenRemoteMicrophone](https://write.woa.com/document/93177225215877120#requestToOpenRemoteMicrophone) | 请求远端用户打开麦克风 |
126
+ | [closeRemoteMicrophone](https://write.woa.com/document/93177225215877120#closeRemoteMicrophone) | 关闭远端用户麦克风 |
127
+ | [requestRemoteUserOnSeat](https://write.woa.com/document/93177225215877120#requestRemoteUserOnSeat) | 邀请其他人上麦 |
128
+ | [kickRemoteUserOffSeat](https://write.woa.com/document/93177225215877120#kickRemoteUserOffSeat) | 要求其他人下麦 |
129
+ | [cancelRequest](https://write.woa.com/document/93177225215877120#cancelRequest) | 取消已经发出的请求 |
130
+ | [responseRemoteRequest](https://write.woa.com/document/93177225215877120#responseRemoteRequest) | 回复远端用户的请求 |
131
+ | [setLocalRenderView](https://write.woa.com/document/93177225215877120#setLocalRenderView) | 设置本地流的渲染位置 |
132
+ | [openLocalCamera](https://write.woa.com/document/93177225215877120#openLocalCamera) | 本地摄像头视频流采集 |
133
+ | [closeLocalCamera](https://write.woa.com/document/93177225215877120#closeLocalCamera) | 关闭本地摄像头 |
134
+ | [openLocalMicrophone](https://write.woa.com/document/93177225215877120#openLocalMicrophone) | 打开本地麦克风 |
135
+ | [closeLocalMicrophone](https://write.woa.com/document/93177225215877120#closeLocalMicrophone) | 关闭本地麦克风 |
136
+ | [setLocalVideoProfile](https://write.woa.com/document/93177225215877120#setLocalVideoProfile) | 设置本地视频的参数 |
137
+ | [setLocalAudioProfile](https://write.woa.com/document/93177225215877120#setLocalAudioProfile) | 设置本地音频的参数 |
138
+ | [startPushLocalVideo](https://write.woa.com/document/93177225215877120#startPushLocalVideo) | 开始向远端推本地视频流 |
139
+ | [stopPushLocalVideo](https://write.woa.com/document/93177225215877120#stopPushLocalVideo) | 停止向远端推本地视频流 |
140
+ | [startPushLocalAudio](https://write.woa.com/document/93177225215877120#startPushLocalAudio) | 开始向远端推本地音频流 |
141
+ | [stopPushLocalAudio](https://write.woa.com/document/93177225215877120#stopPushLocalAudio) | 停止向远端推本地音频流 |
142
+ | [setRemoteRenderView](https://write.woa.com/document/93177225215877120#setRemoteRenderView) | 设置远端流渲染的区域 |
143
+ | [startPlayRemoteVideo](https://write.woa.com/document/93177225215877120#startPlayRemoteVideo) | 开始播放远端用户视频流 |
144
+ | [stopPlayRemoteVideo](https://write.woa.com/document/93177225215877120#stopPlayRemoteVideo) | 停止播放远端用户视频流 |
145
+ | [changeUserRole](https://write.woa.com/document/93177225215877120#changeUserRole) | 改变用户的角色 |
146
+ | [muteRemoteUser](https://write.woa.com/document/93177225215877120#muteRemoteUser) | 禁止远端用户发送消息 |
147
+ | [unmuteRemoteUser](https://write.woa.com/document/93177225215877120#unmuteRemoteUser) | 取消禁止远端用户发送消息 |
148
+ | [kickOutRemoteUser](https://write.woa.com/document/93177225215877120#kickOutRemoteUser) | 将用户踢出房间 |
149
+ | [sendTextMessage](https://write.woa.com/document/93177225215877120#sendTextMessage) | 发送文本消息 |
150
+ | [sendCustomMessage](https://write.woa.com/document/93177225215877120#sendCustomMessage) | 发送自定义消息 |
151
+ | [startScreenSharingElectron](https://write.woa.com/document/93177225215877120#startScreenSharingElectron) | 开始屏幕共享 |
152
+ | [stopScreenSharingElectron](https://write.woa.com/document/93177225215877120#stopScreenSharingElectron) | 停止屏幕共享 |
153
+ | [getScreenSharingTarget](https://write.woa.com/document/93177225215877120#getScreenSharingTarget) | 获取屏幕分享列表 |
154
+ | [selectScreenSharingTarget](https://write.woa.com/document/93177225215877120#selectScreenSharingTarget) | 切换屏幕分享窗口 |
155
+ | [on](https://write.woa.com/document/93177225215877120#on) | 监听 roomEngine 的事件 |
156
+ | [off](https://write.woa.com/document/93177225215877120#off) | 取消监听 roomEngine 的事件 |
157
+ | [getCameraDevicesList](https://write.woa.com/document/93177225215877120#getCameraDevicesList) | 获取摄像头设备列表 |
158
+ | [getMicDevicesList](https://write.woa.com/document/93177225215877120#getMicDevicesList) | 获取麦克风设备列表 |
159
+ | [getSpeakerDevicesList](https://write.woa.com/document/93177225215877120#getSpeakerDevicesList) | 获取扬声器设备列表 |
160
+ | [setCurrentCameraDevice](https://write.woa.com/document/93177225215877120#setCurrentCameraDevice) | 设置要使用的摄像头设备 |
161
+ | [setCurrentMicDevice](https://write.woa.com/document/93177225215877120#setCurrentMicDevice) | 设置要使用的麦克风设备 |
162
+ | [setCurrentSpeakerDevice](https://write.woa.com/document/93177225215877120#setCurrentSpeakerDevice) | 设置要使用的扬声器设备 |
163
+ | [getCurrentCameraDevice](https://write.woa.com/document/93177225215877120#getCurrentCameraDevice) | 获取当前正在使用的摄像头设备 |
164
+ | [getCurrentMicDevice](https://write.woa.com/document/93177225215877120#getCurrentMicDevice) | 获取当前正在使用的麦克风设备 |
165
+ | [getCurrentSpeakerDevice](https://write.woa.com/document/93177225215877120#getCurrentSpeakerDevice) | 获取当前正在使用的扬声器设备 |
166
+ | [startCameraDeviceTest](https://write.woa.com/document/93177225215877120#startCameraDeviceTest) | 开始进行摄像头测试 |
167
+ | [stopCameraDeviceTest](https://write.woa.com/document/93177225215877120#stopCameraDeviceTest) | 停止摄像头测试 |
168
+ | [getTRTCCloud](https://write.woa.com/document/93177225215877120#getTRTCCloud) | 获取 trtcCloud 实例 |
169
+ | [getTIM](https://write.woa.com/document/93177225215877120#getTIM) | 获取 tim 实例 |
170
+
171
+ ### 参考文档
172
+ - [TUIRoomEngine](https://write.woa.com/document/93177225215877120)
173
+ - [快速接入 TUIRoomKit Web](https://write.woa.com/document/93119862767460352)
174
+ - [腾讯实时音视频 TRTC](https://cloud.tencent.com/document/product/647/16788)
175
+ - [腾讯云即时通信 IM](https://cloud.tencent.com/document/product/269/1498)