@xylink/xy-rtc-sdk 3.9.11-private.6 → 4.0.0

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.
Files changed (124) hide show
  1. package/README.MD +36 -13
  2. package/lib/action/index.d.ts +106 -36
  3. package/lib/enum/analyser.d.ts +7 -0
  4. package/lib/enum/client.d.ts +8 -2
  5. package/lib/enum/constraints.d.ts +51 -0
  6. package/lib/enum/device.d.ts +28 -0
  7. package/lib/enum/errorCode.d.ts +8 -2
  8. package/lib/enum/i18n.d.ts +6 -0
  9. package/lib/enum/index.d.ts +90 -7
  10. package/lib/enum/meeting.d.ts +4 -0
  11. package/lib/enum/polling.d.ts +2 -11
  12. package/lib/feature/customMessage/index.d.ts +29 -0
  13. package/lib/feature/edu/index.d.ts +34 -0
  14. package/lib/feature/edu/index.type.d.ts +29 -0
  15. package/lib/feature/index.d.ts +3 -0
  16. package/lib/feature/speaker/index.d.ts +81 -0
  17. package/lib/feature/speaker/index.type.d.ts +17 -0
  18. package/lib/index.d.ts +84 -31
  19. package/lib/interface/baseModule.type.d.ts +9 -0
  20. package/lib/interface/clientInterface.type.d.ts +128 -0
  21. package/lib/interface/contentTrackInterface.type.d.ts +15 -0
  22. package/lib/interface/event.type.d.ts +444 -0
  23. package/lib/interface/videoAudioTrackInterface.type.d.ts +17 -0
  24. package/lib/main/ability/const.d.ts +5 -0
  25. package/lib/main/ability/index.d.ts +37 -0
  26. package/lib/main/{iauth.d.ts → auth/index.d.ts} +34 -26
  27. package/lib/main/client.d.ts +643 -637
  28. package/lib/main/clientBase.d.ts +40 -0
  29. package/lib/main/clientState.d.ts +56 -0
  30. package/lib/main/device/index.d.ts +272 -0
  31. package/lib/main/device/index.type.d.ts +204 -0
  32. package/lib/main/helper/index.d.ts +118 -0
  33. package/lib/main/helper/index.type.d.ts +12 -0
  34. package/lib/main/layout/index.d.ts +74 -108
  35. package/lib/main/layout/index.type.d.ts +282 -0
  36. package/lib/main/layout/polling.d.ts +17 -13
  37. package/lib/main/layout/state.d.ts +163 -0
  38. package/lib/main/layout/template.d.ts +3 -3
  39. package/lib/main/media/index.d.ts +177 -0
  40. package/lib/main/media/index.type.d.ts +29 -0
  41. package/lib/main/meeting/control.d.ts +107 -0
  42. package/lib/main/meeting/control.type.d.ts +24 -0
  43. package/lib/main/{meeting.d.ts → meeting/index.d.ts} +58 -28
  44. package/lib/main/meeting/verify.d.ts +70 -0
  45. package/lib/main/meeting/verify.type.d.ts +12 -0
  46. package/lib/main/peer.d.ts +67 -19
  47. package/lib/main/plugin/index.d.ts +28 -0
  48. package/lib/{tools/quality.d.ts → main/quality/index.d.ts} +2 -2
  49. package/lib/{tools → main/quality}/quality.worker.d.ts +1 -1
  50. package/lib/main/{qualityManager.d.ts → quality/report.d.ts} +11 -5
  51. package/lib/main/render/index.d.ts +116 -0
  52. package/lib/main/render/index.type.d.ts +36 -0
  53. package/lib/main/render/videoManager.d.ts +190 -0
  54. package/lib/main/render/videoManager.type.d.ts +66 -0
  55. package/lib/main/roster/index.d.ts +39 -0
  56. package/lib/main/server/index.d.ts +79 -0
  57. package/lib/main/server/index.type.d.ts +21 -0
  58. package/lib/main/signal/index.d.ts +15 -0
  59. package/lib/main/socket/index.d.ts +95 -0
  60. package/lib/main/stream/index.d.ts +182 -0
  61. package/lib/main/track/baseTrack.d.ts +178 -0
  62. package/lib/main/track/contentTrack.d.ts +168 -0
  63. package/lib/main/track/customContentTrack.d.ts +18 -0
  64. package/lib/main/track/customVideoAudioTrack.d.ts +18 -0
  65. package/lib/main/track/helper.d.ts +53 -0
  66. package/lib/main/track/videoAudioCapture.d.ts +90 -0
  67. package/lib/main/track/videoAudioTrack.d.ts +273 -0
  68. package/lib/main/vom/index.d.ts +44 -0
  69. package/lib/main/vom/index.type.d.ts +1 -0
  70. package/lib/tools/analyser.d.ts +53 -0
  71. package/lib/tools/analyserManager.d.ts +55 -0
  72. package/lib/tools/dbManager.d.ts +12 -1
  73. package/lib/tools/{browser.d.ts → detectBrowser/index.d.ts} +53 -5
  74. package/lib/tools/detectStream/index.d.ts +84 -0
  75. package/lib/tools/detectStream/index.type.d.ts +56 -0
  76. package/lib/tools/detectTool/index.d.ts +191 -0
  77. package/lib/tools/detectTool/index.type.d.ts +51 -0
  78. package/lib/tools/emitter.d.ts +27 -6
  79. package/lib/tools/enum.d.ts +1 -1
  80. package/lib/tools/httpClient.d.ts +23 -6
  81. package/lib/tools/i18n.d.ts +1 -1
  82. package/lib/tools/index.d.ts +5 -5
  83. package/lib/tools/{logger.d.ts → log/logger.d.ts} +59 -29
  84. package/lib/tools/{logger.worker.d.ts → log/logger.worker.d.ts} +1 -1
  85. package/lib/tools/log/loggerManager.d.ts +70 -0
  86. package/lib/tools/pressure/index.d.ts +33 -0
  87. package/lib/tools/pressure/index.type.d.ts +22 -0
  88. package/lib/tools/promiseQueue.d.ts +51 -0
  89. package/lib/tools/queue.d.ts +12 -15
  90. package/lib/tools/resize.d.ts +65 -0
  91. package/lib/tools/snapshot.d.ts +31 -0
  92. package/lib/tools/socket.d.ts +109 -32
  93. package/lib/tools/template/index.d.ts +3 -3
  94. package/lib/tools/template/mobile.d.ts +1 -1
  95. package/lib/tools/template/polling.d.ts +1 -1
  96. package/lib/tools/utils.d.ts +22 -19
  97. package/lib/tools/verify.d.ts +7 -0
  98. package/lib/type/ability.d.ts +25 -0
  99. package/lib/type/analyser.d.ts +43 -0
  100. package/lib/type/{iauth.d.ts → auth.d.ts} +22 -29
  101. package/lib/type/base.d.ts +41 -33
  102. package/lib/type/capture.d.ts +9 -0
  103. package/lib/type/client.d.ts +404 -498
  104. package/lib/type/index.d.ts +26 -2
  105. package/lib/type/layout.d.ts +25 -49
  106. package/lib/type/logger.d.ts +37 -12
  107. package/lib/type/meeting.d.ts +266 -27
  108. package/lib/type/peer.d.ts +24 -1
  109. package/lib/type/polling.d.ts +1 -49
  110. package/lib/type/quality.d.ts +16 -6
  111. package/lib/type/socket.d.ts +42 -0
  112. package/lib/type/stream.d.ts +154 -116
  113. package/lib/type/track.d.ts +139 -0
  114. package/lib/xyrtc.cjs.js +1 -1
  115. package/lib/xyrtc.umd.js +1 -1
  116. package/package.json +11 -3
  117. package/lib/enum/contraints.d.ts +0 -50
  118. package/lib/main/deviceManager.d.ts +0 -185
  119. package/lib/main/helper.d.ts +0 -79
  120. package/lib/main/stream.d.ts +0 -396
  121. package/lib/main/videoManager.d.ts +0 -57
  122. package/lib/tools/audioLevel.d.ts +0 -23
  123. package/lib/tools/detect.d.ts +0 -43
  124. package/lib/type/device.d.ts +0 -83
@@ -6,40 +6,38 @@
6
6
  * @email luojinghui424@gmail.com
7
7
  *
8
8
  * Created at : 2021-01-05 17:24:07
9
- * Last modified : 2024-04-19 15:14:09
9
+ * Last modified : 2024-06-18 11:10:00
10
10
  */
11
- import Logger from '../../tools/logger';
12
- import { ILayout, IVideoRenders, IRoster, IScreenInfo, IOutputCustomLayout, ILayoutRoster, IConfInfo, IPageInfo, VideoQuality, StreamResolutionLevel, TLayoutMap, TemplateMode, ContentTemplateMode, IMode, LayoutOrientationType, LayoutConfig, PollingState } from '../../type/index';
11
+ import { ILayout, IRoster, IScreenInfo, IOutputCustomLayout, ILayoutRoster, IConfInfo, IPageInfo, VideoQuality, StreamResolutionLevel, TLayoutMap, TemplateMode, IMode, LayoutOrientationType, LayoutConfig, PollingState, FocusViewConfig, LocalViewParams } from '../../type/index';
13
12
  import Client from '../client';
14
13
  import Polling from './polling';
14
+ import Logger from '../../tools/log/logger';
15
+ import { XYLayoutManagerState } from './state';
15
16
  export default class LayoutManager {
16
17
  logger: Logger;
17
18
  client: Client;
18
- customLayoutMap: TLayoutMap;
19
19
  layoutMap: TLayoutMap;
20
- private videoManagers;
21
- private originOrderRosters;
22
- private orderRosterList;
20
+ private sortedRosterList;
21
+ private layoutSortedRosterList;
23
22
  private selfRoster;
24
23
  private newLayoutList;
25
24
  private initLayout;
26
- private templateMode;
27
- private templateModeTemp;
28
25
  private templateRate;
29
26
  private content;
30
27
  private screenInfo;
31
28
  private internalsLayout;
32
- private forceFullScreenId;
33
29
  private localContent;
34
30
  private preConfInfo;
35
31
  private confInfo;
36
32
  private pageInfo;
37
- private isLocalShareContent;
38
33
  private templateManager;
39
34
  private focusViewConfig;
40
35
  private layoutOrientation;
41
- private layoutConfig;
42
- polling: Polling | null;
36
+ polling: Polling;
37
+ private localMirror;
38
+ private customLayoutCacheList;
39
+ private mediaManager;
40
+ private layoutState;
43
41
  constructor(client: Client);
44
42
  static getCustomLayoutItem(item: ILayout, resolution: StreamResolutionLevel, quality: VideoQuality): {
45
43
  pid: number | undefined;
@@ -47,36 +45,10 @@ export default class LayoutManager {
47
45
  quality: VideoQuality;
48
46
  mediagroupid: number;
49
47
  };
50
- /**
51
- * 是否开启/接收content
52
- */
53
- get isContentMode(): boolean;
54
- /**
55
- * 当前是否是对话模式,且没有发送或接收content。
56
- * content优先级大于对话模式
57
- *
58
- * @returns { boolean }
59
- */
60
- get isInDialogMode(): boolean;
61
- /**
62
- * 是否开启隐藏本地模式
63
- *
64
- * @returns { boolean }
65
- */
66
- get isEnableHideLocalView(): boolean;
67
- /**
68
- * 是否是主会场模式(远端设置为主会场)
69
- * 会控下发的chairmanUri标识当前会议设置了主会场,
70
- * 会控的chairmanUri有值时,媒体下发的chairManUrl才标识最终入会的主会场的CallUri
71
- *
72
- * @returns
73
- */
74
- get isChairmanMode(): boolean;
75
48
  getNewLayout(): ILayout[];
76
- getOrderRosterList(): IRoster[];
77
- getOriginOrderRosters(): IRoster[];
49
+ getLayoutSortedRosterList(): IRoster[];
50
+ getSortedRosterList(): IRoster[];
78
51
  getLayoutMap(): TLayoutMap;
79
- getCustomLayoutMap(): TLayoutMap;
80
52
  getTemplateRate(): {
81
53
  previous: number;
82
54
  next: number;
@@ -84,20 +56,26 @@ export default class LayoutManager {
84
56
  getContentRosterItem(): IRoster | null;
85
57
  getSelfRoster(): IRoster;
86
58
  getScreenInfo(): IScreenInfo;
87
- getVideoManagers(): IVideoRenders;
88
59
  getForceFullScreenId(): string;
89
- getTemplateMode(): TemplateMode | ContentTemplateMode;
60
+ getTemplateMode(): TemplateMode | import("../../type/index").ContentTemplateMode;
90
61
  getConfInfo(): IConfInfo;
91
62
  getInternalsLayout(): IOutputCustomLayout;
92
63
  getLocalShareState(): boolean;
93
64
  getFocusRoster(): IRoster | null;
65
+ getLayoutState(): XYLayoutManagerState;
66
+ getFocusViewConfig(): FocusViewConfig;
94
67
  getFocusViewId(): string;
95
68
  getLayoutOrientation(): LayoutOrientationType;
96
- getPolling(): Polling | null;
97
- getPollingState(): PollingState | undefined;
98
- setOrderRosterList(orderRosterList: IRoster[]): void;
99
- setOriginOrderRosters(originOrderRosters: IRoster[]): void;
100
- getUsedLayoutMap(): TLayoutMap;
69
+ getPolling(): Polling;
70
+ getPollingState(): PollingState;
71
+ setSortedRosterList(rosterList: IRoster[]): void;
72
+ /**
73
+ * 全屏请流
74
+ *
75
+ * @param { string } id - 需要强制全屏的Layout Id
76
+ * @returns { Promise<string> } - Roster Id
77
+ */
78
+ startForceFullScreen(id: string): Promise<string>;
101
79
  /**
102
80
  * 更新本地Roster数据
103
81
  *
@@ -138,35 +116,9 @@ export default class LayoutManager {
138
116
  /**
139
117
  * Video组件状态变更回调事件
140
118
  *
141
- * state === (roster当前状态 + 上一次的status)
142
- *
143
- * @param { string } id - 参会者Layout Id
144
- * @param { status: string; error?: any } data - 最新的会议状态 status === video track / video标签 监听到的状态
145
- */
146
- private onVideoStatusChange;
147
- /**
148
- * 设置画面渲染元素并播放Video画面
149
- *
150
119
  * @param { string } id - 参会者Layout Id
151
- * @param { string } wrapEleId - 包裹video组件的容器ID字段
152
- */
153
- setVideoRenderer(id: string, wrapEleId: string): void;
154
- /**
155
- * videoManagers 移除key对应的元素
156
- *
157
- * @param { string } id - 参会者Layout Id
158
- */
159
- removeVideoRenderer(id: string): void;
160
- /**
161
- * 播放本地画面
162
120
  */
163
- playLocalVideo(): Promise<void>;
164
- /**
165
- * 重新播放Video画面组件
166
- *
167
- * @param { string[]? } idList - Layout Id 列表
168
- */
169
- playVideo(idList?: string[]): Promise<void>;
121
+ onVideoStatusChange(id: string): void;
170
122
  /**
171
123
  * 切换布局方向
172
124
  *
@@ -188,22 +140,20 @@ export default class LayoutManager {
188
140
  */
189
141
  setFocusView(id: string): string;
190
142
  /**
191
- * 更新本地Video Track
143
+ * 设置本地视频渲染参数
144
+ *
145
+ * @param { LocalViewParams } params - 本地视频渲染参数
146
+ * @property { boolean } params.isMirror - 是否镜像展示
147
+ */
148
+ setLocalViewParams(params: LocalViewParams): Promise<void>;
149
+ /**
150
+ * 更新Local video track
192
151
  */
193
152
  updateLocalTrack(): void;
194
153
  /**
195
- * 获取Layout布局状态
196
- *
197
- * @returns { object }
154
+ * 更新轮询状态,当有高于轮询的状态过来时,需要重置状态
198
155
  */
199
- getLayoutState(): {
200
- isForceLayout: boolean;
201
- isInDialogMode: boolean;
202
- isContentMode: boolean;
203
- isPolling: boolean;
204
- isInPolling: boolean;
205
- isSwitchPollingPause: boolean;
206
- };
156
+ updatePollingState(): void;
207
157
  /**
208
158
  * [AUTO] 计算分页及请流信息
209
159
  */
@@ -237,19 +187,26 @@ export default class LayoutManager {
237
187
  *
238
188
  * @param { ILayoutRoster[] } totalLayoutResultList - layout数据
239
189
  */
240
- private createOrderRoster;
190
+ private createLayoutSortedRosterList;
241
191
  /**
242
192
  * [CUSTOM] 基于 new layout result 消息生成 customLayoutMap 数据,并diff对比更新数据
243
193
  *
244
194
  * @param { ILayoutRoster[] } totalLayoutResultList - layout数据
245
195
  */
246
196
  createCustomLayout(totalLayoutResultList: ILayoutRoster[]): void;
197
+ /**
198
+ * 创建自定义布局的LayoutMap数据
199
+ */
200
+ private initCustomLayoutMap;
247
201
  /**
248
202
  * [AUTO] : 基于 new layout result 消息生成 customLayoutMap 数据,并diff对比更新数据
249
203
  *
250
204
  * @param { ILayoutRoster[] } totalLayoutResultList - layout数据
251
205
  */
252
206
  createAutoLayout(totalLayoutResultList: ILayoutRoster[]): void;
207
+ /**
208
+ * 计算自动轮询layout数据
209
+ */
253
210
  createAutoPollingLayout(): void;
254
211
  /**
255
212
  * 创建Layout
@@ -257,9 +214,9 @@ export default class LayoutManager {
257
214
  createLayout(): void;
258
215
  sendContentRosterMessage(): void;
259
216
  /**
260
- * roster 排序
217
+ * Roster 排序
261
218
  */
262
- calculateOrderRosterList(): IRoster[];
219
+ calculateSortedRosterList(): IRoster[];
263
220
  /**
264
221
  * 设置焦点画面Roster
265
222
  */
@@ -305,7 +262,7 @@ export default class LayoutManager {
305
262
  /**
306
263
  * 计算Layout Container的容器信息
307
264
  */
308
- calculateScreenInfo(): void;
265
+ calculateScreenInfo(): this;
309
266
  /**
310
267
  * 计算Layout Container的容器信息
311
268
  *
@@ -320,6 +277,13 @@ export default class LayoutManager {
320
277
  * 轮询模式下:存在画面重复渲染、无符合条件终端(roster为空)等设备,需要合并数据
321
278
  */
322
279
  private createBaseLayout;
280
+ /**
281
+ * 根据配置,获取roster头像
282
+ *
283
+ * @param { IRoster } roster - 参会者信息
284
+ * @param { LayoutAvatarType } type - 头像类型
285
+ */
286
+ private getLayoutAvatar;
323
287
  /**
324
288
  * 清理无效的 layout 数据,重置状态
325
289
  */
@@ -327,13 +291,9 @@ export default class LayoutManager {
327
291
  /**
328
292
  * 基于最新的 videoTrackList 和 layoutResults 数据更新MediaStream内容
329
293
  *
330
- * @param { boolean } isAutoSendLayout - 是否上报Layout信息
294
+ * @param { boolean } isAutoSendLayout - 是否上报LayoutList信息,默认是true,上报信息
331
295
  */
332
296
  updateStreams(isAutoSendLayout?: boolean): void;
333
- /**
334
- * 清理失效的 video manager 数据
335
- */
336
- clearInvalidVideoManagers(): void;
337
297
  /**
338
298
  * 通过TrackId找到VideoStream和AudioStream
339
299
  *
@@ -344,7 +304,7 @@ export default class LayoutManager {
344
304
  /**
345
305
  * [AUTO] 计算位置信息
346
306
  */
347
- calculatePosition(): void;
307
+ calculatePosition(): this;
348
308
  /**
349
309
  * 计算位置信息
350
310
  *
@@ -356,15 +316,22 @@ export default class LayoutManager {
356
316
  /**
357
317
  * [AUTO] 计算旋转信息
358
318
  */
359
- calculateRotate(): void;
319
+ calculateRotate(): this;
360
320
  /**
361
- * 【内部方法】停止轮询时,清理无效的 videoManager 数据
321
+ * [CUSTOM_LAYOUT] 合并自定义布局旋转信息
322
+ */
323
+ calculateCustomLayoutRotate(): void;
324
+ /**
325
+ * 通过rotationId获取Layout数据
362
326
  *
363
- * @param monitoryList callUri list 数据
327
+ * @param { string } rotationId - rotationId,由RotationInfo信息中的participantId + mediagroupid组合
328
+ * @returns { ILayout | null }
364
329
  */
365
- clearVideoManagersUseMonitorList(monitoryList: string[]): void;
330
+ private getLayoutByRotationId;
366
331
  /**
367
332
  * 根据roster信息计算请流信息, 对话模式仅支持对称布局
333
+ *
334
+ * 对话模式不支持翻页,最多显示9画面,所以从20路roster获取符合条件的roster即可
368
335
  */
369
336
  private calcRequestNewLayoutByRoster;
370
337
  /**
@@ -388,13 +355,6 @@ export default class LayoutManager {
388
355
  * 镜像显示Local画面
389
356
  */
390
357
  private localMirrorRotate;
391
- /**
392
- * 根据layout名称 获得 对应的 名称头像
393
- *
394
- * @param { string } displayName layout名称
395
- * @returns { string } 名称头像 文字内容
396
- */
397
- private getLayoutTextAvatar;
398
358
  /**
399
359
  * [AUTO] 全屏请流
400
360
  */
@@ -409,6 +369,12 @@ export default class LayoutManager {
409
369
  * @param { LayoutConfig } config
410
370
  */
411
371
  setLayoutConfig(config: LayoutConfig): void;
372
+ /**
373
+ * 发布 自动布局/自定义布局 layout布局信息(参会人最新的布局列表数据)
374
+ *
375
+ * @param { boolean } isDealAvatar - 是否处理layout头像, 启用相关配置后,默认处理
376
+ */
377
+ sendLayoutMessage(isDealAvatar?: boolean): void;
412
378
  /**
413
379
  * 查找对应的roster
414
380
  *
@@ -0,0 +1,282 @@
1
+ /**
2
+ * XYWebRTC Layout Type Defined
3
+ *
4
+ * Created at : 2024-06-04 16:04:55
5
+ * Last modified : 2024-06-04 16:47:00
6
+ */
7
+ import { XYLayoutState } from '../render/videoManager.type';
8
+ import { AutoState } from '../../type/polling';
9
+ /**
10
+ * 设备类型
11
+ *
12
+ * @param webrtc - WebRTC终端
13
+ * @param soft - 软件APP终端
14
+ * @param hard - 硬件终端
15
+ * @param nemono - 小鱼终端
16
+ * @param virtualnemo - 虚拟小鱼终端
17
+ * @param nemo - 小鱼终端
18
+ * @param tvbox - 大型硬件终端
19
+ * @param h323 - H323终端
20
+ * @param record - 虚拟录制终端
21
+ * @param bruce - 大鱼硬件终端
22
+ * @param tel - 手机终端
23
+ * @param pstngw - PSTN终端
24
+ * @param desk - 桌面应用终端
25
+ */
26
+ export type XYDeviceType = 'webrtc' | 'soft' | 'hard' | 'nemono' | 'virtualnemo' | 'nemo' | 'tvbox' | 'h323' | 'record' | 'bruce' | 'tel' | 'pstngw' | 'desk';
27
+ /**
28
+ * Layout头像类型
29
+ *
30
+ * @param NONE -1 - 无头像
31
+ * @param TEXT 0 - 名称头像
32
+ * @param IMAGE 1 - 人物头像
33
+ */
34
+ export declare enum LayoutAvatarType {
35
+ NONE = -1,
36
+ TEXT = 0,
37
+ IMAGE = 1
38
+ }
39
+ /**
40
+ * 视频关闭原因
41
+ *
42
+ * @param MuteByUser - 用户自己关闭
43
+ * @param MuteByBWLimit - 带宽限制
44
+ * @param MuteByNoInput - 没有视频输入
45
+ * @param MuteByConfMgmt - 会控关闭
46
+ * @param MuteByDeviceDetection - 设备探测
47
+ * @param MuteByPhoneCall - 电话占用
48
+ */
49
+ export declare enum MuteReason {
50
+ MuteByUser = 0,
51
+ MuteByBWLimit = 1,
52
+ MuteByNoInput = 2,
53
+ MuteByConfMgmt = 3,
54
+ MuteByDeviceDetection = 4,
55
+ MuteByPhoneCall = 5
56
+ }
57
+ /**
58
+ * Layout Result布局结果中返回的基础数据
59
+ *
60
+ * @property { number } participantId 参会者id
61
+ * @property { 0 | 1 } mediagroupid 参会者画面类型,0:people画面,1:共享内容画面
62
+ * @property { string } remoteType 设备类型
63
+ * @property { string } remoteName 参会者名称
64
+ * @property { string } videoTrackId 当前参会者画面Track轨道id,用于在 VideoTrackList 中匹配stream数据
65
+ * @property { boolean } isAudioMute 参会者麦克风状态,true:开启,false:关闭
66
+ * @property { boolean } isVideoMute 参会者摄像头状态,true:开启,false:关闭
67
+ * @property { boolean } isActiveSpeaker 参会者是否是语音激励,即当前会中说话声音最大的一个人
68
+ * @property { number } LayoutVideoState 参会者画面的状态:请求中,正常,电话入会,视频暂停等
69
+ * @property { number } MuteReason 视频关闭原因
70
+ * @property { number } extUserId 参会者ID
71
+ * @property { string } calluri 参会者Url
72
+ * @property { number } ExpectHeight 期望分辨率
73
+ * @property { number } ExpectWidth 期望分辨率
74
+ * @property { number } feccOri ignore
75
+ */
76
+ export interface ILayoutRoster {
77
+ participantId: number;
78
+ mediagroupid: number;
79
+ remoteType: string;
80
+ remoteName: string;
81
+ videoTrackId: string;
82
+ isAudioMute: boolean;
83
+ isVideoMute: boolean;
84
+ isActiveSpeaker: boolean;
85
+ LayoutVideoState: number;
86
+ MuteReason: MuteReason;
87
+ extUserId: string;
88
+ calluri: string;
89
+ ExpectHeight: number;
90
+ ExpectWidth: number;
91
+ feccOri: number;
92
+ }
93
+ /**
94
+ * Roster:参会者的基本信息,包含基本信息,设备信息,画面信息等
95
+ *
96
+ * @property { string } key - 内部Key,包含参会者endpointId、多分组通道信息,由一定规则生成;
97
+ * @property { IDeviceType } deviceType - 设备类型
98
+ * @property { string } endpointId - 设备ID
99
+ * @property { string } displayName - 参会者名称
100
+ * @property { number } mediagroupid - 参会者画面类型,0:people画面,1:共享内容画面
101
+ * @property { number } participantId - 参会者人员临时ID,迁会之后此ID会发生变化
102
+ * @property { boolean } audioTxMute - 参会者麦克风状态,true:开启,false:关闭
103
+ * @property { boolean } videoTxMute - 参会者摄像头状态,true:开启,false:关闭
104
+ * @property { boolean } isForceFullScreen - 参会者是否是主画面
105
+ * @property { boolean } isFocusScreen - 参会者是否是焦点画面
106
+ * @property { number } videoMuteReason - 视频关闭原因
107
+ * @property { boolean } isContent - 参会者画面类型,同mediagroupid,true:是共享内容画面,false:people画面
108
+ * @property { boolean } isActiveSpeaker - 参会者是否是语音激励,即当前会中说话声音最大的一个人
109
+ * @property { boolean } isLocal - 是否是Local设备
110
+ * @property { boolean } audioRxMute - ignore
111
+ * @property { boolean } videoRxMute - ignore
112
+ * @property { boolean } onHold - ignore
113
+ * @property { boolean } isLastAdd - ignore
114
+ * @property { boolean } isPolling - ignore
115
+ */
116
+ export interface IRoster extends Partial<ILayoutRoster> {
117
+ key: string;
118
+ deviceType: XYDeviceType;
119
+ endpointId: string;
120
+ displayName: string;
121
+ mediagroupid: number;
122
+ participantId: number;
123
+ audioTxMute: boolean;
124
+ videoTxMute: boolean;
125
+ audioRxMute: boolean;
126
+ videoRxMute: boolean;
127
+ videoMuteReason: number;
128
+ isForceFullScreen: boolean;
129
+ isFocusScreen: boolean;
130
+ isLastAdd: boolean;
131
+ onHold: boolean;
132
+ isPolling: boolean;
133
+ isContent: boolean;
134
+ isActiveSpeaker: boolean;
135
+ isLocal?: boolean;
136
+ }
137
+ /**
138
+ * 参会者布局详细数据
139
+ *
140
+ * @property { string } id - Layout ID,布局唯一ID
141
+ * @property { IRoster } roster - 参会者基本信息、状态信息,例如:用户名、麦克风/摄像头状态、是否是主会场等信息
142
+ * @property { XYLayoutState } state - 当前参会者的画面状态信息
143
+ * @property { IRotateStyle | null } rotate - 当前参会者的旋转信息,用于设置video标签样式
144
+ * @property { IRotationInfoTotalItem | null } rotationInfo - 当前参会者的旋转信息
145
+ * @property { LayoutAvatar | null } avatar - 头像, 如未在setFeatureConfig配置相关参数,则返回null
146
+ * @property { XYPositionStyle } positionStyle - Layout成员布局位置样式
147
+ * @property { boolean } isMirror - 是否是镜像画面
148
+ * @property { ExternalTemplateConfig } templateConfig - 模版额外配置
149
+ * @property { number[] } position - 位置坐标,分别是左,上,宽,高
150
+ * @property { XYPositionInfo } positionInfo - Layout成员布局位置 分别是:宽、高
151
+ * @property { number } index - 索引值
152
+ * @property { AutoState } pollingState - 轮询多画面状态
153
+ * @property { string } pollingName - 多画面名称
154
+ * @property { number } resolution - 忽略, 2.0.2以前的版本 自定义布局roster请流使用
155
+ * @property { number } quality - 忽略, 2.0.2以前的版本 自定义布局roster请流使用
156
+ * @property { boolean } deal - 是否处理此数据
157
+ */
158
+ export interface ILayout {
159
+ id: string;
160
+ roster: IRoster | null;
161
+ state: XYLayoutState;
162
+ rotate: IRotateStyle | null;
163
+ rotationInfo: IRotationInfoTotalItem | null;
164
+ avatar: LayoutAvatar | null;
165
+ positionStyle?: XYPositionStyle;
166
+ isMirror?: boolean;
167
+ templateConfig?: ExternalTemplateConfig;
168
+ position?: number[];
169
+ positionInfo?: XYPositionInfo;
170
+ index?: number;
171
+ pollingState?: AutoState;
172
+ pollingName?: string;
173
+ resolution?: number;
174
+ quality?: number;
175
+ deal?: boolean;
176
+ }
177
+ /**
178
+ * Layout成员布局位置
179
+ * 分别是:宽、高
180
+ *
181
+ * @property { number } width - 当前画面的宽度
182
+ * @property { number } height - 当前画面的高度
183
+ */
184
+ export interface XYPositionInfo {
185
+ width: number;
186
+ height: number;
187
+ }
188
+ /**
189
+ * Layout成员布局位置样式
190
+ * 分别是:左、上、宽、高
191
+ *
192
+ * @property { string } left - 当前画面距离左的像素位置
193
+ * @property { string } top - 当前画面距离上的像素位置
194
+ * @property { string } width - 当前画面宽度,单位px
195
+ * @property { string } height - 当前画面高度,单位px
196
+ *
197
+ */
198
+ export interface XYPositionStyle {
199
+ left: string;
200
+ top: string;
201
+ width: string;
202
+ height: string;
203
+ }
204
+ /**
205
+ * Video元素旋转样式
206
+ *
207
+ * @property { string } transform - Video元素选转角度:rotateZ(${n}deg)
208
+ * @property { string } width - Video元素的宽:${n}px
209
+ * @property { string } height - Video元素的高:${n}px
210
+ */
211
+ export interface IRotateStyle {
212
+ transform?: string;
213
+ width?: string;
214
+ height?: string;
215
+ }
216
+ /**
217
+ * 画面屏幕旋转信息
218
+ *
219
+ * @property { number } height - 高度
220
+ * @property { number } width - 宽度
221
+ * @property { number } participantId - 用户id
222
+ * @property { number } rotation - 旋转角度
223
+ * @param 0 | 1 不需要旋转
224
+ * @param 2 顺时针旋转180度
225
+ * @param 3 顺时针旋转270度
226
+ */
227
+ export interface IRotationInfoItem {
228
+ height: number;
229
+ width: number;
230
+ participantId: number;
231
+ rotation: number;
232
+ }
233
+ /**
234
+ * 缓存content+people的屏幕旋转信息数据
235
+ *
236
+ * @property { number } mediagroupid 画面类型:people/content
237
+ * @property { string } id 用户id
238
+ */
239
+ export interface IRotationInfoTotalItem extends IRotationInfoItem {
240
+ mediagroupid: number;
241
+ id: string;
242
+ }
243
+ /**
244
+ * 缓存媒体下发的屏幕旋转信息
245
+ *
246
+ * @property { IRotationInfoItem[] } content content共享内容的旋转信息
247
+ * @property { IRotationInfoItem[] } people people的旋转信息
248
+ * @property { IRotationInfoTotalItem[] } total content+people的旋转信息
249
+ */
250
+ export interface IRotationInfo {
251
+ content: IRotationInfoItem[];
252
+ people: IRotationInfoItem[];
253
+ total: IRotationInfoTotalItem[];
254
+ }
255
+ /**
256
+ * 头像
257
+ *
258
+ * @property { LayoutAvatarType } type - 头像类型,名称头像、人物头像
259
+ * @property { string } value - 内容
260
+ */
261
+ export interface LayoutAvatar {
262
+ type: LayoutAvatarType;
263
+ value: string;
264
+ }
265
+ /**
266
+ * 模版额外配置
267
+ *
268
+ * @property { string } id - templateId (模版名称_画面数量_第几个画面)
269
+ * @property { boolean } isPIP - 是否在画中画
270
+ * @property { boolean } isRotate - 是否要适配旋转
271
+ * @property { number } zIndex - 层级
272
+ * @property { Record<string, string | number> } customStyle - 自定义样式
273
+ * @property { boolean } isMain - 是否是大画面
274
+ */
275
+ export interface ExternalTemplateConfig {
276
+ id?: string;
277
+ isPIP?: boolean;
278
+ isRotate?: boolean;
279
+ zIndex?: number;
280
+ customStyle?: Record<string, string | number>;
281
+ isMain?: boolean;
282
+ }
@@ -5,10 +5,10 @@
5
5
  * @author JingHui Luo <luojinghui424@gmail.com>
6
6
  *
7
7
  * Created at : 2024-02-26 14:47:53
8
- * Last modified : 2024-04-19 14:11:30
8
+ * Last modified : 2024-06-18 16:26:25
9
9
  */
10
10
  import LayoutManager from './index';
11
- import { IBulkRoster, ICustomizedLayout, IRoster, PollingLayout, PollingState } from '../../type';
11
+ import { ICustomizedLayout, ILayout, IRoster, PollingState } from '../../type/index';
12
12
  import Client from '../client';
13
13
  export default class Polling {
14
14
  pollingMessage: ICustomizedLayout | null;
@@ -20,7 +20,6 @@ export default class Polling {
20
20
  private skipMuteVideo;
21
21
  private skipUnjoined;
22
22
  private layoutManager;
23
- private fullRosterMap;
24
23
  private specifiedMap;
25
24
  private speakerItem;
26
25
  private autoPollingMap;
@@ -34,9 +33,15 @@ export default class Polling {
34
33
  private isForceUpdateMode;
35
34
  private cacheIsPolling;
36
35
  constructor(client: Client, layout: LayoutManager);
37
- getOrderRoster(): IRoster[] | undefined;
36
+ getOrderRoster(): IRoster[];
38
37
  getPollingState(): PollingState;
39
- getPollingLayout(): PollingLayout[];
38
+ getPollingLayout(): ILayout[];
39
+ /**
40
+ * 处理轮询多画面消息
41
+ *
42
+ * @param { string } customizedLayout - 轮询多画面消息字符串
43
+ */
44
+ handleCustomizedLayout(customizedLayout: string): void;
40
45
  /**
41
46
  * 接收/处理会控轮询多画面消息,更新缓存数据
42
47
  *
@@ -90,6 +95,12 @@ export default class Polling {
90
95
  * @param { number } i - 索引位
91
96
  */
92
97
  private setPollingLayoutTemplate;
98
+ /**
99
+ * 获取当前全量roster信息Map
100
+ *
101
+ * @returns { Map<string, IRoster> } 结果
102
+ */
103
+ private getBulkRosterMap;
93
104
  /**
94
105
  * 设置轮询多画面项Roster和ID数据
95
106
  *
@@ -184,15 +195,8 @@ export default class Polling {
184
195
  /**
185
196
  * 订阅Roster变更消息
186
197
  *
187
- * @param { IBulkRoster } params - 数据内容
188
- */
189
- setBulkRoster(params: IBulkRoster): void;
190
- /**
191
- * 追加新增加的Roster数据
192
- *
193
- * @param { IRoster[] } addRosterInfo - 新增Roster列表数据
194
198
  */
195
- private appendFullRoster;
199
+ handleRosterWithPolling(): void;
196
200
  /**
197
201
  * 接收到LayoutResult后,更新模版
198
202
  */