@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
@@ -0,0 +1,40 @@
1
+ /**
2
+ * XYLink WebRTC Client Base Lib
3
+ *
4
+ * @summary SDK IMPLEMENTS LIB
5
+ * @author JingHui Luo <luojinghui424@gmail.com>
6
+ *
7
+ * Created at : 2024-04-22 15:20:15
8
+ * Last modified : 2024-07-08 19:53:07
9
+ */
10
+ import Emitter from '../tools/emitter';
11
+ import Logger from '../tools/log/logger';
12
+ import { IClientConfig, XYClientEventKey } from '../type/index';
13
+ export declare class XYRTCClientBase extends Emitter<XYClientEventKey | string> {
14
+ protected config: IClientConfig;
15
+ protected logger: Logger;
16
+ constructor(config: IClientConfig, logger: Logger);
17
+ /**
18
+ * 客户端推送Event消息
19
+ *
20
+ * @param { XYClientEventKey } key - 事件的Key
21
+ * @param { T[] } args - 需要推送的数据内容
22
+ */
23
+ emitMessage<T>(key: XYClientEventKey, ...args: T[]): void;
24
+ /**
25
+ * 注册客户端监听事件
26
+ * 调用时机:初始化SDK后,登录之前注册
27
+ * 关联内容:XYRTCClient事件
28
+ *
29
+ * @param { XYClientEventKey | string } key - 事件的Key
30
+ * @param { Function } listener - 事件回调函数
31
+ * @param { number? } total - 可选,回调函数触发次数,默认是-1,表示无限制
32
+ */
33
+ on(key: XYClientEventKey | string, listener: Function, total?: number): void;
34
+ /**
35
+ * 取消监听事件
36
+ *
37
+ * @param { XYDeviceEventKey | XYTrackEventKey } key - 监听器key
38
+ */
39
+ off(key: XYClientEventKey): void;
40
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * XYLink WebRTC Client State Lib
3
+ *
4
+ * Created at : 2024-04-22 15:45:36
5
+ * Last modified : 2024-05-17 19:06:08
6
+ */
7
+ import { ICodeList, XYBaseModule } from '../type/index';
8
+ import Action from '../action/index';
9
+ export default class XYClientState implements XYBaseModule {
10
+ private errorcode;
11
+ private i18nCode;
12
+ destroy(): void;
13
+ getErrorCode(): ICodeList;
14
+ getI18nCode(): ICodeList;
15
+ /**
16
+ * 设置国际化i8n列表
17
+ *
18
+ * @param { ICodeList } code - 国际化列表
19
+ */
20
+ setI18nCode(code: ICodeList): void;
21
+ /**
22
+ * 获取指定Key的国际化消息
23
+ *
24
+ * @param { string } key - 消息Key
25
+ * @returns { string } - 返回国际化消息
26
+ */
27
+ getI18nMessage(key: string): string;
28
+ /**
29
+ * 获取指定Key的错误消息
30
+ *
31
+ * @param { string } key - 消息Key
32
+ * @returns { string } - 返回错误码消息
33
+ */
34
+ getErrorCodeMessage(key: string): string;
35
+ /**
36
+ * 设置错误码列表
37
+ *
38
+ * @param { ICodeList } code - 错误码列表
39
+ */
40
+ setErrorCode(code: ICodeList): void;
41
+ /**
42
+ * 获取链接内容
43
+ *
44
+ * @param { string } configName - 'errorcode' | 'i18n'
45
+ * @param { object } data - 数据
46
+ * @param { object } oldData - 历史数据
47
+ * @param { Action } action - Action实例
48
+ */
49
+ getCodeByJson(configName: string, data: {
50
+ version: string;
51
+ link: string;
52
+ }, oldData: {
53
+ version: string;
54
+ link: string;
55
+ }, action: Action): Promise<void>;
56
+ }
@@ -0,0 +1,272 @@
1
+ /**
2
+ * XYLink WebRTC Device & Permission Manager Lib
3
+ *
4
+ * DESIGN NOTES: https://nones.xylink.com/wiki/#/team/AQzvsooq/space/SLqJDsvD/page/TXNaSayk
5
+ *
6
+ * @summary device and permission manager
7
+ * @author Jinghui-Luo<luojinghui424@gamil.com>、ChengFei
8
+ *
9
+ * Created at : 2020-11-26 14:41:51
10
+ * Last modified : 2024-06-20 14:54:13
11
+ */
12
+ import Logger from '../../tools/log/logger';
13
+ import Emitter from '../../tools/emitter';
14
+ import { IDeviceInfo, IDeviceList, ICurrentPermission, PermissionType, FacingMode, DEVICE_KIND, IDeviceId, ISetSpecDevice, IUsedDeviceParams, ISpecStateParams, XYDeviceEventKey } from '../../type/index';
15
+ /**
16
+ * DeviceManager模块,用于管理枚举设备列表、监听设备变动、处理设备权限等功能
17
+ *
18
+ * @class DeviceManager
19
+ * @extends Emitter 事件发送器
20
+ */
21
+ declare class DeviceManager extends Emitter<XYDeviceEventKey> {
22
+ private navigator;
23
+ logger: Logger;
24
+ isNewLogger: boolean;
25
+ private currentPermission;
26
+ private permissionCameraStatus;
27
+ private permissionPhoneStatus;
28
+ private previousDeviceList;
29
+ private currentDeviceList;
30
+ private fullDeviceList;
31
+ private systemDefaultDevice;
32
+ private specifiedDevice;
33
+ private usedDeviceId;
34
+ private cacheUsedDeviceId;
35
+ private systemDefaultDeviceId;
36
+ private specifiedDefaultDeviceId;
37
+ private deviceLabelMap;
38
+ private onDeviceChangeEvent;
39
+ private onUpdateFullDeviceList;
40
+ constructor(logger?: Logger);
41
+ /**
42
+ * 获取设备权限数据
43
+ */
44
+ getDevicePermission(): ICurrentPermission;
45
+ /**
46
+ * 初始化设备列表和设备权限状态及监听事件
47
+ *
48
+ * 调用时机:MakeCall时调用、当前实例被创建时
49
+ */
50
+ initDeviceAndPermission(): Promise<void>;
51
+ /**
52
+ * 计算并缓存系统默认、指定设备两种类型设备的默认值
53
+ *
54
+ * @param { DEVICE_KIND } kind - 设备类型
55
+ */
56
+ calculateDefaultDevice(kind: DEVICE_KIND): void;
57
+ /**
58
+ * 计算并缓存系统默认、指定设备两种类型设备的默认值
59
+ *
60
+ * @param { IDefaultDeviceIdParams } params - 初始化参数
61
+ * @returns { systemDefaultDevice, specifiedDefaultDevice } - 默认设备、指定默认设备的值
62
+ */
63
+ private getDefaultDeviceImpl;
64
+ /**
65
+ * Diff新旧设备列表,寻找到可用的默认设备
66
+ *
67
+ * 如果是新增设备,则diff设备列表,找到第一个最新的设备
68
+ *
69
+ * @param { IDeviceInfo[] } preDeviceList - 上一次的设备列表
70
+ * @param { IDeviceInfo[] } curDeviceList - 最新的设备列表
71
+ * @return { IDeviceInfo | null } 默认设备
72
+ */
73
+ private diffDefaultDevice;
74
+ /**
75
+ * 获取默认设备ID数据
76
+ *
77
+ * 区分两种类型:
78
+ * 1、系统默设备模式,则获取系统默认设备
79
+ * 2、指定设备模式,则根据指定设备获取对应默认分配的设备
80
+ */
81
+ getDefaultDeviceId(): IDeviceId;
82
+ /**
83
+ * 获取采集音视频流时需要指定的设备信息
84
+ */
85
+ getCaptureDeviceId(): IDeviceId;
86
+ /**
87
+ * 缓存用户选择的设备数据,也可用作判断用户是否选择:默认系统设备
88
+ * 注意:如果用户设置的DeviceID不存在,也会持久缓存,不会做设备真实性校验
89
+ *
90
+ * @param { ISetSpecDevice } deviceList - 需要指定的设备信息
91
+ */
92
+ setSpecifiedDeviceId(deviceList: ISetSpecDevice[]): void;
93
+ /**
94
+ * 标记指定设备时采集此设备的状态
95
+ *
96
+ * @param { ISpecStateParams[] } stateList - 批量更新指定设备采集状态
97
+ */
98
+ setSpecifiedDeviceState(stateList: ISpecStateParams[]): void;
99
+ /**
100
+ * 基于MediaStream获取真实的设备信息,更新到设备列表
101
+ *
102
+ * @param { IUsedDeviceParams } deviceList - 正在使用的设备信息,可以提供一组数据
103
+ */
104
+ updateUsedDeviceId(deviceList: IUsedDeviceParams[]): Promise<void>;
105
+ /**
106
+ * 获取指定ID对应的真实DeviceId值
107
+ *
108
+ * @param { IDeviceInfo[] } deviceList - 全量设备列表
109
+ * @param { string } deviceId - 指定设备ID
110
+ * @param { string } defaultId - 默认设备ID
111
+ * @returns { string } 设备ID
112
+ */
113
+ private getReallyDeviceIdById;
114
+ /**
115
+ * 获取指定ID对应的真实DeviceId值
116
+ *
117
+ * @param { DEVICE_KIND } kind - 设备类型
118
+ * @param { string } deviceId - 指定设备ID
119
+ * @returns { string } 设备ID
120
+ */
121
+ getReallyDeviceId(kind: DEVICE_KIND, deviceId: string): string;
122
+ /**
123
+ * 更新全量设备列表
124
+ */
125
+ updateFullDeviceList(): Promise<void>;
126
+ /**
127
+ * 设置输出设备
128
+ *
129
+ * @param { * } element - Audio元素节点
130
+ * @param { string } deviceId - 切换的设备ID,可能包含DEFAULT设备
131
+ */
132
+ setAudioOutputDevice(element: any, deviceId: string): Promise<void>;
133
+ /**
134
+ * 更新指定设备的状态
135
+ */
136
+ private resetSpecifiedDeviceState;
137
+ /**
138
+ * 获取基础设备列表
139
+ * 注意:不包含DEFAULT系统默认设备,会在最后一步合并
140
+ *
141
+ * @returns { Promise<IDeviceList> } 过滤无效后的基础设备列表
142
+ */
143
+ private createBaseDeviceList;
144
+ /**
145
+ * 获取基础的设备列表
146
+ *
147
+ * @return { Promise<IDeviceList> } 设备列表
148
+ */
149
+ getOriginDeviceList(): Promise<IDeviceList>;
150
+ /**
151
+ * 过滤虚拟设备和通讯设备
152
+ *
153
+ * @param { IDeviceList } deviceList - 设备列表
154
+ */
155
+ private filterInvalidDevice;
156
+ /**
157
+ * 过滤默认设备,并将默认设备对应的真实设备找到并缓存
158
+ *
159
+ * @param { IDeviceList } deviceList - 设备列表
160
+ */
161
+ private filterDefaultDevice;
162
+ private filterDevice;
163
+ /**
164
+ * 追加系统默认设备选项
165
+ */
166
+ private appendSystemDefaultDevice;
167
+ /**
168
+ * 缓存默认设备对应的真实设备数据
169
+ * 从BaseDeviceList中寻找到default设备对应的真实设备
170
+ *
171
+ * @param { IDeviceInfo } defaultDevice - 默认设备
172
+ * @param { IDeviceInfo[] } deviceList - 设备列表
173
+ */
174
+ private setDefaultDevice;
175
+ /**
176
+ * 更新最新的设备列表中的选中状态(isSelected),元配置数据(originLabel, originDeviceId)
177
+ */
178
+ private updateFullDeviceListStatus;
179
+ /**
180
+ * 基于各状态更新最终的设备状态信息
181
+ *
182
+ * @param { IDeviceInfo[] } devices - 全量设备列表
183
+ * @param { ISpecifiedDeviceConfig } specifiedDevice - 指定的设备信息
184
+ * @param { string } usedId - 正在使用的设备信息
185
+ * @param { string } defaultId - 两种模式的默认设备信息
186
+ * @param { string } systemDefaultDeviceId - 系统默认设备
187
+ * @returns
188
+ */
189
+ private updateDevice;
190
+ /**
191
+ * 通过DeviceId获取设备详情信息
192
+ *
193
+ * @param { IDeviceInfo[] } devices - 全量设备列表
194
+ * @param { string } deviceId - 设备ID
195
+ * @returns { IDeviceInfo | null } 设备信息
196
+ */
197
+ private getDeviceByDeviceId;
198
+ /**
199
+ * 通过对比,获取到即将切换的设备数据
200
+ *
201
+ * @returns { ISelectedDevice } 即将切换的设备
202
+ */
203
+ private createNextDevice;
204
+ /**
205
+ * 更新计算系统默认和指定默认设备数据
206
+ */
207
+ private updateDefaultDeviceId;
208
+ /**
209
+ * 创建全量设备列表
210
+ */
211
+ private createFullDeviceList;
212
+ /**
213
+ * 设备变化监听函数
214
+ */
215
+ private onDeviceChange;
216
+ /**
217
+ * 初始化设备监听函数
218
+ */
219
+ private initDeviceEvent;
220
+ /**
221
+ * 移除设备监听函数
222
+ */
223
+ private removeDeviceEvent;
224
+ /**
225
+ * 获取手机前置/后置摄像头
226
+ *
227
+ * @param { FacingMode } type - 摄像头类型,可选:FRONT、BACK,分辨是前置摄像头还是后置摄像头
228
+ * @returns { IDeviceInfo } 摄像头信息
229
+ */
230
+ getCameraDeviceByMode(type: FacingMode): Promise<IDeviceInfo>;
231
+ /**
232
+ * 设置当前麦克风/摄像头权限
233
+ *
234
+ * @param { ICurrentPermission } permission - 新的权限状态
235
+ */
236
+ setDevicePermission(permission: ICurrentPermission): void;
237
+ /**
238
+ * 通过采集能力更新设备权限
239
+ *
240
+ * @param { PermissionType } video - 摄像头权限
241
+ * @param { PermissionType } audio - 麦克风权限
242
+ */
243
+ updateDevicePermission(video: PermissionType, audio: PermissionType): void;
244
+ /**
245
+ * 查询权限接口
246
+ *
247
+ * @param { 'microphone' | 'camera' } type - 需要检测的设备类型
248
+ */
249
+ private query;
250
+ /**
251
+ * 监听权限变更
252
+ *
253
+ * @param { * } e - 权限变动事件
254
+ */
255
+ private handlePermissionCameraStateChanged;
256
+ /**
257
+ * 【私有方法】
258
+ * 监听权限变更
259
+ *
260
+ * @param e 回调权限数据
261
+ */
262
+ private handlePermissionPhoneStateChanged;
263
+ /**
264
+ * 初始化摄像头和麦克风权限和监听事件
265
+ */
266
+ bindDevicePermissionEvent(): Promise<void>;
267
+ /**
268
+ * 销毁设备管理器实例
269
+ */
270
+ destroy(): void;
271
+ }
272
+ export default DeviceManager;
@@ -0,0 +1,204 @@
1
+ /**
2
+ * XY WebRTC SDK Device Type
3
+ *
4
+ * Created at : 2024-06-07 17:19:09
5
+ * Last modified : 2024-06-07 17:25:44
6
+ */
7
+ /**
8
+ * 采集权限状态
9
+ *
10
+ * @param GRANTED granted - 已授权
11
+ * @param DENIED denied - 已拒绝
12
+ * @param PROMPT prompt - 询问中
13
+ * @param UNKNOWN unknown - 未知
14
+ * @param FAILED failed - 失败
15
+ */
16
+ export declare enum PermissionType {
17
+ 'GRANTED' = "granted",
18
+ 'DENIED' = "denied",
19
+ 'PROMPT' = "prompt",
20
+ 'UNKNOWN' = "unknown",
21
+ 'FAILED' = "failed"
22
+ }
23
+ /**
24
+ * 设备类型
25
+ *
26
+ * @param AUDIOINPUT audioinput - 麦克风设备
27
+ * @param AUDIOOUTPUT audiooutput - 扬声器设备
28
+ * @param VIDEOINPUT videoinput - 摄像头设备
29
+ */
30
+ export declare enum DEVICE_KIND {
31
+ 'AUDIOINPUT' = "audioInput",
32
+ 'AUDIOOUTPUT' = "audioOutput",
33
+ 'VIDEOINPUT' = "videoInput"
34
+ }
35
+ /**
36
+ * 设备基本信息
37
+ *
38
+ * @property { string } deviceId - 设备ID,切换设备时,需要使用此值
39
+ * @property { string } label - 设备名称
40
+ * @property { string } groupId - 设备分组
41
+ * @property { 'audioinput' | 'audiooutput' | 'videoinput' } kind - 设备类型
42
+ */
43
+ export type IDevice = {
44
+ deviceId: string;
45
+ label: string;
46
+ kind: DEVICE_KIND;
47
+ groupId: string;
48
+ };
49
+ /**
50
+ * 设备信息
51
+ *
52
+ * @property { boolean } isSelected - 是否选中此设备
53
+ * @property { boolean } isDefault - 是否是默认设备
54
+ * @property { string } key - 设备唯一ID
55
+ */
56
+ export interface IDeviceInfo extends IDevice {
57
+ isSelected?: boolean;
58
+ isDefault?: boolean;
59
+ key?: string;
60
+ }
61
+ /**
62
+ * 设备列表:麦克风、扬声器、摄像头
63
+ *
64
+ * @property { IDeviceInfo[] } audioInputList - 麦克风列表
65
+ * @property { IDeviceInfo[] } audioOutputList - 扬声器列表
66
+ * @property { IDeviceInfo[] } videoInList - 摄像头列表
67
+ */
68
+ export interface IDeviceList {
69
+ audioInputList: IDeviceInfo[];
70
+ audioOutputList: IDeviceInfo[];
71
+ videoInputList: IDeviceInfo[];
72
+ }
73
+ /**
74
+ * 指定设备的状态
75
+ *
76
+ * @property INIT - 未设置指定设备,是默认值,不针对采集标记状态
77
+ * @property UNKNOWN - 指定设备:未知采集状态
78
+ * @property NORMAL - 指定设备:采集正常
79
+ * @property FAILED - 指定设备:采集失败
80
+ * @property LOST - 指定设备:设备丢失
81
+ */
82
+ export declare enum SpecifiedState {
83
+ 'INIT' = "INIT",
84
+ 'UNKNOWN' = "UNKNOWN",
85
+ 'NORMAL' = "NORMAL",
86
+ 'FAILED' = "FAILED",
87
+ 'LOST' = "LOST"
88
+ }
89
+ /**
90
+ * 用户指定设备配置
91
+ *
92
+ * @property { boolean } isDefault - 是否当前是系统默认选项
93
+ * @property { string } deviceId - 设备ID
94
+ * @property { SpecifiedState } state - 指定设备ID采集状态
95
+ */
96
+ export type ISpecifiedDeviceConfig = {
97
+ isDefault: boolean;
98
+ deviceId: string;
99
+ state: SpecifiedState;
100
+ };
101
+ /**
102
+ * 用户指定设备信息
103
+ *
104
+ * @property { ISpecifiedDeviceConfig } audioInput - 麦克风设备
105
+ * @property { ISpecifiedDeviceConfig } audioOutput - 扬声器设备
106
+ * @property { ISpecifiedDeviceConfig } videoInput - 摄像头设备
107
+ */
108
+ export type ISpecifiedDevice = {
109
+ audioInput: ISpecifiedDeviceConfig;
110
+ audioOutput: ISpecifiedDeviceConfig;
111
+ videoInput: ISpecifiedDeviceConfig;
112
+ };
113
+ /**
114
+ * 当前已选择设备信息
115
+ *
116
+ * @property { IDeviceInfo | null } audioInput - 麦克风列表设备
117
+ * @property { IDeviceInfo | null } audioOutput - 扬声器列表设备
118
+ * @property { IDeviceInfo | null } videoInput - 摄像头列表设备
119
+ */
120
+ export interface ISelectedDevice {
121
+ audioInput: IDeviceInfo | null;
122
+ videoInput: IDeviceInfo | null;
123
+ audioOutput: IDeviceInfo | null;
124
+ }
125
+ /**
126
+ * 当前已选择设备信息
127
+ *
128
+ * @property { string } audioInput - 麦克风设备ID
129
+ * @property { string } audioOutput - 扬声器设备ID
130
+ * @property { string } videoInput - 摄像头设备ID
131
+ */
132
+ export type IDeviceId = {
133
+ audioInput: string;
134
+ videoInput: string;
135
+ audioOutput: string;
136
+ };
137
+ /**
138
+ * 设备变化后的最新列表数据和需要切换设备数据
139
+ *
140
+ * @property { ISelectedDevice } nextDevice - 自动切换的设备数据
141
+ * @property { IDeviceList } detail - 最新设备列表数据,包含麦克风、扬声器、摄像头
142
+ */
143
+ export interface IDeviceManagerChangeValue {
144
+ nextDevice: ISelectedDevice;
145
+ detail: IDeviceList;
146
+ }
147
+ /**
148
+ * 当前麦克风/摄像头权限
149
+ *
150
+ * @property { PermissionType } microphone - 麦克风权限
151
+ * @property { PermissionType } camera - 摄像头权限
152
+ */
153
+ export interface ICurrentPermission {
154
+ microphone: PermissionType;
155
+ camera: PermissionType;
156
+ }
157
+ /**
158
+ * 计算默认设备函数参数
159
+ *
160
+ * @property { ISpecifiedDeviceConfig } specifiedDevice - 用户指定的设备信息
161
+ * @property { IDeviceInfo | null } sysDefaultDevice - 系统默认设备信息
162
+ * @property { IDeviceInfo[] } curList - 当前设备列表
163
+ * @property { IDeviceInfo[] } preList - 上一次设备列表
164
+ *
165
+ */
166
+ export interface IDefaultDeviceIdParams {
167
+ specifiedDevice: ISpecifiedDeviceConfig;
168
+ sysDefaultDevice: IDeviceInfo | null;
169
+ curList: IDeviceInfo[];
170
+ preList: IDeviceInfo[];
171
+ }
172
+ /**
173
+ * 正在使用的设备函数参数
174
+ *
175
+ * @property { DEVICE_KIND } kind - 设备类型
176
+ * @property { string } deviceId - 设备ID
177
+ */
178
+ export interface IUsedDeviceParams {
179
+ kind: DEVICE_KIND;
180
+ deviceId: string;
181
+ }
182
+ /**
183
+ * 指定设备信息
184
+ *
185
+ * @property { DEVICE_KIND } kind - 设备类型
186
+ * @property { string } deviceId - 设备ID
187
+ * @property { boolean } isDefault - 是否是默认设备
188
+ */
189
+ export interface ISetSpecDevice extends IUsedDeviceParams {
190
+ isDefault: boolean;
191
+ }
192
+ /**
193
+ * 更新指定设备采集状态
194
+ */
195
+ export interface ISpecStateParams {
196
+ kind: DEVICE_KIND;
197
+ state: SpecifiedState;
198
+ }
199
+ /**
200
+ * 缓存设备Label名称
201
+ */
202
+ export interface IDeviceLabelMap {
203
+ [key: string]: string;
204
+ }
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Common Helper Function Lib
3
+ *
4
+ * Created at : 2021-01-09 14:45:46
5
+ * Last modified : 2024-06-20 11:39:20
6
+ */
7
+ import { IRotationInfoTotalItem, IRotateStyle, XYSupportedCodec, DEVICE_KIND } from '../../type/index';
8
+ import { XYRotationVideoInfo } from './index.type';
9
+ /**
10
+ * 获取真实视频分辨率的宽高、比值
11
+ *
12
+ * @param { number } width - 视频宽
13
+ * @param { number } height - 视频高
14
+ * @param { number } containerHeight - 视频容器高
15
+ * @param { number } containerWidth - 视频容器宽
16
+ * @param { number } rotate - 旋转信息
17
+ * @return { XYRotationVideoInfo } - 按照旋转信息计算后的宽/高/旋转角度数据
18
+ */
19
+ export declare const getVideoInfoByRotation: (width: number, height: number, containerHeight: number, containerWidth: number, rotate: number) => XYRotationVideoInfo;
20
+ /**
21
+ * 自定义布局,辅助计算参会者在旋转画面时的旋转信息
22
+ *
23
+ * @param { IRotationInfoTotalItem } rotationInfo - 屏幕旋转信息数据,通过rotate-info接口回调获取
24
+ * @param { number } containerWidth - 当前参会者布局容器的宽度
25
+ * @param { number } containerHeight - 当前参会者布局容器的高度
26
+ */
27
+ export declare const getLayoutRotateInfo: (rotationInfo: IRotationInfoTotalItem, containerWidth: number, containerHeight: number) => IRotateStyle | null;
28
+ /**
29
+ * 获取浏览器支持的编解码器列表
30
+ *
31
+ * @public
32
+ * @returns { Promise<XYSupportedCodec> } - 结果
33
+ */
34
+ export declare const getSendSupportedCodec: () => Promise<XYSupportedCodec>;
35
+ /**
36
+ * 生成用户唯一Layout ID值
37
+ *
38
+ * @param { string } callUri - callUri或者endpointId值
39
+ * @param { number | string } mediagroupid - 多分组通道ID,常见:0代表people,1代表content,会控喊话有>10值
40
+ * @param { string } customId - 自定义ID,默认是""
41
+ * @return { string } 唯一ID
42
+ */
43
+ export declare const getLayoutId: (callUri?: string, mediagroupid?: number | string, customId?: string) => string;
44
+ /**
45
+ * 生成用户Roster ID值
46
+ *
47
+ * @param { string } callUri - callUri或者endpointId值
48
+ * @param { number | string } mediagroupid - 多分组通道ID,常见:0代表people,1代表content,会控喊话有>10值
49
+ * @return { string } Roster ID
50
+ */
51
+ export declare const getRosterId: (callUri?: string, mediagroupid?: number | string) => string;
52
+ /**
53
+ * 获取Layout ID或Roster Id组合信息,依次是:endpointId、mediagroupId、customId、roster key信息
54
+ *
55
+ * @param { string } id - Layout ID/Roster ID
56
+ */
57
+ export declare const getLayoutIdInfo: (id: string) => {
58
+ endpointId: string;
59
+ mediagroupId: string | number;
60
+ customId: string;
61
+ rosterId: string;
62
+ isContent: boolean;
63
+ };
64
+ /**
65
+ * 通过participantId和mediagroupId获取用户的UniquePd值?
66
+ *
67
+ * @param { string } participantId - 小鱼设计的唯一用户ID,迁会后自动创建新的Pid子段;
68
+ * @param { string } mediagroupId - 多分组通道ID
69
+ * @returns { string } 创建的ID值
70
+ */
71
+ export declare const getUniquePid: (participantId: string | number, mediagroupId: string | number) => string;
72
+ /**
73
+ * 基于生成的UniquePid值获取participantId和mediagroupId
74
+ *
75
+ * @param { string } partId - UniquePid值
76
+ * @returns
77
+ */
78
+ export declare const getUniquePidInfo: (partId: string) => {
79
+ participantId: string;
80
+ mediagroupId: string;
81
+ };
82
+ /**
83
+ * 获取副屏渲染ID
84
+ *
85
+ * @param { string } viewId - 视图容器节点ID
86
+ * @returns { string }
87
+ */
88
+ export declare const getSlaveId: (viewId: string) => string;
89
+ /**
90
+ * 生成设备唯一Key
91
+ *
92
+ * @param { string } deviceId - 设备ID
93
+ * @param { boolean } isDefault - 是否是默认设备
94
+ * @param { DEVICE_KIND } kind - 设备类型
95
+ * @returns { string } 设备唯一Key
96
+ */
97
+ export declare const getDeviceUniKey: (deviceId: string, isDefault: boolean, kind: DEVICE_KIND) => string;
98
+ /**
99
+ * 根据名称及相应规则获得对应的名称头像
100
+ *
101
+ * @param { string } displayName - layout名称
102
+ * @returns { string } - 名称头像 文字内容
103
+ */
104
+ export declare const getTextAvatar: (displayName: string) => string;
105
+ /**
106
+ * 获取真实的TrackId信息
107
+ *
108
+ * @param { string } trackId - 媒体下发的TrackId信息,包含tk-ad,SDK层面需要将-tk-ad转换为st才可以和StreamList做匹配使用
109
+ * @returns { string }
110
+ */
111
+ export declare const getReallyTrackId: (trackId: string) => string;
112
+ /**
113
+ * 辅助函数,用于切换音频输出设备
114
+ *
115
+ * @param { HTMLAudioElement } element - Audio元素节点
116
+ * @param { string } deviceId - 指定切换的设备ID,如果指定错误,则使用系统默认设备
117
+ */
118
+ export declare const setOutputAudioDevice: (element: any, deviceId: string) => Promise<void>;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * 旋转信息计算后的宽/高/旋转角度数据
3
+ *
4
+ * @param { number } realWidth - 旋转后的宽度
5
+ * @param { number } realHeight - 旋转后的高度
6
+ * @param { number } realRotate - 旋转角度
7
+ */
8
+ export interface XYRotationVideoInfo {
9
+ realWidth: number;
10
+ realHeight: number;
11
+ realRotate: number;
12
+ }