@xylink/xy-rtc-sdk 3.8.0 → 3.9.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 (45) hide show
  1. package/README.MD +37 -37
  2. package/lib/action/index.d.ts +21 -6
  3. package/lib/enum/client.d.ts +15 -0
  4. package/lib/enum/contraints.d.ts +33 -96
  5. package/lib/enum/device.d.ts +1 -0
  6. package/lib/enum/errorCode.d.ts +58 -1
  7. package/lib/enum/i18n.d.ts +39 -0
  8. package/lib/enum/index.d.ts +65 -16
  9. package/lib/index.d.ts +11 -8
  10. package/lib/main/client.d.ts +101 -71
  11. package/lib/main/deviceManager.d.ts +23 -4
  12. package/lib/main/helper.d.ts +2 -2
  13. package/lib/main/iauth.d.ts +14 -1
  14. package/lib/main/layoutManager.d.ts +43 -13
  15. package/lib/main/meeting.d.ts +75 -21
  16. package/lib/main/peer.d.ts +70 -121
  17. package/lib/main/qualityManager.d.ts +38 -9
  18. package/lib/main/stream.d.ts +237 -104
  19. package/lib/main/videoManager.d.ts +1 -9
  20. package/lib/tools/dbManager.d.ts +106 -0
  21. package/lib/tools/detect.d.ts +2 -2
  22. package/lib/tools/enum.d.ts +1 -1
  23. package/lib/tools/httpClient.d.ts +4 -4
  24. package/lib/tools/i18n.d.ts +1 -1
  25. package/lib/tools/logger.d.ts +75 -74
  26. package/lib/tools/logger.worker.d.ts +13 -0
  27. package/lib/tools/quality.d.ts +113 -0
  28. package/lib/tools/quality.worker.d.ts +13 -0
  29. package/lib/tools/queue.d.ts +38 -3
  30. package/lib/tools/template.d.ts +8 -1
  31. package/lib/tools/utils.d.ts +8 -0
  32. package/lib/type/base.d.ts +2 -2
  33. package/lib/type/client.d.ts +286 -183
  34. package/lib/type/device.d.ts +21 -15
  35. package/lib/type/index.d.ts +3 -0
  36. package/lib/type/layout.d.ts +25 -6
  37. package/lib/type/logger.d.ts +112 -0
  38. package/lib/type/meeting.d.ts +29 -0
  39. package/lib/type/peer.d.ts +20 -0
  40. package/lib/type/quality.d.ts +101 -0
  41. package/lib/type/stream.d.ts +340 -102
  42. package/lib/xyrtc.cjs.js +1 -1
  43. package/lib/xyrtc.umd.js +1 -1
  44. package/package.json +119 -119
  45. package/lib/tools/db.d.ts +0 -85
@@ -1,13 +1,19 @@
1
1
  /**
2
- * WebRTC权限状态
2
+ * 采集权限状态
3
3
  *
4
- * @value granted 已授权
5
- * @value denied 已拒绝
6
- * @value prompt 询问中
7
- * @value unknown 未知
8
- * @value '' 默认
4
+ * @param GRANTED granted - 已授权
5
+ * @param DENIED denied - 已拒绝
6
+ * @param PROMPT prompt - 询问中
7
+ * @param UNKNOWN unknown - 未知
8
+ * @param FAILED failed - 失败
9
9
  */
10
- export declare type TPermissionType = 'granted' | 'denied' | 'prompt' | 'unknown' | 'failed' | '';
10
+ export declare enum PermissionType {
11
+ 'GRANTED' = "granted",
12
+ 'DENIED' = "denied",
13
+ 'PROMPT' = "prompt",
14
+ 'UNKNOWN' = "unknown",
15
+ 'FAILED' = "failed"
16
+ }
11
17
  /**
12
18
  * 获取设备信息
13
19
  *
@@ -23,7 +29,7 @@ export declare type TPermissionType = 'granted' | 'denied' | 'prompt' | 'unknown
23
29
  * @value videoinput 摄像头输入
24
30
  * @property { string } type 设备采集流类型:video/audio
25
31
  */
26
- export declare type IDeviceInfo = {
32
+ export type IDeviceInfo = {
27
33
  deviceId: string;
28
34
  label: string;
29
35
  groupId?: string;
@@ -38,7 +44,7 @@ export declare type IDeviceInfo = {
38
44
  * @property { IDeviceInfo[] } audioOutputList 扬声器列表
39
45
  * @property { IDeviceInfo[] } videoInList 摄像头列表
40
46
  */
41
- export declare type IDeviceList = {
47
+ export type IDeviceList = {
42
48
  audioInputList: IDeviceInfo[];
43
49
  audioOutputList: IDeviceInfo[];
44
50
  videoInList: IDeviceInfo[];
@@ -50,7 +56,7 @@ export declare type IDeviceList = {
50
56
  * @property { IDeviceInfo | undefined } audioOutput 扬声器设备
51
57
  * @property { IDeviceInfo | undefined } videoInput 摄像头设备
52
58
  */
53
- export declare type ISelectedDevice = {
59
+ export type ISelectedDevice = {
54
60
  audioInput: IDeviceInfo | undefined;
55
61
  videoInput: IDeviceInfo | undefined;
56
62
  audioOutput: IDeviceInfo | undefined;
@@ -61,17 +67,17 @@ export declare type ISelectedDevice = {
61
67
  * @property { ISelectedDevice } nextDevice 最新的设备
62
68
  * @property { IDeviceList } detail 最新设备详细信息
63
69
  */
64
- export declare type IDeviceManagerChangeValue = {
70
+ export type IDeviceManagerChangeValue = {
65
71
  nextDevice: ISelectedDevice;
66
72
  detail: IDeviceList;
67
73
  };
68
74
  /**
69
75
  * 当前麦克风/摄像头权限
70
76
  *
71
- * @property { TPermissionType } microphone 麦克风权限
72
- * @property { TPermissionType } camera 摄像头权限
77
+ * @property { PermissionType } microphone 麦克风权限
78
+ * @property { PermissionType } camera 摄像头权限
73
79
  */
74
80
  export interface ICurrentPermission {
75
- microphone: TPermissionType;
76
- camera: TPermissionType;
81
+ microphone: PermissionType;
82
+ camera: PermissionType;
77
83
  }
@@ -12,3 +12,6 @@ export * from './device';
12
12
  export * from './action';
13
13
  export * from './meeting';
14
14
  export * from './layout';
15
+ export * from './quality';
16
+ export * from './peer';
17
+ export * from './logger';
@@ -1,11 +1,30 @@
1
+ import { ILayout } from './client';
1
2
  /**
2
3
  * 模板对应位置类型
3
4
  *
4
5
  * @enum
5
- * @property {LOCAL} LOCAL 本地
6
- * @property {CONTENT} CONTENT 共享画面
6
+ * @param {LOCAL} LOCAL - 本地
7
+ * @param {CONTENT} CONTENT - 共享画面
8
+ * @param {PEOPLE} PEOPLE - 非共享画面
7
9
  */
8
- export declare const TEMPLATE_TYPE: {
9
- LOCAL: string;
10
- CONTENT: string;
11
- };
10
+ export declare enum TemplateType {
11
+ LOCAL = "LOCAL",
12
+ CONTENT = "CONTENT",
13
+ PEOPLE = "PEOPLE"
14
+ }
15
+ /**
16
+ * Layout头像类型
17
+ *
18
+ * @param NONE -1 - 无头像
19
+ * @param TEXT 0 - 名称头像
20
+ * @param IMAGE 1 - 人物头像
21
+ */
22
+ export declare enum LayoutAvatarType {
23
+ NONE = -1,
24
+ TEXT = 0,
25
+ IMAGE = 1
26
+ }
27
+ /**
28
+ * Layout map
29
+ */
30
+ export type TLayoutMap = Map<string, ILayout>;
@@ -0,0 +1,112 @@
1
+ /**
2
+ * 日志类型
3
+ *
4
+ * @param LOG INFO - INFO类型
5
+ * @param DEBUG DEBUG - 调试信息
6
+ * @param WARN WARN - 警告信息
7
+ * @param ERROR ERROR - 错误信息
8
+ */
9
+ export declare enum MessageKind {
10
+ LOG = "INFO",
11
+ DEBUG = "DEBUG",
12
+ WARN = "WARN",
13
+ ERROR = "ERROR"
14
+ }
15
+ /**
16
+ * WebWorker消息类型
17
+ *
18
+ * @param LOGGER - 日志类型
19
+ * @param INIT - 初始化模块
20
+ * @param DESTROY - 销毁操作
21
+ * @param DOWNLOAD - 下载日志操作
22
+ * @param UPLOAD - 上传日志操作
23
+ */
24
+ export declare enum LogOperateType {
25
+ LOGGER = "LOGGER",
26
+ INIT = "INIT",
27
+ DESTROY = "DESTROY",
28
+ DOWNLOAD = "DOWNLOAD",
29
+ UPLOAD = "UPLOAD"
30
+ }
31
+ /**
32
+ * 日志等级
33
+ *
34
+ * @param INFO - 所有的日志信息
35
+ * @param DEBUG - 调试信息
36
+ * @param WARNING - 警告信息
37
+ * @param ERROR - 错误信息
38
+ * @param NONE - 禁用输出日志信息
39
+ */
40
+ export declare enum LogLevel {
41
+ INFO = "INFO",
42
+ DEBUG = "DEBUG",
43
+ WARNING = "WARNING",
44
+ ERROR = "ERROR",
45
+ NONE = "NONE"
46
+ }
47
+ /**
48
+ * 日志等级
49
+ *
50
+ * @param INFO - 所有的日志信息
51
+ * @param DEBUG - 调试信息
52
+ * @param WARNING - 警告信息
53
+ * @param ERROR - 错误信息
54
+ * @param NONE - 禁用输出日志信息
55
+ */
56
+ export type TLogLevel = `${LogLevel}`;
57
+ /**
58
+ * 日志模块配置
59
+ *
60
+ * @param { string } dbName - 数据库名称,默认值:XYRTC_LOG
61
+ * @param { number } dbVersion - 数据库版本,默认值:1
62
+ * @param { string } tableName - 表名称,默认值:LOG
63
+ * @param { number } tableCount - 表的数量,默认值:1
64
+ * @param { number } tableIndex - 当前表的索引,默认值:1
65
+ * @param { number } maxSize - 当前数据表最大存储长度,默认值:1000000(100万条数据)
66
+ * @param { number } schema - 表字段,默认值:'++id,t,c'
67
+ * @param { string[] } deleteDBNames - 需要删除的历史数据库名,默认值[]
68
+ * @param { boolean } isUpdateVersion - 是否需要更新表版本(历史表都将被删除,避免错误)
69
+ * @param { number } detectTimer - 多久检测一次表的最大长度,单位ms,默认值:300000(5分钟)
70
+ */
71
+ export interface ILoggerConfig {
72
+ dbName: string;
73
+ tableName: string;
74
+ dbVersion?: number;
75
+ tableCount?: number;
76
+ tableIndex?: number;
77
+ schema?: string;
78
+ maxSize?: number;
79
+ detectTimer?: number;
80
+ deleteDBNames?: string[];
81
+ isUpdateVersion?: boolean;
82
+ enableClearTable?: boolean;
83
+ }
84
+ /**
85
+ * 数据库操作配置
86
+ */
87
+ export interface IDBManagerConfig extends ILoggerConfig {
88
+ }
89
+ /**
90
+ * 缓存数据表配置
91
+ */
92
+ export interface IStorageTableConfig {
93
+ version: number;
94
+ index: number;
95
+ count: number;
96
+ }
97
+ /**
98
+ * Webworker消息数据
99
+ *
100
+ * @param { LogOperateType } type - 消息类型
101
+ * @param { { [key: string]: any } } data - 消息数据
102
+ * @param { { [key: string]: any } & ILoggerConfig } config - 消息配置
103
+ */
104
+ export interface IWorkerData {
105
+ type: LogOperateType;
106
+ data: {
107
+ [key: string]: any;
108
+ };
109
+ config: {
110
+ [key: string]: any;
111
+ } & ILoggerConfig;
112
+ }
@@ -5,6 +5,8 @@
5
5
  * Last modified : 2022-10-27 19:25:49
6
6
  */
7
7
  import { ILoginInfo } from './client';
8
+ import { LayoutAvatarType } from './layout';
9
+ import { StreamResolution } from './stream';
8
10
  /**
9
11
  * 呼叫号码的云会议室属性配置
10
12
  */
@@ -54,3 +56,30 @@ export interface ICloudRoomConfig {
54
56
  export interface IExportUserInfo extends ILoginInfo {
55
57
  cloudRoomInfo: ICloudRoomConfig;
56
58
  }
59
+ /**
60
+ * 媒体能力配置
61
+ *
62
+ * @property { string? } pvrxResolution 请流能力
63
+ * @property { boolean } isSupportHighResolution 是否支持高分辨率请流
64
+ * @property { StreamResolution } maxRequestResolution 最高支持请流分辨率
65
+ */
66
+ export interface IMediaConfig {
67
+ pvrxResolution?: string;
68
+ isSupportHighResolution?: boolean;
69
+ maxRequestResolution?: StreamResolution;
70
+ }
71
+ /**
72
+ * 媒体能力配置 请求参数
73
+ */
74
+ export interface IMediaConfigParam {
75
+ clientConfigName: string;
76
+ configName: string;
77
+ }
78
+ /**
79
+ * 企业配置信息
80
+ *
81
+ * @property { LayoutAvatarType } userAvatarMode 头像配置 0:名称头像(默认), 1: 人物头像
82
+ */
83
+ export interface IEnterpriseConfig {
84
+ userAvatarMode?: LayoutAvatarType;
85
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Peer lib types
3
+ *
4
+ * Created at : 2023-04-10 18:10:00
5
+ * Last modified : 2023-04-17 14:02:34
6
+ */
7
+ /**
8
+ * RTCPeerConnection通道方向
9
+ *
10
+ * @param INACTIVE inactive - 不发/不收RTP数据
11
+ * @param RECVONLY recvonly - 仅接收远端RTP数据
12
+ * @param SENDONLY sendonly - 仅发送给远端RTP数据
13
+ * @param SENDRECV sendrecv - 既发也接收RTP数据
14
+ */
15
+ export declare enum RTCDirection {
16
+ INACTIVE = "inactive",
17
+ RECVONLY = "recvonly",
18
+ SENDONLY = "sendonly",
19
+ SENDRECV = "sendrecv"
20
+ }
@@ -1,3 +1,25 @@
1
+ /**
2
+ * Quality Type
3
+ *
4
+ * Created at : 2023-05-04 11:22:41
5
+ * Last modified : 2023-05-11 10:47:41
6
+ */
7
+ import { ILayout } from './client';
8
+ import { IStreamConfig } from './stream';
9
+ /**
10
+ * 网络质量信号等级
11
+ *
12
+ * @param Bad 1 - 非常差, loss > 30 || rtt >500 || 心跳连续3次以上超时
13
+ * @param Poor 2 - 差, 20 < loss < 30 || 300 < rtt < 500 || 心跳连续3次以上超时
14
+ * @param Good 3 - 一般, 10 < loss < 20 || 100 < rtt < 300 || 心跳连续2次以上超时
15
+ * @param Excellent 4 - 很好, loss < 10 || rtt < 100
16
+ */
17
+ export declare enum NetworkQualityLevel {
18
+ Bad = 1,
19
+ Poor = 2,
20
+ Good = 3,
21
+ Excellent = 4
22
+ }
1
23
  /**
2
24
  * 会议质量上报 基础数据
3
25
  *
@@ -75,3 +97,82 @@ export interface IVideoQuality {
75
97
  resNum: number;
76
98
  resolution: number;
77
99
  }
100
+ /**
101
+ * 远端网络质量信号等级
102
+ *
103
+ * @property { string } fromCallUri 远端的callUri
104
+ * @property { number } fromPid 远端的pid
105
+ * @property { NetworkQualityLevel } networkLevel 网络质量信号等级
106
+ * @property { string } toCallUri local callUri
107
+ *
108
+ */
109
+ export interface INetworkParameter {
110
+ fromCallUri: string;
111
+ fromPid: number;
112
+ networkLevel: NetworkQualityLevel;
113
+ toCallUri: string;
114
+ }
115
+ /**
116
+ * WebWorker消息类型
117
+ *
118
+ * @param STATS - 质量数据
119
+ * @param INIT - 初始化模块
120
+ * @param DESTROY - 销毁操作
121
+ * @param STATS_VIDEO_RECEIVER - 视频接收数据
122
+ * @param STATS_AUDIO_RECEIVER - 音频接收数据
123
+ * @param STATS_SENDER - 发送数据
124
+ * @param INTERNALS - 质量数据
125
+ * @param REPORT_INTERNALS - 质量上报数据
126
+ * @param REPORT_NETWORK_LEVEL - 网络质量等级
127
+ */
128
+ export declare enum QualityOperateType {
129
+ STATS = "STATS",
130
+ INIT = "INIT",
131
+ DESTROY = "DESTROY",
132
+ STATS_VIDEO_RECEIVER = "STATS_VIDEO_RECEIVER",
133
+ STATS_AUDIO_RECEIVER = "STATS_AUDIO_RECEIVER",
134
+ STATS_SENDER = "STATS_SENDER",
135
+ INTERNALS = "INTERNALS",
136
+ REPORT_INTERNALS = "REPORT_INTERNALS",
137
+ REPORT_NETWORK_LEVEL = "REPORT_NETWORK_LEVEL"
138
+ }
139
+ /**
140
+ * 传递给Worker的原始数据
141
+ *
142
+ * @property { ILayout } layoutItem - layout成员数据
143
+ * @property { RTCStatsReport[] } - statsList stats质量数据
144
+ * @property { MediaTrackSettings } - trackSetting Track设置
145
+ * @property { string } trackId - trackId
146
+ * @property { boolean } isContent - 是否是content
147
+ * @property { IStreamConfig } streamConfig - 流配置
148
+ * @property { boolean } isFirefox - 是否是火狐浏览器
149
+ */
150
+ export interface IWorkerVideoReceiver {
151
+ layoutItem?: ILayout;
152
+ statsList?: RTCStatsReport[];
153
+ trackSetting?: MediaTrackSettings;
154
+ trackId?: string;
155
+ isContent?: boolean;
156
+ streamConfig?: IStreamConfig;
157
+ isFirefox?: boolean;
158
+ }
159
+ /**
160
+ * 传递给Worker的结构数据
161
+ *
162
+ * @property { IVideoReceiverMessage[] } workerVideoReceiver - worker视频接收数据
163
+ * @property { number } timestamp - 时间戳
164
+ */
165
+ export interface IVideoReceiverMessage {
166
+ workerVideoReceiver: IWorkerVideoReceiver[];
167
+ timestamp: number;
168
+ }
169
+ /**
170
+ * Quality配置
171
+ *
172
+ * @property { number } logInterval - 日志间隔
173
+ * @property { number } reportInterval - 质量上报时间间隔
174
+ */
175
+ export interface IQualityConfig {
176
+ logInterval: number;
177
+ reportInterval: number;
178
+ }