@tcic/core-sdk-v1 1.0.5

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-en.md ADDED
@@ -0,0 +1,10 @@
1
+ # Real-time Interactive - Education Edition UISDK Overview
2
+ The UISDK is a library that consolidates the core business logic of the Education Edition, providing convenient and easy-to-understand interfaces to meet the requirements of highly customized scenarios.
3
+
4
+ # Features
5
+ The SDK includes the following modules:
6
+
7
+ - TCIC: Wraps the concepts of rooms, hosts, and audience in the Education Edition, supporting basic operations on these objects.
8
+ - TIM: Supports real-time data communication within rooms, such as chat and group messaging, enabling various business models like group answering, announcements, and gift distribution.
9
+ - TRTC: Wraps the functionality of real-time video calling, allowing features like live video calls and interactive communication.
10
+
@@ -0,0 +1,10 @@
1
+
2
+
3
+
4
+ # 流水线
5
+
6
+ https://zhiyan.woa.com/qci/12221/pipeline/#/pipeline/detail/10798481/build/current
7
+
8
+ # 文档
9
+
10
+ https://docs.qcloudclass.com/latest/watchsdk/
package/README.md ADDED
@@ -0,0 +1,343 @@
1
+
2
+
3
+ # Real time interaction - Education version SDK overview
4
+
5
+ Real time Interactive Education Edition (formerly Low Code Interactive Classroom, LCIC) is a multifunctional product that integrates audio and video connectivity, interactive whiteboard, and live streaming
6
+
7
+ ( https://www.tencentcloud.com/document/product/1168/53651 )
8
+
9
+ This project is a client-side JavaScript SDK (demo), which allows you to develop and customize your own real-time interactive applications based on the SDK
10
+
11
+
12
+ # Core concepts
13
+
14
+ Room: The room represents a globally unique spatiotemporal place where real-time interaction occurs, identified by the room ID, and can be created by Tencent Cloud API( https://www.tencentcloud.com/document/product/1168/52794 ), then you can call the SDK method to join the room and start publishing audio and video streams in the room
15
+
16
+
17
+ # Function
18
+
19
+ The SDK mainly includes the following modules:
20
+
21
+ -TCIC: Packaging the original educational version of concepts such as rooms/homeowners/spectators, supporting the basic operations of these objects.
22
+
23
+ -TIM: Supports real-time data communication within the room, such as chatting, all staff messaging, etc. It can achieve various business models such as all staff answering, announcements, gift distribution, etc.
24
+
25
+ -TRTC: Real time video call function packaging, which can achieve functions such as connected voice calls.
26
+
27
+
28
+ # Demo
29
+
30
+ https://dev-class.qcloudclass.com/next/
31
+
32
+ # Demo Code
33
+
34
+ https://github.com/tencentyun/lcic-UIlessdemo
35
+
36
+ # Quick Start
37
+
38
+ 1. Install SDK dependencies
39
+
40
+ ## npm
41
+ npm install --save @tcic/core-sdk-v1
42
+ ## yarn
43
+ yarn add @tcic/core-sdk-v1
44
+
45
+
46
+ 2. Import the SDK
47
+
48
+ ```typescript
49
+ import * as SDK from '@tcic/core-sdk-v1';
50
+ ```
51
+
52
+ 3. Create the TCIC AND TRTC instance
53
+
54
+ ```javascript
55
+
56
+ const tcic = SDK.create({
57
+ userId: 'xxx'; //
58
+ token: 'token_of_the_userid';
59
+ classId: 345678; // got from cloud api
60
+ });
61
+
62
+ const trtcClient = SDK.createTrtcClient(tcic);
63
+
64
+ ```
65
+
66
+ 4. Join the room and create TIM instance
67
+
68
+ ```js
69
+
70
+ await tcic.init();
71
+
72
+ const tim = SDK.createTimClient(tcic);
73
+
74
+ ```
75
+
76
+ 5. Local preview your video and audio
77
+
78
+ ```js
79
+ trtcClient.localPreview({
80
+ view: 'dom-id',
81
+ });
82
+
83
+ ```
84
+
85
+ 6. Start and join the TRTC room, your local preview will beutomatically published to the room.
86
+
87
+ ```js
88
+ await tcic.start();
89
+ await trtcClient.enterRoom();
90
+ ```
91
+
92
+
93
+ 7. Pause your video and audio
94
+
95
+ ```js
96
+ trtcClient.pausePublish({
97
+ target: ['video', 'audio'],
98
+ });
99
+ ```
100
+
101
+ 8. Resume your video and audio
102
+
103
+ ```js
104
+ trtcClient.resumePublish({
105
+ target: ['video', 'audio'],
106
+ });
107
+
108
+ ```
109
+
110
+ 9. Fetch the room members by page.
111
+
112
+ ```js
113
+
114
+ tcic.getMembersDetail(classId, {
115
+ page: 1,
116
+ limit: 100,
117
+ });
118
+
119
+ ```
120
+
121
+ 10. Automatically play member audio and video. If students have not joined, it will automatically play after students join.
122
+
123
+
124
+ ```js
125
+ trtcClient.startRemote({
126
+ view: `dom-id`,
127
+ streamType: 'main',
128
+ userId: 'remote-user-id',
129
+ });
130
+ ```
131
+
132
+ 11. End the room
133
+
134
+ ```js
135
+ await tcic.end()
136
+ ```
137
+
138
+
139
+ ## Create a white board instance.
140
+
141
+ ```js
142
+ const teduBoard = SDK.createTiw(tcic, 'your-white-board-container-dom-id').instance;
143
+
144
+ // set up event listeners.
145
+ teduBoard.on(TEduBoard.EVENT.TEB_ERROR, (errorCode, errorMessage) => {
146
+ console.log('======================: ', 'TEB_ERROR', ' errorCode:', errorCode, ' errorMessage:', errorMessage);
147
+ });
148
+
149
+ teduBoard.on(TEduBoard.EVENT.TEB_WARNING, (warnCode, warnMessage) => {
150
+ console.log('======================: ', 'TEB_WARNING', ' warnCode:', warnCode, ' warnMessage:', warnMessage);
151
+ });
152
+
153
+ teduBoard.on(TEduBoard.EVENT.TEB_HISTROYDATA_SYNCCOMPLETED, () => {
154
+ console.log('======================: ', 'TEB_HISTROYDATA_SYNCCOMPLETED');
155
+ });
156
+
157
+ ```
158
+
159
+
160
+ Synchronize whiteboard operations to remote users by tim.
161
+ ```js
162
+
163
+ // Monitor operations of local whiteboard and sync the operation to the remote user's whiteboard use the tim instance
164
+ teduBoard.on(TEduBoard.EVENT.TEB_SYNCDATA, data => {
165
+ tim.sendRoomCustomMsg({
166
+ data: JSON.stringify(data),
167
+ extension: 'TXWhiteBoardExt'
168
+ }).then(() => {
169
+ // sync sucess.
170
+ }, () => {
171
+ // sync failed.
172
+ });
173
+ });
174
+
175
+
176
+ ```
177
+
178
+
179
+ On the remote side:
180
+ ```js
181
+
182
+ tim.on('customMsg', (data, msg)=>{
183
+ if (msg.data?.content?.extension === 'TXWhiteBoardExt') {
184
+ if (msg.from != tcic.userId) { // filter out messages sent by yourself.
185
+ teduBoard.addSyncData(data);
186
+ }
187
+ }
188
+ });
189
+
190
+
191
+ ```
192
+
193
+ ...
194
+
195
+ for more reference, see: https://doc.qcloudtiw.com/web/official/tutorial-tutorial-2-1.html
196
+
197
+
198
+ ## API reference
199
+
200
+ https://docs.qcloudclass.com/latest/tcic_engine/modules.html
201
+
202
+
203
+ ## RoadMap
204
+
205
+ The SDK is still under rapid iterative development stage. The subsequent new version will release a signal-based data flow SDK, which will further simplify the usage and add more enhanced and rich capabilities, so stay tuned.
206
+
207
+
208
+
209
+
210
+ # 中文版:
211
+
212
+ # 实时互动-教育版无UISDK概述
213
+
214
+ 实时互动-教育版(原低代码互动课堂,LCIC)是一款集成音视频连麦、互动白板和直播等多功能的产品.
215
+ (https://cloud.tencent.com/document/product/1639)
216
+
217
+ 本项目是客户端js SDK (demo), 您可以基于SDK开发定制您自己的实时互动应用
218
+
219
+
220
+ # 核心概念
221
+
222
+ 房间: 房间代表一场是全局唯一的实时互动发生的时空场所,用房间ID标识, 您可以通过云api接口(https://cloud.tencent.com/document/product/1639/80942) 创建房间, 然后调用SDK的方法加入房间并开始在房间发布音视频流
223
+
224
+
225
+ # 功能
226
+
227
+ SDK主要包含以下模块:
228
+ - TCIC:包装原教育版房间/房主/观众等概念,支持这些对象的基本操作。
229
+ - TIM:支持房间内实时数据通讯,例如聊天,全员消息等功能,可实现如全员抢答,公告,礼物下发等各种业务模式。
230
+ - TRTC:实时视频通话功能包装,可实现如连麦通话等功能。
231
+
232
+
233
+ # 快速开始
234
+
235
+ 1. 安装SDK依赖
236
+
237
+ ## npm
238
+ npm install --save @tcic/core-sdk-v1
239
+ ## yarn
240
+ yarn add @tcic/core-sdk-v1
241
+
242
+
243
+ 2. 引入依赖
244
+
245
+ ```typescript
246
+ import * as SDK from '@tcic/core-sdk-v1';
247
+ ```
248
+
249
+ 3. 初始化实例并加入房间
250
+
251
+ ```javascript
252
+
253
+ const tcic = SDK.create({
254
+ userId: 'xxx'; //
255
+ token: 'token_of_the_userid';
256
+ classId: 345678; // got from cloud api
257
+ });
258
+
259
+ const trtcClient = SDK.createTrtcClient(tcic);
260
+
261
+ ```
262
+
263
+
264
+ 4. 加入课堂并创建tim实例
265
+
266
+ ```js
267
+
268
+ await tcic.init();
269
+
270
+ const tim = SDK.createTimClient(tcic);
271
+
272
+ ```
273
+
274
+ 5. 本地预览
275
+
276
+ ```js
277
+ trtcClient.localPreview({
278
+ view: 'dom-id',
279
+ });
280
+
281
+ ```
282
+
283
+ 6. 开始房间并加入trtc, 本地预览将会自动发布至房间
284
+
285
+ ```js
286
+ await tcic.start();
287
+ await trtcClient.enterRoom();
288
+ ```
289
+
290
+
291
+ 7. 暂停音视频
292
+
293
+ ```js
294
+ trtcClient.pausePublish({
295
+ target: ['video', 'audio'],
296
+ });
297
+ ```
298
+
299
+
300
+ 8. 恢复音视频
301
+
302
+ ```js
303
+ trtcClient.resumePublish({
304
+ target: ['video', 'audio'],
305
+ });
306
+
307
+ ```
308
+
309
+ 9. 分页拉取成员列表
310
+
311
+ ```js
312
+
313
+ tcic.getMembersDetail(classId, {
314
+ page: 1,
315
+ limit: 100,
316
+ });
317
+
318
+ ```
319
+
320
+ 10. 自动播放成员音视频, 若学生未加入, 待学生加入后会自动播放
321
+
322
+ ```js
323
+ trtcClient.startRemote({
324
+ view: `dom-id`,
325
+ streamType: 'main',
326
+ userId: 'remote-user-id',
327
+ });
328
+ ```
329
+
330
+ 11. 结束房间
331
+
332
+ ```js
333
+ await tcic.end()
334
+ ```
335
+
336
+ ## API 参考
337
+
338
+ https://docs.qcloudclass.com/latest/tcic_engine/modules.html
339
+
340
+
341
+ ## RoadMap
342
+
343
+ SDK仍处在快速迭代开发中, 后续新版本将会发布基于signal的数据流SDK, 会进一步简化使用流程, 并加入更多增强丰富的能力,敬请期待.
@@ -0,0 +1,6 @@
1
+ export { TCIC_Bussiness } from './business.d';
2
+ export { TIM_MSG } from './business.d';
3
+ export { TCIC, MemberInfo, ClassInfoRes, MemberJoinedRes, SchoolInfoRes, Stream, TMemberActionParam, TMemberType, Member, ClassInfo, RoomInfo, CustomContent, RoleType, } from './tcic';
4
+ export { create, createTimClient, createTrtcClient, createTiw } from '.';
5
+ export { TCIC_IM, MsgData, MsgBody, MsgContent } from './mods/im';
6
+ export { TCIC_TRTC, RemoteVideoConfig, TRTCSupportResult } from './mods/trtc';
@@ -0,0 +1,41 @@
1
+ import { TCIC_IM } from './mods/im';
2
+ import { TCIC_TRTC } from './mods/trtc';
3
+ import { TCIC_TIW } from './mods/tiw';
4
+ import { TCIC } from './tcic';
5
+ import { debugFatory as Debug } from './utils';
6
+ /**
7
+ * @alpha
8
+ * @param opts - 创建TCIC实例,该实例会将房间依赖数据处理好,并暴露业务相关方法,后续的IM和TRTC实例都会依赖该实例
9
+ * @returns
10
+ */
11
+ export declare function create(opts: {
12
+ token: string;
13
+ userId: string;
14
+ classId: number;
15
+ playerConf?: any;
16
+ }): TCIC;
17
+ /**
18
+ * @alpha
19
+ * @param target - 创建IM实例对象,IM负责处理系统消息以及文字消息等逻辑。
20
+ * @returns
21
+ */
22
+ export declare function createTimClient(target: TCIC): TCIC_IM;
23
+ /**
24
+ * @alpha
25
+ * @param target - 创建TRTC实例对象,TRTC负责处理音视频相关逻辑。
26
+ */
27
+ export declare function createTrtcClient(target: TCIC): TCIC_TRTC;
28
+ /**
29
+ * @alpha
30
+ * @param tcic - create a whiteboard instance. whiteboard reference: https://doc.qcloudtiw.com/web/official/tutorial-tutorial-2-1.html
31
+ * @param domId - the dom id of the whiteboard container
32
+ */
33
+ export declare function createTiw(tcic: TCIC, domId: string): TCIC_TIW;
34
+ /**
35
+ * debug工厂函数
36
+ * @alpha
37
+ * @example - 使用方式如下:
38
+ * 'let debug = debugFatory('TC:IM')'
39
+ * debug('hello')
40
+ */
41
+ export declare const debugFatory: typeof Debug;
@@ -0,0 +1,20 @@
1
+ export declare const enum ClientErrorCode {
2
+ /**
3
+ * 业务逻辑错误,可以通过自行编码解决的错误
4
+ * 1000 - 1999
5
+ * 环境问题,需要通过 检测或者兼容完成
6
+ * 2000 - 2999
7
+ */
8
+ TCIC_NOT_INIT = 1002
9
+ }
10
+ export declare class MyError extends Error {
11
+ code: number;
12
+ msg: string;
13
+ data: any;
14
+ err: any;
15
+ constructor(opts: {
16
+ code?: number;
17
+ msg?: string;
18
+ data?: any;
19
+ });
20
+ }
@@ -0,0 +1,12 @@
1
+ export declare const enum ActionModule {
2
+ TCIC = "TCIC",
3
+ TRTC = "TRTC",
4
+ IM = "IM",
5
+ WHITEBOARD = "WHITEBOARD",
6
+ RECORD = "RECORD",
7
+ PLAYER = "PLAYER",
8
+ REPORT = "REPORT",
9
+ ERROR = "ERROR",
10
+ Webview = "Webview",
11
+ TIW = "TIW"
12
+ }
@@ -0,0 +1,83 @@
1
+ export declare const enum ActionName {
2
+ Init = "Init",
3
+ Join = "Join",
4
+ Leave = "Leave",
5
+ Start = "Start",
6
+ Stop = "Stop",
7
+ Pause = "Pause",
8
+ Resume = "Resume",
9
+ End = "End",
10
+ Error = "Error",
11
+ FetchData = "FetchData",
12
+ StopHeartBeat = "StopHeartBeat",
13
+ Destroy = "Destroy",
14
+ GetMyInfo = "GetMyInfo",
15
+ GetHostInfo = "GetHostInfo",
16
+ GetStreamConfig = "GetStreamConfig",
17
+ SetStreamConfigs = "SetStreamConfigs",
18
+ GetNativeParams = "GetNativeParams",
19
+ GenerateStaticCb = "GenerateStaticCb",
20
+ CallSuccess = "CallSuccess",
21
+ CallError = "CallError",
22
+ Call = "Call",
23
+ SetClientInfo = "SetClientInfo",
24
+ SendChannel = "SendChannel",
25
+ RemoteVideoAvailable = "RemoteVideoAvailable",
26
+ StartRemote = "StartRemote",
27
+ VideoPlayStateChanged = "VideoPlayStateChanged",
28
+ EnterRoom = "EnterRoom",
29
+ IsSupported = "IsSupported",
30
+ UpdateRemote = "UpdateRemote",
31
+ StopRemote = "StopRemote",
32
+ DestroyTcPlayer = "DestroyTcPlayer",
33
+ GetTcPlayerInstance = "GetTcPlayerInstance",
34
+ CheckRemoteReady = "CheckRemoteReady",
35
+ CreateTempTcplayerCont = "CreateTempTcplayerCont",
36
+ ReuseTcPlayer = "ReuseTcPlayer",
37
+ UnuseTcPlayer = "UnuseTcPlayer",
38
+ GetTcPlayerContId = "GetTcPlayerContId",
39
+ DoWeixinFirstPlay = "DoWeixinFirstPlay",
40
+ LocalPreview = "LocalPreview",
41
+ StopLocalPreview = "StopLocalPreview",
42
+ UnPublish = "UnPublish",
43
+ ResumePublish = "ResumePublish",
44
+ Mute = "Mute",
45
+ Unmute = "Unmute",
46
+ LeaveRoom = "LeaveRoom",
47
+ GetCameraList = "GetCameraList",
48
+ SwitchCamera = "SwitchCamera",
49
+ GetMicList = "GetMicList",
50
+ SwitchMic = "SwitchMic",
51
+ GetSpeakerList = "GetSpeakerList",
52
+ SetCurrentSpeaker = "SetCurrentSpeaker",
53
+ TEB_INIT = "TEB_INIT",
54
+ TEB_HISTROYDATA_SYNCCOMPLETED = "TEB_HISTROYDATA_SYNCCOMPLETED",
55
+ TEB_ERROR = "TEB_ERROR",
56
+ TEB_WARNING = "TEB_WARNING",
57
+ TEB_SYNCDATA = "TEB_SYNCDATA",
58
+ TEB_IMAGE_STATUS_CHANGED = "TEB_IMAGE_STATUS_CHANGED",
59
+ TEB_H5PPT_STATUS_CHANGED = "TEB_H5PPT_STATUS_CHANGED",
60
+ TEB_VIDEO_STATUS_CHANGED = "TEB_VIDEO_STATUS_CHANGED",
61
+ TEB_SWITCHFILE = "TEB_SWITCHFILE",
62
+ IM_PAYLOAD_PARSE_ERROR = "IM_PAYLOAD_PARSE_ERROR",
63
+ IM_SAASADMIN_DATA = "IM_SAASADMIN_DATA",
64
+ IM_CUSTOM_DATA = "IM_CUSTOM_DATA",
65
+ IM_TEXT_DATA = "IM_TEXT_DATA",
66
+ IM_MESSAGE_RECEIVED = "IM_MESSAGE_RECEIVED",
67
+ IM_SDK_READY = "IM_SDK_READY",
68
+ IM_LOGIN = "IM_LOGIN",
69
+ IM_UPDATE_MY_PROFILE = "IM_UPDATE_MY_PROFILE",
70
+ IM_JOIN_GROUP = "IM_JOIN_GROUP",
71
+ IM_ON = "IM_ON",
72
+ IM_OFF = "IM_OFF",
73
+ IM_CONSUME = "IM_CONSUME",
74
+ IM_WHEN_READY = "IM_WHEN_READY",
75
+ IM_DESTROY = "IM_DESTROY",
76
+ IM_SEND_MSG = "IM_SEND_MSG",
77
+ IM_SEND_ROOM_MSG = "IM_SEND_ROOM_MSG",
78
+ IM_SEND_ROOM_IMG_MSG = "IM_SEND_ROOM_IMG_MSG",
79
+ IM_SEND_ROOM_CUSTOM_MSG = "IM_SEND_ROOM_CUSTOM_MSG",
80
+ IM_SEND_MSG_TO_USER = "IM_SEND_MSG_TO_USER",
81
+ IM_SEND_IMG_TO_USER = "IM_SEND_IMG_TO_USER",
82
+ IM_GET_HISTORY_LIST = "IM_GET_HISTORY_LIST"
83
+ }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * 设备状态
3
+ * @enum {number}
4
+ */
5
+ export declare enum TDeviceStatus {
6
+ /**
7
+ * 打开失败
8
+ */
9
+ Fail = -1001,
10
+ /**
11
+ * 找不到设备
12
+ */
13
+ Not_Found = -1002,
14
+ /**
15
+ * 未授权
16
+ */
17
+ No_Permission = -1003,
18
+ /**
19
+ * 设备被占用
20
+ */
21
+ Busy = -1004,
22
+ /**
23
+ * 不支持
24
+ */
25
+ Not_Supported = -1005,
26
+ /**
27
+ * trtc 1204 错误,可能是被占用,也可能是其他原因 算作一种通用错误
28
+ */
29
+ Error_1204 = -1006,
30
+ /**
31
+ * 未知
32
+ */
33
+ Unknown = 0,
34
+ /**
35
+ * 已打开
36
+ */
37
+ Open = 1,
38
+ /**
39
+ * 已关闭
40
+ */
41
+ Closed = 2
42
+ }