@xylink/xy-rtc-sdk 3.8.1 → 3.9.1-beta.6

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 (46) hide show
  1. package/lib/action/index.d.ts +29 -5
  2. package/lib/enum/client.d.ts +15 -0
  3. package/lib/enum/contraints.d.ts +30 -102
  4. package/lib/enum/device.d.ts +1 -0
  5. package/lib/enum/errorCode.d.ts +58 -1
  6. package/lib/enum/index.d.ts +53 -16
  7. package/lib/index.d.ts +11 -8
  8. package/lib/main/client.d.ts +157 -79
  9. package/lib/main/deviceManager.d.ts +23 -4
  10. package/lib/main/helper.d.ts +2 -2
  11. package/lib/main/iauth.d.ts +67 -5
  12. package/lib/main/layoutManager.d.ts +29 -11
  13. package/lib/main/meeting.d.ts +73 -35
  14. package/lib/main/peer.d.ts +70 -121
  15. package/lib/main/qualityManager.d.ts +38 -9
  16. package/lib/main/stream.d.ts +237 -104
  17. package/lib/main/videoManager.d.ts +1 -9
  18. package/lib/tools/config.d.ts +5 -1
  19. package/lib/tools/dbManager.d.ts +106 -0
  20. package/lib/tools/detect.d.ts +2 -2
  21. package/lib/tools/enum.d.ts +1 -1
  22. package/lib/tools/httpClient.d.ts +15 -23
  23. package/lib/tools/i18n.d.ts +1 -1
  24. package/lib/tools/logger.d.ts +75 -74
  25. package/lib/tools/logger.worker.d.ts +13 -0
  26. package/lib/tools/quality.d.ts +113 -0
  27. package/lib/tools/quality.worker.d.ts +13 -0
  28. package/lib/tools/queue.d.ts +38 -3
  29. package/lib/tools/template.d.ts +3 -3
  30. package/lib/tools/utils.d.ts +8 -0
  31. package/lib/type/action.d.ts +4 -0
  32. package/lib/type/base.d.ts +2 -2
  33. package/lib/type/client.d.ts +280 -186
  34. package/lib/type/device.d.ts +21 -15
  35. package/lib/type/iauth.d.ts +112 -0
  36. package/lib/type/index.d.ts +4 -0
  37. package/lib/type/layout.d.ts +18 -1
  38. package/lib/type/logger.d.ts +112 -0
  39. package/lib/type/meeting.d.ts +11 -2
  40. package/lib/type/peer.d.ts +20 -0
  41. package/lib/type/quality.d.ts +101 -0
  42. package/lib/type/stream.d.ts +332 -134
  43. package/lib/xyrtc.cjs.js +1 -1
  44. package/lib/xyrtc.umd.js +1 -1
  45. package/package.json +5 -4
  46. 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
  }
@@ -0,0 +1,112 @@
1
+ /**
2
+ *
3
+ * @param { string } extId
4
+ */
5
+ export interface ExtInfo {
6
+ extId: string;
7
+ }
8
+ /**
9
+ * 登录方式
10
+ *
11
+ * @param XYAccount - 小鱼账号登录
12
+ * @param ExtUserId - 三方用户id登录
13
+ * @param ExtToken - authCode登录
14
+ */
15
+ export declare enum LoginType {
16
+ XYAccount = 0,
17
+ ExtUserId = 1,
18
+ ExtToken = 2
19
+ }
20
+ /**
21
+ * 三方用户统一认证登录 - 小鱼账号登录 参数
22
+ *
23
+ * @param { string } account - 用户账号
24
+ * @param { string } password - 用户密码
25
+ * @param { string? } countryCode - 国家码:默认+86
26
+ * @param { string? } extId - 企业ID
27
+ */
28
+ export interface LoginXYAccountParams {
29
+ account: string;
30
+ password: string;
31
+ countryCode?: string;
32
+ extId?: string;
33
+ }
34
+ /**
35
+ * 三方用户统一认证登录 - 用户ID参数
36
+ *
37
+ * @param { string } extUserId - 三方用户ID
38
+ * @param { string } authCode - 登录码
39
+ * @param { string } displayName - 用户名称
40
+ * @param { boolean? } tempUser - 是否临时用户
41
+ * @param { string? } extId - 企业ID
42
+ */
43
+ export interface LoginExtUserIdParams {
44
+ extUserId: string;
45
+ authCode: string;
46
+ displayName: string;
47
+ tempUser?: boolean;
48
+ extId?: string;
49
+ }
50
+ /**
51
+ * 三方用户统一认证登录 - token登录
52
+ *
53
+ * @param { string } authCode - 登录码
54
+ * @param { string? } extId - 企业ID
55
+ */
56
+ export interface LoginExtTokenParams {
57
+ authCode: string;
58
+ extId?: string;
59
+ }
60
+ interface LoginParamsTemp extends LoginXYAccountParams, LoginExtUserIdParams, LoginExtTokenParams {
61
+ }
62
+ /**
63
+ * 三方用户统一认证登录 参数
64
+ */
65
+ export type LoginParams = Partial<LoginParamsTemp>;
66
+ /**
67
+ * 第三方登录用户信息
68
+ *
69
+ * @property { string } displayName 用户名称
70
+ * @property { string } extId 企业id
71
+ * @property { string } extUserId 三方用户ID
72
+ * @property { string } authCode 授权码
73
+ * @property { boolean } tempUser 临时账号
74
+ */
75
+ export interface ILoginExtAccount {
76
+ displayName: string;
77
+ extId?: string;
78
+ extUserId?: string;
79
+ authCode?: string;
80
+ tempUser?: boolean;
81
+ }
82
+ /**
83
+ * 第三方登录sdk用户信息,由sdk server创建
84
+ *
85
+ * @property { string } userName sdk用户名
86
+ * @property { string } password sdk密码
87
+ * @property { string? } extId sdk企业Id
88
+ */
89
+ export interface ISdkUserInfo {
90
+ userName: string;
91
+ password: string;
92
+ extId?: string;
93
+ }
94
+ /**
95
+ * 授权码登录
96
+ *
97
+ * @property { string } extId 企业id
98
+ * @property { string } extUserId 用户id
99
+ * @property { string } displayName 用户名
100
+ * @property { string } oauthCode 授权码
101
+ * @property { boolean } isTempUser 是否是临时账号
102
+ * @property { string } channelId 渠道id
103
+ */
104
+ export interface ILoginWidthAuthCode {
105
+ extId: string;
106
+ extUserId: string;
107
+ displayName: string;
108
+ oauthCode: string;
109
+ isTempUser: boolean;
110
+ channelId: string;
111
+ }
112
+ export {};
@@ -12,3 +12,7 @@ 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';
18
+ export * from './iauth';
@@ -1,3 +1,4 @@
1
+ import { ILayout } from './client';
1
2
  /**
2
3
  * 模板对应位置类型
3
4
  *
@@ -6,8 +7,24 @@
6
7
  * @param {CONTENT} CONTENT - 共享画面
7
8
  * @param {PEOPLE} PEOPLE - 非共享画面
8
9
  */
9
- export declare enum TEMPLATE_TYPE {
10
+ export declare enum TemplateType {
10
11
  LOCAL = "LOCAL",
11
12
  CONTENT = "CONTENT",
12
13
  PEOPLE = "PEOPLE"
13
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,7 @@
5
5
  * Last modified : 2022-10-27 19:25:49
6
6
  */
7
7
  import { ILoginInfo } from './client';
8
+ import { LayoutAvatarType } from './layout';
8
9
  import { StreamResolution } from './stream';
9
10
  /**
10
11
  * 呼叫号码的云会议室属性配置
@@ -68,9 +69,17 @@ export interface IMediaConfig {
68
69
  maxRequestResolution?: StreamResolution;
69
70
  }
70
71
  /**
71
- * 企业配置参数
72
+ * 媒体能力配置 请求参数
72
73
  */
73
- export interface IEnterpriseConfig {
74
+ export interface IMediaConfigParam {
74
75
  clientConfigName: string;
75
76
  configName: string;
76
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
+ }