@xylink/xy-rtc-sdk 2.0.6 → 2.1.2-beta.7

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.
@@ -6,10 +6,10 @@
6
6
  * @email luojinghui424@gmail.com
7
7
  *
8
8
  * Created at : 2021-01-05 17:24:07
9
- * Last modified : 2022-01-04 23:32:36
9
+ * Last modified : 2022-06-09 17:37:50
10
10
  */
11
11
  import Logger from '../tools/logger';
12
- import { ILayout, IVideoRenders, IRoster, ITemplateObj, IScreenInfo, IMode, IOutputCustomLayout, ILayoutRoster, IResolutionType, IConfInfo, IPageInfo, IReqInfo, IQualityType, ICustomLayout } from '../type/index';
12
+ import { ILayout, IVideoRenders, IRoster, ITemplateObj, IScreenInfo, IMode, IOutputCustomLayout, ILayoutRoster, IResolutionType, IConfInfo, IPageInfo, IReqInfo, IQualityType } from '../type/index';
13
13
  import Client from './client';
14
14
  export default class LayoutManager {
15
15
  logger: Logger;
@@ -25,7 +25,6 @@ export default class LayoutManager {
25
25
  private templateMode;
26
26
  private templateModeTemp;
27
27
  private templateRate;
28
- private specifyTemplateMode;
29
28
  private content;
30
29
  private screenInfo;
31
30
  private internelsLayout;
@@ -59,14 +58,32 @@ export default class LayoutManager {
59
58
  getTemplateMode(): IMode;
60
59
  getConfInfo(): IConfInfo;
61
60
  getInternelsLayout(): IOutputCustomLayout;
61
+ getLocalShareState(): boolean;
62
62
  setOrderRosterList(orderRosterList: IRoster[]): void;
63
63
  setOriginOrderRosters(originOrderRosters: IRoster[]): void;
64
+ /**
65
+ * 设置发布全屏layout id
66
+ *
67
+ * @param { string } id forceLayout roster id
68
+ */
64
69
  setForceFullScreenId(id?: string): void;
65
70
  setTemplateMode(templateMode: IMode): void;
66
- setContentRosterItem(content: IRoster): void;
71
+ setContentRosterItem(content: IRoster | null): void;
67
72
  setConfInfo(confInfo: IConfInfo): void;
73
+ /**
74
+ * 本地分享content, 设置对应布局、页码
75
+ *
76
+ * @public
77
+ * @param { boolean } is 本地是否分享content
78
+ */
68
79
  setLocalShareContent(is: boolean): void;
69
- rosterRecvMode(orderRosterListLen: number): {
80
+ /**
81
+ * 计算显示模板数据
82
+ *
83
+ * @public
84
+ * @returns
85
+ */
86
+ calcTemplate(): {
70
87
  tempLayout: ITemplateObj[];
71
88
  templateRate: number;
72
89
  };
@@ -99,31 +116,43 @@ export default class LayoutManager {
99
116
  */
100
117
  clearInvalidVideoManagers(): void;
101
118
  /**
102
- * 重新计算页码信息
119
+ * [AUTO] 重新计算页码信息、模板类型
120
+ *
121
+ * @public
103
122
  */
104
- calcPageInfo(): void;
123
+ calcPageInfo(confInfo?: IConfInfo): void;
105
124
  /**
106
- * AUTO布局 分页
107
- * @param currentPage 请求某一页数据
125
+ * [AUTO] 分页
126
+ *
127
+ * @public
128
+ * @param { number } currentPage 请求某一页数据
108
129
  */
109
130
  setPageInfo(currentPage?: number): void;
110
131
  /**
111
- * 全屏请流
132
+ * [AUTO] 全屏请流
133
+ *
134
+ * @public
112
135
  */
113
- calcForceFullScreenRequestLayout(): boolean;
136
+ calcForceFullScreenRequestLayout(): void;
114
137
  /**
115
- * AUTO布局 请流
138
+ * [AUTO] 请流
139
+ *
140
+ * @public
141
+ * @param { IPageInfo } pageInfo 页码信息
116
142
  */
117
143
  calcRequestNewLayout(pageInfo?: IPageInfo): void;
118
144
  /**
119
- * AUTO : 基于 new layout result 消息生成 customLayoutList 数据,并diff对比更新数据
120
- * @param totalLayoutResultList
145
+ * [AUTO] : 基于 new layout result 消息生成 customLayoutList 数据,并diff对比更新数据
146
+ *
147
+ * @public
148
+ * @param { ILayoutRoster[] } totalLayoutResultList
121
149
  */
122
150
  createAutoLayout(totalLayoutResultList: ILayoutRoster[]): void;
123
151
  /**
124
152
  * 创建排好序的roster数据
125
153
  *
126
- * @param totalLayoutResultList
154
+ * @private
155
+ * @param { ILayoutRoster[] } totalLayoutResultList
127
156
  */
128
157
  private createOrderRoster;
129
158
  createCustomLayout(totalLayoutResultList: ILayoutRoster[]): void;
@@ -135,7 +164,6 @@ export default class LayoutManager {
135
164
  requestLayout(reqList: IReqInfo[]): void;
136
165
  calculatePosition(): void;
137
166
  calculateRotate(): void;
138
- requestLayoutCalculator(): ICustomLayout[];
139
167
  getVideoStreamByTrackId(videoTrackId: string): {
140
168
  videoStream: MediaStream | null;
141
169
  track: MediaStreamTrack | null;
@@ -152,10 +180,9 @@ export default class LayoutManager {
152
180
  rateHeight: number;
153
181
  rateWidth: number;
154
182
  };
155
- requestCustomLayout(): void;
156
183
  createLayout(): void;
157
184
  calculateOrderRosterList(): IRoster[];
158
- switchLayout(templateMode?: IMode): IMode | undefined;
185
+ switchLayout(templateMode?: IMode): IMode;
159
186
  /**
160
187
  * 【内部方法】停止轮询时,清理无效的 videoManager 数据
161
188
  *
@@ -110,7 +110,7 @@ export default class Peer {
110
110
  */
111
111
  setBandWidth(trackId: string, bandwidth: number | undefined, isIncreaseBase: boolean | undefined, stream: MediaStream | null): Promise<void>;
112
112
  /**
113
- * View the cb of ice connectionn status change
113
+ * View the cb of ice connection status change
114
114
  * Maybe status:'new', 'checking', 'connected', 'completed', 'failed', 'disconnected', 'closed'
115
115
  *
116
116
  * @private
@@ -158,7 +158,7 @@ export default class Peer {
158
158
  */
159
159
  initSenderStatus(): void;
160
160
  /**
161
- * Reset content serder track
161
+ * Reset content sender track
162
162
  *
163
163
  * @public
164
164
  */
@@ -184,6 +184,14 @@ export default class Peer {
184
184
  * @private
185
185
  */
186
186
  private calcMeetingStats;
187
+ /**
188
+ * 计算丢包率
189
+ *
190
+ * @param sum 包的总数
191
+ * @param lost 丢失包的数量
192
+ * @returns 丢包率
193
+ */
194
+ private getLost;
187
195
  /**
188
196
  * 批量向peer通道添加Track轨道数据
189
197
  *
@@ -201,6 +209,7 @@ export default class Peer {
201
209
  * @param { IStreamObj } item 自定义Stream流对象
202
210
  */
203
211
  private addStreamRenders;
212
+ preferCodec(codecs: RTCRtpCodecCapability[], mimeType: string): RTCRtpCodecCapability[];
204
213
  /**
205
214
  * 向peer添加Track轨道数据
206
215
  *
@@ -244,6 +253,7 @@ export default class Peer {
244
253
  * 获取sender的发送数据
245
254
  *
246
255
  * @private
256
+ * @param { 'sender' | 'audioSender' } key
247
257
  * @param { RTCStatsReport } stats sender发送器的统计数据
248
258
  * @param { IInternels } internels 自定义internels统计数据
249
259
  * @param { IStreamSender } senderItem sender发送器对象
@@ -257,9 +267,11 @@ export default class Peer {
257
267
  * @private
258
268
  * @param { RTCStatsReport } stats sender发送器的统计数据
259
269
  * @param { ILayout } layoutItem layout布局数据
270
+ * @param { IInternels } internels 自定义internels统计数据
260
271
  * @returns { IReceiver } 接收端的统计数据
261
272
  */
262
273
  private getReceiverStatus;
274
+ private getReceiverAudioTrackStatus;
263
275
  /**
264
276
  * 计算速率
265
277
  *
@@ -0,0 +1,39 @@
1
+ import Client from './client';
2
+ import LayoutManager from './layoutManager';
3
+ import { IInternels } from '../type';
4
+ declare class QualityManager {
5
+ private client;
6
+ private reportDataTimer;
7
+ private meetingQualityData;
8
+ private layoutManager;
9
+ private previousInternals;
10
+ private internals;
11
+ constructor(client: Client, layoutManager: LayoutManager);
12
+ /**
13
+ * 定时上报会议质量、网络数据
14
+ *
15
+ * @private
16
+ */
17
+ reportQualityData(internals: IInternels): void;
18
+ /**
19
+ * webrtc audioLevel 转换成 播放能量
20
+ * @param audioLevel
21
+ * @returns
22
+ */
23
+ private calcAudioLevel;
24
+ /**
25
+ * 发送会议质量数据
26
+ *
27
+ * @param { number ? } sessionName 0:people 1:content
28
+ * @param { boolean ? } isLast 挂断状态
29
+ * @private
30
+ */
31
+ private calcQualityData;
32
+ /**
33
+ * 停止上报网络数据
34
+ *
35
+ * @private
36
+ */
37
+ stopReportData(): void;
38
+ }
39
+ export default QualityManager;
@@ -6,12 +6,12 @@
6
6
  */
7
7
  import Logger from '../tools/logger';
8
8
  import Emmitter from '../tools/emmitter';
9
- import { IStreamChangeType, IStreamObj, IGetMediaStreams, ISource, IStreamInitConfog, IStreamCurrent, IMediaSupportedConstraints, IStreamChange, IStatus } from '../type';
9
+ import { IStreamChangeType, IStreamObj, IGetMediaStreams, ISource, IStreamInitConfig, IStreamCurrent, IMediaSupportedConstraints, IStreamChange, IStatus } from '../type';
10
10
  import Peer from './peer';
11
11
  import Client from './client';
12
12
  export default class Stream extends Emmitter {
13
13
  streams: IStreamObj[];
14
- config: IStreamInitConfog;
14
+ config: IStreamInitConfig;
15
15
  current: IStreamCurrent;
16
16
  isSupportReauthorize: boolean;
17
17
  private isSupportAppendTrack;
@@ -25,8 +25,8 @@ export default class Stream extends Emmitter {
25
25
  private isShareContent;
26
26
  private audioDeviceId;
27
27
  private videoDeviceId;
28
- private initContraints;
29
28
  private isFirefox;
29
+ private isReduceResolution;
30
30
  constructor(params: {
31
31
  logger: Logger;
32
32
  client?: Client;
@@ -111,10 +111,24 @@ export default class Stream extends Emmitter {
111
111
  * @param params
112
112
  * @returns
113
113
  */
114
- init(config?: IStreamInitConfog, params?: {
114
+ init(config?: IStreamInitConfig, params?: {
115
115
  muteVideo?: boolean;
116
116
  muteAudio?: boolean;
117
117
  }): Promise<IStatus>;
118
+ /**
119
+ * 获取content采集配置信息
120
+ *
121
+ * @param {180 | 360 | 720} resolution
122
+ * @returns
123
+ */
124
+ private getPeopleContraints;
125
+ /**
126
+ * 获取content采集配置信息
127
+ *
128
+ * @param { 720 | 1080 } resolution
129
+ * @returns
130
+ */
131
+ private getContentContraints;
118
132
  /**
119
133
  *
120
134
  * @param { boolean } video 是否开启摄像头
@@ -5,7 +5,7 @@
5
5
  * @author jinghui-Luo
6
6
  *
7
7
  * Created at : 2020-12-18 16:54:15
8
- * Last modified : 2022-01-06 20:38:55
8
+ * Last modified : 2022-06-09 17:42:49
9
9
  */
10
10
  import Logger from '../tools/logger';
11
11
  declare class VideoManager {
@@ -26,7 +26,7 @@ declare class VideoManager {
26
26
  /**
27
27
  * client set video stream data
28
28
  *
29
- * @param key endpoinId + mediagroupId => pid
29
+ * @param key endpointId + mediagroupId => pid
30
30
  * @param stream MediaStream or null
31
31
  */
32
32
  initVideoStreamById(key: string, stream: MediaStream | null): void;
@@ -34,7 +34,7 @@ declare class VideoManager {
34
34
  updateLocalTrack(): void;
35
35
  private initVideoSource;
36
36
  private setSrcObject;
37
- private initEventListerner;
37
+ private initEventListener;
38
38
  private removeEventListener;
39
39
  private initStreamTrackEventListener;
40
40
  private removeStreamTrackEventListener;
@@ -49,7 +49,7 @@ declare class VideoManager {
49
49
  private onMute;
50
50
  private onUnmute;
51
51
  private onSuspend;
52
- private onWainting;
52
+ private onWaiting;
53
53
  private onStalled;
54
54
  private onLoadeddata;
55
55
  private onVideoEnded;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Broswer version tools
2
+ * Browser version tools
3
3
  *
4
4
  * @authors Luo-jinghui (luojinghui424@gmail.com)
5
5
  * @date 2020-02-21 16:29:12
@@ -12,7 +12,6 @@ export declare const platform: () => {
12
12
  isMac: boolean;
13
13
  isWindows: boolean;
14
14
  isIPad: boolean;
15
- isPad: boolean;
16
15
  isChrome: boolean;
17
16
  isLinux: boolean;
18
17
  isFirefox: boolean;
@@ -51,6 +50,6 @@ export declare const getIOSVersion: () => {
51
50
  major: any;
52
51
  minor: any;
53
52
  } | undefined;
54
- export declare const getVerison: () => number;
53
+ export declare const getVersion: () => number;
55
54
  export declare const isPC: boolean;
56
55
  export declare const isMobile: boolean;
@@ -4,7 +4,7 @@
4
4
  * @authors Luo-jinghui (luojinghui424@gmail.com)
5
5
  * @date 2019-10-24 14:06:05
6
6
  */
7
- export declare const version = "2.0.6 - build on 2022-05-19 13:58";
7
+ export declare const version = "2.1.2-beta.7 - build on 2022-08-01 17:25";
8
8
  export declare const proxy: {
9
9
  wssHost: string;
10
10
  restHost: string;
@@ -7,19 +7,71 @@
7
7
  declare class DB {
8
8
  db: any;
9
9
  num: number;
10
- constructor();
10
+ dbName: string;
11
+ tableCount: number;
12
+ tableName: string;
13
+ constructor(tableCount?: number, tableName?: string, dbName?: string);
14
+ /**
15
+ * 表 添加数据
16
+ *
17
+ * @param data
18
+ */
11
19
  add(data: any): Promise<void>;
12
20
  deleteDB(): Promise<void>;
13
21
  close(): void;
14
22
  stop(): void;
15
23
  isOpen(): any;
24
+ /**
25
+ * 本地下载日志
26
+ *
27
+ * @returns { boolean } 日志下载是否成功
28
+ */
16
29
  export(): Promise<boolean>;
30
+ /**
31
+ * 日志上传
32
+ *
33
+ * @param { string } displayName 上传文件名
34
+ * @returns
35
+ */
17
36
  upload(displayName: string): Promise<Blob | null>;
18
37
  progressCallback({ totalRows, completedRows }: any): boolean;
19
38
  open(): void;
20
- tempStart(): Promise<void>;
39
+ /**
40
+ * 初始化db
41
+ */
21
42
  init(): Promise<void>;
22
- initStores(log: any): void;
43
+ /**
44
+ * 获取需要在某个版本中添加的表。
45
+ *
46
+ * @param {string} field 表 字段
47
+ * @returns 表对象 每个键代表一个表名,每个值代表主键,后跟索引属性列表
48
+ */
49
+ getStores(field: string): {
50
+ [key: string]: string;
51
+ };
52
+ /**
53
+ * 创建表
54
+ *
55
+ * @param log
56
+ */
57
+ initStores(): void;
58
+ /**
59
+ * 存储日志版本
60
+ *
61
+ * @param version
62
+ */
63
+ setLogVersion(version: number): void;
64
+ /**
65
+ * 升级数据库
66
+ *
67
+ * @param log
68
+ */
69
+ upgradeStores({ version, tableCount, tableName, field }?: {
70
+ version?: number | undefined;
71
+ tableCount?: number | undefined;
72
+ tableName?: string | undefined;
73
+ field?: string | undefined;
74
+ }): void;
23
75
  /**
24
76
  * Generate zip blob use json's blob async
25
77
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * webrtc axiox request lib
2
+ * webrtc axios request lib
3
3
  *
4
4
  * @authors Luo-jinghui (luojinghui424@gmail.com)
5
5
  * @date 2019-11-01 14:14:45
@@ -27,22 +27,35 @@ declare class HttpClient {
27
27
  logger: Logger | null;
28
28
  private baseUrl;
29
29
  private clientId;
30
+ private clientSecret;
30
31
  private retryCount;
31
32
  constructor(commonOption: IAxiosRequestConfig);
32
33
  refreshToken(baseURL?: string): Promise<any>;
33
34
  setLogger(logger: Logger): void;
34
35
  setBaseUrl(url: string): void;
35
- setClientId(clientId: string): void;
36
+ setClientInfo({ clientId, clientSecret }: {
37
+ clientId: string;
38
+ clientSecret: string;
39
+ }): void;
36
40
  setHttpConfig(config: IAxiosRequestConfig): void;
37
- setHeader(params: ISignParams): any;
41
+ getApiHeader(params: ISignParams): {
42
+ Authorization?: string | undefined;
43
+ 'x-xy-clientid': string;
44
+ 'x-xy-clienttype': string;
45
+ 'x-xy-nonce': number;
46
+ 'x-xy-timestamp': number;
47
+ 'x-xy-signtype': string;
48
+ 'x-xy-sign': string;
49
+ 'x-xy-signatureversion': string;
50
+ };
38
51
  setLoginInfo(loginInfo: IToken | null): void;
39
52
  getLoginInfo(): any;
40
- assignOptions: (option?: AxiosRequestConfig | undefined) => AxiosRequestConfig & {
53
+ assignOptions: (option?: AxiosRequestConfig) => AxiosRequestConfig & {
41
54
  params: any;
42
55
  };
43
- get: (url: string, option?: IAxiosRequestConfig | undefined) => any;
44
- put: (url: string, data?: any, option?: AxiosRequestConfig | undefined) => any;
45
- post: (url: string, data?: any, option?: AxiosRequestConfig | undefined) => any;
46
- delete: (url: string, option?: AxiosRequestConfig | undefined) => any;
56
+ get: (url: string, option?: IAxiosRequestConfig) => any;
57
+ put: (url: string, data?: any, option?: AxiosRequestConfig) => any;
58
+ post: (url: string, data?: any, option?: AxiosRequestConfig) => any;
59
+ delete: (url: string, option?: AxiosRequestConfig) => any;
47
60
  }
48
61
  export default HttpClient;
@@ -131,8 +131,7 @@ declare class Logger {
131
131
  */
132
132
  downloadLog: () => Promise<void>;
133
133
  /**
134
- * Upload sdk log file to redmine platform
135
- * redmine url: http://172.20.33.81:8080/redmine/projects/crashandupload/issues
134
+ * Upload sdk log file to devops
136
135
  *
137
136
  * @public
138
137
  * @param { string } name 上传文件名
@@ -33,7 +33,7 @@ declare class Socket {
33
33
  removeEvent(): void;
34
34
  onOpenSocket: (e: any) => void;
35
35
  onHandleMessage: (e: any) => void;
36
- onCloseSocket: (e: any) => void;
36
+ onCloseSocket: (e: CloseEvent) => void;
37
37
  onErrorSocket: (e: any) => void;
38
38
  sendHeartBeat(): void;
39
39
  creatTimeout(): void;
@@ -43,7 +43,7 @@ declare class Socket {
43
43
  reset(): void;
44
44
  on(type: string, fn: any): void;
45
45
  close(isReconnect?: boolean): void;
46
- send(data: any, parase?: boolean, isLog?: boolean): void;
46
+ send(data: any, parse?: boolean, isLog?: boolean): void;
47
47
  stopCall(): void;
48
48
  reConnect(): void;
49
49
  }
@@ -51,4 +51,17 @@ export declare const getStatus: (code: string, detail?: any, msg?: string) => {
51
51
  msg: string;
52
52
  detail: any;
53
53
  };
54
- export declare const getErrorMsg: (err: Error) => string;
54
+ export declare const getMeetingStatus: (success: boolean, code?: string, msg?: string) => {
55
+ success: boolean;
56
+ data: {
57
+ code: string;
58
+ msg: string | undefined;
59
+ };
60
+ } | {
61
+ success: boolean;
62
+ data: {
63
+ code?: undefined;
64
+ msg?: undefined;
65
+ };
66
+ };
67
+ export declare const hideKeyInfo: (data: any, key: string | string[]) => any;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 校验 request 参数
3
+ *
4
+ * @param reqList
5
+ * @returns isValid true:有效, false: 无效
6
+ */
7
+ export declare const verifyReqListParams: (reqList: any) => boolean;
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * @property { string } code 错误码
5
5
  * @property { string } msg 错误信息
6
- * @property { unknwn } detail 数据详情
6
+ * @property { any } detail 数据详情
7
7
  */
8
8
  export interface IStatus {
9
9
  code: string;
@@ -33,7 +33,7 @@ export interface ICheckSystemRequirements {
33
33
  */
34
34
  export interface IToken {
35
35
  access_token: string;
36
- signSecret?: string;
36
+ signSecret: string;
37
37
  refresh_token?: string;
38
38
  domain?: string;
39
39
  expires_in?: number;
@@ -47,17 +47,21 @@ export declare type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEA
47
47
  *
48
48
  * @property { Method } method 请求方法
49
49
  * @property { string } url 请求url, 包含query参数
50
- * @property { string } data 请求体, 需进行json转换, 无请求体,则传入""
50
+ * @property { string } body 请求体, 需进行json转换, 无请求体,则传入""
51
51
  * @property { string } clientId
52
52
  * @property { string } clienttype
53
53
  * @property { string } clientSecret 签名秘钥: 此密钥为网关平台颁发的ClientSecret. 未登录时,需传入此值
54
- * @property { string } access_token 需进行token校验的,必须传入此值
54
+ * @property { string } token 需进行token校验的,必须传入此值
55
+ * @property { string } signSecret 需进行token校验的,必须传入此值
55
56
  */
56
57
  export interface ISignParams {
57
58
  method: string;
58
59
  url: string;
59
- data: string;
60
+ body: string;
60
61
  clientId: string;
62
+ clienttype: string;
61
63
  clientSecret: string;
62
- access_token: string;
64
+ token: string;
65
+ signSecret: string;
63
66
  }
67
+ export declare type Key = string | number;