@xylink/xy-rtc-sdk 2.0.4 → 2.0.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.
- package/lib/index.es.js +3 -0
- package/lib/index.js +3 -1
- package/lib/src/action/index.d.ts +4 -3
- package/lib/src/enum/errorCode.d.ts +3 -0
- package/lib/src/enum/index.d.ts +13 -5
- package/lib/src/main/client.d.ts +27 -5
- package/lib/src/main/helper.d.ts +1 -1
- package/lib/src/main/layoutManager.d.ts +2 -1
- package/lib/src/main/peer.d.ts +25 -4
- package/lib/src/main/stream.d.ts +13 -1
- package/lib/src/main/videoManager.d.ts +1 -1
- package/lib/src/tools/browser.d.ts +3 -1
- package/lib/src/tools/config.d.ts +1 -1
- package/lib/src/tools/detect.d.ts +1 -0
- package/lib/src/tools/httpClient.d.ts +15 -15
- package/lib/src/tools/socket.d.ts +6 -3
- package/lib/src/tools/utils.d.ts +2 -2
- package/lib/src/type/base.d.ts +36 -2
- package/lib/src/type/client.d.ts +11 -1
- package/package.json +3 -2
- package/lib/index.cjs.js +0 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @authors Luo-jinghui (luojinghui424@gmail.com)
|
|
5
5
|
* @date 2019-10-30 14:14:04
|
|
6
6
|
*/
|
|
7
|
-
import { ILoginExtAccount, ISdkUserInfo, TStateAction, TEventName, IMeetingInfo, TCategory } from '../type';
|
|
7
|
+
import { ILoginExtAccount, ISdkUserInfo, TStateAction, TEventName, IMeetingInfo, TCategory, IToken } from '../type';
|
|
8
8
|
import Logger from '../tools/logger';
|
|
9
9
|
export interface ICommonParams {
|
|
10
10
|
securityKey: string;
|
|
@@ -22,6 +22,8 @@ declare class Action {
|
|
|
22
22
|
setClientId(clientId: string): void;
|
|
23
23
|
setLogger(logger: Logger): void;
|
|
24
24
|
setMeetingInfo(info: IMeetingInfo): void;
|
|
25
|
+
setLoginInfo(loginInfo: IToken | null): void;
|
|
26
|
+
getLoginInfo(): IToken;
|
|
25
27
|
upload(data: any): Promise<any>;
|
|
26
28
|
/**
|
|
27
29
|
* 获取小鱼世界账号密码
|
|
@@ -31,12 +33,11 @@ declare class Action {
|
|
|
31
33
|
*/
|
|
32
34
|
login(sdkUserInfo: ISdkUserInfo): Promise<any>;
|
|
33
35
|
/**
|
|
34
|
-
*
|
|
36
|
+
* 获取匿名账号
|
|
35
37
|
*
|
|
36
38
|
* @param params
|
|
37
39
|
*/
|
|
38
40
|
getSdkUserInfo(params: ILoginExtAccount): Promise<any>;
|
|
39
|
-
setLoginInfo(loginInfo: any): void;
|
|
40
41
|
getUserInfo(token: string): Promise<any>;
|
|
41
42
|
getCallUri(params: any): Promise<any>;
|
|
42
43
|
verifyPassword(confNumber: string, password: string): Promise<any>;
|
package/lib/src/enum/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare const DEVICE_TYPE = 17;
|
|
|
10
10
|
export declare const SELF_MOCK_PID = 9999999999;
|
|
11
11
|
export declare const STREAM_CHANNEL_COUNT = 11;
|
|
12
12
|
export declare const MAX_PARTICIPANT_COUNT = 112;
|
|
13
|
-
export declare const STREAM_ERROR_CODE_MAP:
|
|
13
|
+
export declare const STREAM_ERROR_CODE_MAP: string[];
|
|
14
14
|
export declare const SUPPORT_DEVICE_TYPE: string[];
|
|
15
15
|
export declare const MAX_PAGE_SIZE = 9;
|
|
16
16
|
export declare const NETWORK_TYPE_MAP: {
|
|
@@ -55,12 +55,12 @@ export declare const FIREFOX_CONTENT_CONTRAINTS: {
|
|
|
55
55
|
logicalSurface: true;
|
|
56
56
|
};
|
|
57
57
|
max: {
|
|
58
|
-
frameRate: number;
|
|
59
58
|
width: number;
|
|
60
59
|
height: number;
|
|
61
60
|
cursor: string;
|
|
62
61
|
aspectRatio: number;
|
|
63
62
|
resizeMode: "crop-and-scale";
|
|
63
|
+
frameRate: ConstrainDouble;
|
|
64
64
|
logicalSurface: true;
|
|
65
65
|
};
|
|
66
66
|
};
|
|
@@ -75,12 +75,12 @@ export declare const FIREFOX_CONTENT_CONTRAINTS: {
|
|
|
75
75
|
logicalSurface: true;
|
|
76
76
|
};
|
|
77
77
|
max: {
|
|
78
|
-
frameRate: number;
|
|
79
78
|
width: number;
|
|
80
79
|
height: number;
|
|
81
80
|
cursor: string;
|
|
82
81
|
aspectRatio: number;
|
|
83
82
|
resizeMode: "crop-and-scale";
|
|
83
|
+
frameRate: ConstrainDouble;
|
|
84
84
|
logicalSurface: true;
|
|
85
85
|
};
|
|
86
86
|
};
|
|
@@ -97,12 +97,12 @@ export declare const CONTENT_CONTRAINTS: {
|
|
|
97
97
|
logicalSurface: true;
|
|
98
98
|
};
|
|
99
99
|
max: {
|
|
100
|
-
frameRate: number;
|
|
101
100
|
width: number;
|
|
102
101
|
height: number;
|
|
103
102
|
cursor: string;
|
|
104
103
|
aspectRatio: number;
|
|
105
104
|
resizeMode: "crop-and-scale";
|
|
105
|
+
frameRate: ConstrainDouble;
|
|
106
106
|
logicalSurface: true;
|
|
107
107
|
};
|
|
108
108
|
};
|
|
@@ -117,12 +117,12 @@ export declare const CONTENT_CONTRAINTS: {
|
|
|
117
117
|
logicalSurface: true;
|
|
118
118
|
};
|
|
119
119
|
max: {
|
|
120
|
-
frameRate: number;
|
|
121
120
|
width: number;
|
|
122
121
|
height: number;
|
|
123
122
|
cursor: string;
|
|
124
123
|
aspectRatio: number;
|
|
125
124
|
resizeMode: "crop-and-scale";
|
|
125
|
+
frameRate: ConstrainDouble;
|
|
126
126
|
logicalSurface: true;
|
|
127
127
|
};
|
|
128
128
|
};
|
|
@@ -218,3 +218,11 @@ export declare const APP_NAME: {
|
|
|
218
218
|
export declare const EVENT_TYPE_MAP: {
|
|
219
219
|
[key: string]: string;
|
|
220
220
|
};
|
|
221
|
+
export declare const CONTENT_AUDIO_OFFER_STATE: {
|
|
222
|
+
NOT_SEND: number;
|
|
223
|
+
SEND: number;
|
|
224
|
+
SENDED: number;
|
|
225
|
+
};
|
|
226
|
+
export declare const SCALE_RESOLUTION_MAP: {
|
|
227
|
+
[key: string]: number;
|
|
228
|
+
};
|
package/lib/src/main/client.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @authors Luo-jinghui (luojinghui424@gmail.com)
|
|
5
5
|
* @date 2019-10-23 12:04:44
|
|
6
6
|
*/
|
|
7
|
-
import { IClientConfig, IMackCall, IInvite, IRoster, ILayoutRoster, ISpeakerInfo, IScreenInfo, IServers, ILoginExtAccount, ISdkUserInfo, IPublishParams, ICustomLayout, ICustomStreamTrack, IInternels, IVideoAudioType, ISahreContentStatus, IPushType, IMode, IReqInfo, TCommand, ILayout, IConference } from '../type';
|
|
7
|
+
import { IClientConfig, IMackCall, IInvite, IRoster, ILayoutRoster, ISpeakerInfo, IScreenInfo, IServers, ILoginExtAccount, ISdkUserInfo, IPublishParams, ICustomLayout, ICustomStreamTrack, IInternels, IVideoAudioType, ISahreContentStatus, IPushType, IMode, IReqInfo, TCommand, ILayout, IConference, IContentMode } from '../type';
|
|
8
8
|
import Emmitter from '../tools/emmitter';
|
|
9
9
|
import Socket from '../tools/socket';
|
|
10
10
|
import Stream from './stream';
|
|
@@ -67,6 +67,8 @@ export default class Client extends Emmitter {
|
|
|
67
67
|
private meetingQualityData;
|
|
68
68
|
private conferenceInfo;
|
|
69
69
|
private customLayoutCacheList;
|
|
70
|
+
private contentMode;
|
|
71
|
+
private isSubscribeBulkRoster;
|
|
70
72
|
private onDocumentChange;
|
|
71
73
|
constructor(config: IClientConfig, servers: IServers, logger: Logger);
|
|
72
74
|
static instance: Client;
|
|
@@ -77,10 +79,10 @@ export default class Client extends Emmitter {
|
|
|
77
79
|
quality: number;
|
|
78
80
|
mediagroupid: number;
|
|
79
81
|
};
|
|
80
|
-
static getMeetingStatus(success: boolean, code?:
|
|
82
|
+
static getMeetingStatus(success: boolean, code?: string, msg?: string): {
|
|
81
83
|
success: boolean;
|
|
82
84
|
data: {
|
|
83
|
-
code:
|
|
85
|
+
code: string;
|
|
84
86
|
msg: string | undefined;
|
|
85
87
|
};
|
|
86
88
|
} | {
|
|
@@ -111,6 +113,12 @@ export default class Client extends Emmitter {
|
|
|
111
113
|
getOnHold(): boolean;
|
|
112
114
|
getLayoutList(): Map<string, ILayout> | undefined;
|
|
113
115
|
getSelfRoster(): IRoster | undefined;
|
|
116
|
+
/**
|
|
117
|
+
* 退会时 重置初始化参数
|
|
118
|
+
*
|
|
119
|
+
*/
|
|
120
|
+
resetInitParameter(): void;
|
|
121
|
+
setContentMode(mode: IContentMode): void;
|
|
114
122
|
/**
|
|
115
123
|
* 切换显示/隐藏 Local 画面
|
|
116
124
|
*
|
|
@@ -135,6 +143,13 @@ export default class Client extends Emmitter {
|
|
|
135
143
|
* @param { string } wrapEle 包裹video组件的元素id,此元素一定要提供宽高信息,内部会基于此宽高信息计算video的旋转信息
|
|
136
144
|
*/
|
|
137
145
|
setVideoRenderer(key: string, wrapEleId: string): void;
|
|
146
|
+
/**
|
|
147
|
+
* 移除绑定的streamId
|
|
148
|
+
*
|
|
149
|
+
* @param { string } key endpoinId + mediagroupId 唯一的用户id值
|
|
150
|
+
* @param { string } wrapEle 包裹video组件的元素id,此元素一定要提供宽高信息,内部会基于此宽高信息计算video的旋转信息
|
|
151
|
+
*/
|
|
152
|
+
removeVideoRender(key: string, wrapEleId: string): void;
|
|
138
153
|
/**
|
|
139
154
|
* 重新播放视频
|
|
140
155
|
*
|
|
@@ -270,7 +285,7 @@ export default class Client extends Emmitter {
|
|
|
270
285
|
* @param { string } password
|
|
271
286
|
*/
|
|
272
287
|
getExternalLoginInfo(sdkUserInfo: ISdkUserInfo, params: ILoginExtAccount): Promise<{
|
|
273
|
-
code:
|
|
288
|
+
code: string;
|
|
274
289
|
msg: string;
|
|
275
290
|
detail: any;
|
|
276
291
|
}>;
|
|
@@ -365,6 +380,12 @@ export default class Client extends Emmitter {
|
|
|
365
380
|
*/
|
|
366
381
|
onMute(): Promise<boolean>;
|
|
367
382
|
private onHand;
|
|
383
|
+
/**
|
|
384
|
+
* 告知媒体是否开启出入会通知
|
|
385
|
+
*
|
|
386
|
+
* @private
|
|
387
|
+
*/
|
|
388
|
+
private sendConfParam;
|
|
368
389
|
/**
|
|
369
390
|
* 获取可支持的编解码
|
|
370
391
|
*
|
|
@@ -418,7 +439,7 @@ export default class Client extends Emmitter {
|
|
|
418
439
|
* 当websocket error,挂断会议
|
|
419
440
|
*
|
|
420
441
|
* @private
|
|
421
|
-
* @param {
|
|
442
|
+
* @param { string } code 错误码
|
|
422
443
|
*/
|
|
423
444
|
private disconnectInWssError;
|
|
424
445
|
/**
|
|
@@ -627,6 +648,7 @@ export default class Client extends Emmitter {
|
|
|
627
648
|
* @public
|
|
628
649
|
*/
|
|
629
650
|
subscribeBulkRoster(): Promise<unknown>;
|
|
651
|
+
reSendContentOffer(): void;
|
|
630
652
|
/**
|
|
631
653
|
* 定时上报会议质量、网络数据
|
|
632
654
|
*
|
package/lib/src/main/helper.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @email luojinghui424@gmail.com
|
|
6
6
|
*
|
|
7
7
|
* Created at : 2021-01-09 14:45:46
|
|
8
|
-
* Last modified : 2021-
|
|
8
|
+
* Last modified : 2021-12-08 11:16:01
|
|
9
9
|
*/
|
|
10
10
|
import { ILayout, IVideoManagerState, IRotationInfoTotalItem } from '../type';
|
|
11
11
|
export declare const getLayoutItemState: (item: ILayout | ILayout, stream: MediaStream | null, vmState: IVideoManagerState) => "REQUEST" | "MUTE" | "NORMAL" | "AUDIO_TEL" | "AUDIO_ONLY" | "AUDIO_CONTENT";
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @email luojinghui424@gmail.com
|
|
7
7
|
*
|
|
8
8
|
* Created at : 2021-01-05 17:24:07
|
|
9
|
-
* Last modified :
|
|
9
|
+
* Last modified : 2022-01-04 23:32:36
|
|
10
10
|
*/
|
|
11
11
|
import Logger from '../tools/logger';
|
|
12
12
|
import { ILayout, IVideoRenders, IRoster, ITemplateObj, IScreenInfo, IMode, IOutputCustomLayout, ILayoutRoster, IResolutionType, IConfInfo, IPageInfo, IReqInfo, IQualityType, ICustomLayout } from '../type/index';
|
|
@@ -87,6 +87,7 @@ export default class LayoutManager {
|
|
|
87
87
|
* @param wrapEleId wrap video element id
|
|
88
88
|
*/
|
|
89
89
|
setVideoRenderer(key: string, wrapEleId: string): void;
|
|
90
|
+
removeVideoRenderer(key: string, wrapEleId: string): void;
|
|
90
91
|
playVideo(keys?: string[]): Promise<void>;
|
|
91
92
|
updateLocalTrack(): void;
|
|
92
93
|
/**
|
package/lib/src/main/peer.d.ts
CHANGED
|
@@ -30,6 +30,9 @@ export default class Peer {
|
|
|
30
30
|
private internels;
|
|
31
31
|
private isShareContent;
|
|
32
32
|
private senderInterval;
|
|
33
|
+
private isResendContentOffer;
|
|
34
|
+
private isRestartIceConnection;
|
|
35
|
+
private isFirstConnected;
|
|
33
36
|
constructor(client: Client, stream: Stream);
|
|
34
37
|
getInternels(): IInternels;
|
|
35
38
|
/**
|
|
@@ -45,7 +48,7 @@ export default class Peer {
|
|
|
45
48
|
*
|
|
46
49
|
* @private
|
|
47
50
|
* @param { string } type 消息Key
|
|
48
|
-
* @param {
|
|
51
|
+
* @param { string } code 状态码
|
|
49
52
|
* @param { string } msg 消息内容
|
|
50
53
|
* @param { any } detail 消息数据
|
|
51
54
|
*/
|
|
@@ -106,7 +109,7 @@ export default class Peer {
|
|
|
106
109
|
* @param { number } bandwidth 需要限定的带宽值
|
|
107
110
|
* @param { boolean } isIncreaseBase 带宽是否需要✖️系数1000
|
|
108
111
|
*/
|
|
109
|
-
setBandWidth(trackId: string, bandwidth
|
|
112
|
+
setBandWidth(trackId: string, bandwidth: number | undefined, isIncreaseBase: boolean | undefined, stream: MediaStream | null): Promise<void>;
|
|
110
113
|
/**
|
|
111
114
|
* View the cb of ice connectionn status change
|
|
112
115
|
* Maybe status:'new', 'checking', 'connected', 'completed', 'failed', 'disconnected', 'closed'
|
|
@@ -128,7 +131,7 @@ export default class Peer {
|
|
|
128
131
|
*
|
|
129
132
|
* @public
|
|
130
133
|
*/
|
|
131
|
-
restartIceConnection(): Promise<void>;
|
|
134
|
+
restartIceConnection(isRestartIceConnection?: boolean): Promise<void>;
|
|
132
135
|
/**
|
|
133
136
|
* 关闭PeerConnection连接、销毁状态
|
|
134
137
|
*/
|
|
@@ -141,6 +144,8 @@ export default class Peer {
|
|
|
141
144
|
* @param { IPushType } pushType 推送类型,all全推送,video只推送video,audio只推送audio, content只推送content video流
|
|
142
145
|
*/
|
|
143
146
|
publish(stream: Stream, pushType?: IPushType): void;
|
|
147
|
+
reSendContentOffer(): void;
|
|
148
|
+
resetContentStream(contentStreams: IStreamObj[]): void;
|
|
144
149
|
/**
|
|
145
150
|
* 替换People Video Track轨道
|
|
146
151
|
*
|
|
@@ -197,6 +202,15 @@ export default class Peer {
|
|
|
197
202
|
* @param { IStreamObj } item 自定义Stream流对象
|
|
198
203
|
*/
|
|
199
204
|
private addStreamRenders;
|
|
205
|
+
/**
|
|
206
|
+
* 向peer添加Track轨道数据
|
|
207
|
+
*
|
|
208
|
+
* @private
|
|
209
|
+
* @param { TCustomStream | MediaStreamTrack } track Track轨道数据
|
|
210
|
+
* @param { RTCRtpTransceiverDirection } direction 指定添加到peer上的方向
|
|
211
|
+
* @param { IStreamObj } item 自定义Stream流对象
|
|
212
|
+
*/
|
|
213
|
+
private addTransceiverByPeer;
|
|
200
214
|
/**
|
|
201
215
|
* 关联自定义stream对象和Sender发送器数据
|
|
202
216
|
*
|
|
@@ -214,7 +228,14 @@ export default class Peer {
|
|
|
214
228
|
*/
|
|
215
229
|
private replaceAudioTrack;
|
|
216
230
|
/**
|
|
217
|
-
*
|
|
231
|
+
* 替换视频Track轨道
|
|
232
|
+
*
|
|
233
|
+
* @private
|
|
234
|
+
* @param { IStreamObj[] } streamList 自定义媒体流对象列表数据
|
|
235
|
+
*/
|
|
236
|
+
private replaceVideoTrack;
|
|
237
|
+
/**
|
|
238
|
+
* Replace all Track
|
|
218
239
|
*
|
|
219
240
|
* @private
|
|
220
241
|
* @param { IStreamObj[] } streamList 自定义媒体流对象列表数据
|
package/lib/src/main/stream.d.ts
CHANGED
|
@@ -25,6 +25,8 @@ export default class Stream extends Emmitter {
|
|
|
25
25
|
private isShareContent;
|
|
26
26
|
private audioDeviceId;
|
|
27
27
|
private videoDeviceId;
|
|
28
|
+
private initContraints;
|
|
29
|
+
private isFirefox;
|
|
28
30
|
constructor(params: {
|
|
29
31
|
logger: Logger;
|
|
30
32
|
client?: Client;
|
|
@@ -152,6 +154,11 @@ export default class Stream extends Emmitter {
|
|
|
152
154
|
* 3. 初始化remote画面
|
|
153
155
|
*/
|
|
154
156
|
initRemoteStreams(stream: MediaStream | null): Promise<void>;
|
|
157
|
+
/**
|
|
158
|
+
* firefox 采流
|
|
159
|
+
* @param stream
|
|
160
|
+
*/
|
|
161
|
+
initFirefoxRemoteStreams(stream: MediaStream): Promise<void>;
|
|
155
162
|
/**
|
|
156
163
|
* 1. 初始化本地Local画面
|
|
157
164
|
*/
|
|
@@ -169,8 +176,13 @@ export default class Stream extends Emmitter {
|
|
|
169
176
|
closeContentStream(): void;
|
|
170
177
|
/**
|
|
171
178
|
* 创建share content stream
|
|
179
|
+
*
|
|
180
|
+
* @public
|
|
181
|
+
* @param { { screenAudio : boolean } } screenAudio 是否开启共享屏幕声音
|
|
172
182
|
*/
|
|
173
|
-
createContentStream(
|
|
183
|
+
createContentStream({ screenAudio }?: {
|
|
184
|
+
screenAudio: boolean;
|
|
185
|
+
}): Promise<IStreamObj[]>;
|
|
174
186
|
electronCapture(selectedSourceId: string): Promise<unknown>;
|
|
175
187
|
getElectronContentSources(desktopCapturer: any, types?: any): Promise<ISource[] | any>;
|
|
176
188
|
/**
|
|
@@ -11,7 +11,7 @@ export declare const platform: () => {
|
|
|
11
11
|
isPc: boolean;
|
|
12
12
|
isMac: boolean;
|
|
13
13
|
isWindows: boolean;
|
|
14
|
-
|
|
14
|
+
isIPad: boolean;
|
|
15
15
|
isChrome: boolean;
|
|
16
16
|
isLinux: boolean;
|
|
17
17
|
isFirefox: boolean;
|
|
@@ -51,3 +51,5 @@ export declare const getIOSVersion: () => {
|
|
|
51
51
|
minor: any;
|
|
52
52
|
} | undefined;
|
|
53
53
|
export declare const getVerison: () => number;
|
|
54
|
+
export declare const isPC: boolean;
|
|
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.
|
|
7
|
+
export declare const version = "2.0.7 - build on 2022-08-26 17:25";
|
|
8
8
|
export declare const proxy: {
|
|
9
9
|
wssHost: string;
|
|
10
10
|
restHost: string;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* webrtc
|
|
2
|
+
* webrtc axios request lib
|
|
3
3
|
*
|
|
4
4
|
* @authors Luo-jinghui (luojinghui424@gmail.com)
|
|
5
5
|
* @date 2019-11-01 14:14:45
|
|
6
6
|
*/
|
|
7
7
|
import { AxiosRequestConfig, AxiosInstance } from 'axios';
|
|
8
8
|
import Logger from '../tools/logger';
|
|
9
|
+
import { IToken, ISignParams } from '../type';
|
|
9
10
|
export interface IResponseSuccess {
|
|
10
11
|
code: number;
|
|
11
12
|
data: any;
|
|
@@ -14,15 +15,8 @@ export interface IResponseFailed {
|
|
|
14
15
|
code: number;
|
|
15
16
|
data: any;
|
|
16
17
|
}
|
|
17
|
-
export interface ISignParams {
|
|
18
|
-
method: string;
|
|
19
|
-
url: string;
|
|
20
|
-
data: string;
|
|
21
|
-
clientId: string;
|
|
22
|
-
clientSecret: string;
|
|
23
|
-
}
|
|
24
18
|
export interface IAxiosRequestConfig extends AxiosRequestConfig {
|
|
25
|
-
sign?: 0 | 1
|
|
19
|
+
sign?: 0 | 1;
|
|
26
20
|
clientSecret?: string;
|
|
27
21
|
clientId?: string;
|
|
28
22
|
}
|
|
@@ -33,19 +27,25 @@ declare class HttpClient {
|
|
|
33
27
|
logger: Logger | null;
|
|
34
28
|
private baseUrl;
|
|
35
29
|
private clientId;
|
|
30
|
+
private retryCount;
|
|
36
31
|
constructor(commonOption: IAxiosRequestConfig);
|
|
32
|
+
refreshToken({ baseURL, refresh_token }: {
|
|
33
|
+
baseURL?: string | undefined;
|
|
34
|
+
refresh_token?: string | undefined;
|
|
35
|
+
}): Promise<any>;
|
|
37
36
|
setLogger(logger: Logger): void;
|
|
38
37
|
setBaseUrl(url: string): void;
|
|
39
38
|
setClientId(clientId: string): void;
|
|
40
39
|
setHttpConfig(config: IAxiosRequestConfig): void;
|
|
41
40
|
setHeader(params: ISignParams): any;
|
|
42
|
-
setLoginInfo(loginInfo:
|
|
43
|
-
|
|
41
|
+
setLoginInfo(loginInfo: IToken | null): void;
|
|
42
|
+
getLoginInfo(): any;
|
|
43
|
+
assignOptions: (option?: AxiosRequestConfig) => AxiosRequestConfig & {
|
|
44
44
|
params: any;
|
|
45
45
|
};
|
|
46
|
-
get: (url: string, option?: IAxiosRequestConfig
|
|
47
|
-
put: (url: string, data?: any, option?: AxiosRequestConfig
|
|
48
|
-
post: (url: string, data?: any, option?: AxiosRequestConfig
|
|
49
|
-
delete: (url: string, option?: AxiosRequestConfig
|
|
46
|
+
get: (url: string, option?: IAxiosRequestConfig) => any;
|
|
47
|
+
put: (url: string, data?: any, option?: AxiosRequestConfig) => any;
|
|
48
|
+
post: (url: string, data?: any, option?: AxiosRequestConfig) => any;
|
|
49
|
+
delete: (url: string, option?: AxiosRequestConfig) => any;
|
|
50
50
|
}
|
|
51
51
|
export default HttpClient;
|
|
@@ -27,23 +27,26 @@ declare class Socket {
|
|
|
27
27
|
private isClose;
|
|
28
28
|
private logger;
|
|
29
29
|
private client;
|
|
30
|
+
private reconnectOffset;
|
|
31
|
+
private reconnectTimer;
|
|
30
32
|
constructor(options: socketOptions, client: any);
|
|
31
33
|
connect(isReconnect?: boolean): void;
|
|
32
34
|
addEvent(): void;
|
|
33
35
|
removeEvent(): void;
|
|
34
36
|
onOpenSocket: (e: any) => void;
|
|
35
37
|
onHandleMessage: (e: any) => void;
|
|
36
|
-
onCloseSocket: (e:
|
|
38
|
+
onCloseSocket: (e: CloseEvent) => void;
|
|
37
39
|
onErrorSocket: (e: any) => void;
|
|
38
40
|
sendHeartBeat(): void;
|
|
39
|
-
|
|
41
|
+
clearTimeout(): void;
|
|
40
42
|
emit(type: string, data: any): void;
|
|
41
43
|
clearPangTimer(): void;
|
|
42
44
|
clearBeatTimer(): void;
|
|
45
|
+
clearReconnectTimer(): void;
|
|
43
46
|
reset(): void;
|
|
44
47
|
on(type: string, fn: any): void;
|
|
45
48
|
close(isReconnect?: boolean): void;
|
|
46
|
-
send(data: any,
|
|
49
|
+
send(data: any, parse?: boolean, isLog?: boolean): void;
|
|
47
50
|
stopCall(): void;
|
|
48
51
|
reConnect(): void;
|
|
49
52
|
}
|
package/lib/src/tools/utils.d.ts
CHANGED
|
@@ -46,8 +46,8 @@ export declare const diffTime: (time1: number, time2: number, format?: string) =
|
|
|
46
46
|
export declare function mapToObj<T>(data: Map<string, T>): {
|
|
47
47
|
[key: string]: T;
|
|
48
48
|
};
|
|
49
|
-
export declare const getStatus: (code:
|
|
50
|
-
code:
|
|
49
|
+
export declare const getStatus: (code: string, detail?: any, msg?: string) => {
|
|
50
|
+
code: string;
|
|
51
51
|
msg: string;
|
|
52
52
|
detail: any;
|
|
53
53
|
};
|
package/lib/src/type/base.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* SDK对外回调错误消息
|
|
3
3
|
*
|
|
4
|
-
* @property {
|
|
4
|
+
* @property { string } code 错误码
|
|
5
5
|
* @property { string } msg 错误信息
|
|
6
6
|
* @property { unknwn } detail 数据详情
|
|
7
7
|
*/
|
|
8
8
|
export interface IStatus {
|
|
9
|
-
code:
|
|
9
|
+
code: string;
|
|
10
10
|
msg: string;
|
|
11
11
|
detail: any;
|
|
12
12
|
}
|
|
@@ -27,3 +27,37 @@ export interface ICheckSystemRequirements {
|
|
|
27
27
|
isSupportBrowser: boolean;
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* token 信息
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
export interface IToken {
|
|
35
|
+
access_token: string;
|
|
36
|
+
signSecret?: string;
|
|
37
|
+
refresh_token?: string;
|
|
38
|
+
domain?: string;
|
|
39
|
+
expires_in?: number;
|
|
40
|
+
openid?: string;
|
|
41
|
+
scope?: string;
|
|
42
|
+
token_type?: string;
|
|
43
|
+
}
|
|
44
|
+
export declare type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
45
|
+
/**
|
|
46
|
+
* API网关 签名参数
|
|
47
|
+
*
|
|
48
|
+
* @property { Method } method 请求方法
|
|
49
|
+
* @property { string } url 请求url, 包含query参数
|
|
50
|
+
* @property { string } data 请求体, 需进行json转换, 无请求体,则传入""
|
|
51
|
+
* @property { string } clientId
|
|
52
|
+
* @property { string } clienttype
|
|
53
|
+
* @property { string } clientSecret 签名秘钥: 此密钥为网关平台颁发的ClientSecret. 未登录时,需传入此值
|
|
54
|
+
* @property { string } access_token 需进行token校验的,必须传入此值
|
|
55
|
+
*/
|
|
56
|
+
export interface ISignParams {
|
|
57
|
+
method: string;
|
|
58
|
+
url: string;
|
|
59
|
+
data: string;
|
|
60
|
+
clientId: string;
|
|
61
|
+
clientSecret: string;
|
|
62
|
+
access_token: string;
|
|
63
|
+
}
|
package/lib/src/type/client.d.ts
CHANGED
|
@@ -110,6 +110,15 @@ export declare type IVideoAudioMessageType = 'AUDIO_MUTE' | 'VIDEO_MUTE' | 'AUDI
|
|
|
110
110
|
* @value AUDIO_CONTENT 仅音频共享
|
|
111
111
|
*/
|
|
112
112
|
export declare type ILayoutState = 'MUTE' | 'REQUEST' | 'NORMAL' | 'INVALID' | 'AUDIO_TEL' | 'AUDIO_ONLY' | 'AUDIO_CONTENT';
|
|
113
|
+
/**
|
|
114
|
+
* 分享content类型
|
|
115
|
+
*
|
|
116
|
+
* @value NONE 无
|
|
117
|
+
* @value AUDIO 只分享audio
|
|
118
|
+
* @value VIDEO 只分享video
|
|
119
|
+
* @value BOTH 分享video + audio
|
|
120
|
+
*/
|
|
121
|
+
export declare type IContentMode = 'NONE' | 'AUDIO' | 'VIDEO' | 'BOTH';
|
|
113
122
|
/**
|
|
114
123
|
* 埋点数据上报类型
|
|
115
124
|
*
|
|
@@ -442,9 +451,10 @@ export interface IHttpConfig {
|
|
|
442
451
|
export interface IConfig {
|
|
443
452
|
client_id: string;
|
|
444
453
|
access_token: string;
|
|
454
|
+
signSecret?: string;
|
|
445
455
|
refresh_token?: string;
|
|
446
456
|
domain?: string;
|
|
447
|
-
expires_in?:
|
|
457
|
+
expires_in?: number;
|
|
448
458
|
openid?: string;
|
|
449
459
|
scope?: string;
|
|
450
460
|
token_type?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylink/xy-rtc-sdk",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
4
4
|
"description": "XYRTC SDK(小鱼易连web音视频 sdk)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webrtc",
|
|
@@ -88,7 +88,8 @@
|
|
|
88
88
|
"xytools": "1.5.2-beta.4"
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
|
-
"crypto-
|
|
91
|
+
"crypto-browserify": "^3.12.0",
|
|
92
|
+
"crypto-js": "^4.1.1",
|
|
92
93
|
"dexie": "^2.0.4",
|
|
93
94
|
"dexie-export-import": "^1.0.0-rc.1",
|
|
94
95
|
"js-base64": "^3.6.1",
|