@xylink/xy-rtc-sdk 2.0.3-beta.11 → 2.0.5

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.
@@ -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>;
@@ -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: number[];
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
+ };
@@ -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,7 @@ export default class Client extends Emmitter {
67
67
  private meetingQualityData;
68
68
  private conferenceInfo;
69
69
  private customLayoutCacheList;
70
+ private contentMode;
70
71
  private onDocumentChange;
71
72
  constructor(config: IClientConfig, servers: IServers, logger: Logger);
72
73
  static instance: Client;
@@ -77,10 +78,10 @@ export default class Client extends Emmitter {
77
78
  quality: number;
78
79
  mediagroupid: number;
79
80
  };
80
- static getMeetingStatus(success: boolean, code?: number, msg?: string): {
81
+ static getMeetingStatus(success: boolean, code?: string, msg?: string): {
81
82
  success: boolean;
82
83
  data: {
83
- code: number;
84
+ code: string;
84
85
  msg: string | undefined;
85
86
  };
86
87
  } | {
@@ -111,6 +112,7 @@ export default class Client extends Emmitter {
111
112
  getOnHold(): boolean;
112
113
  getLayoutList(): Map<string, ILayout> | undefined;
113
114
  getSelfRoster(): IRoster | undefined;
115
+ setContentMode(mode: IContentMode): void;
114
116
  /**
115
117
  * 切换显示/隐藏 Local 画面
116
118
  *
@@ -135,6 +137,13 @@ export default class Client extends Emmitter {
135
137
  * @param { string } wrapEle 包裹video组件的元素id,此元素一定要提供宽高信息,内部会基于此宽高信息计算video的旋转信息
136
138
  */
137
139
  setVideoRenderer(key: string, wrapEleId: string): void;
140
+ /**
141
+ * 移除绑定的streamId
142
+ *
143
+ * @param { string } key endpoinId + mediagroupId 唯一的用户id值
144
+ * @param { string } wrapEle 包裹video组件的元素id,此元素一定要提供宽高信息,内部会基于此宽高信息计算video的旋转信息
145
+ */
146
+ removeVideoRender(key: string, wrapEleId: string): void;
138
147
  /**
139
148
  * 重新播放视频
140
149
  *
@@ -270,7 +279,7 @@ export default class Client extends Emmitter {
270
279
  * @param { string } password
271
280
  */
272
281
  getExternalLoginInfo(sdkUserInfo: ISdkUserInfo, params: ILoginExtAccount): Promise<{
273
- code: number;
282
+ code: string;
274
283
  msg: string;
275
284
  detail: any;
276
285
  }>;
@@ -418,7 +427,7 @@ export default class Client extends Emmitter {
418
427
  * 当websocket error,挂断会议
419
428
  *
420
429
  * @private
421
- * @param { number } code 错误码
430
+ * @param { string } code 错误码
422
431
  */
423
432
  private disconnectInWssError;
424
433
  /**
@@ -627,6 +636,7 @@ export default class Client extends Emmitter {
627
636
  * @public
628
637
  */
629
638
  subscribeBulkRoster(): Promise<unknown>;
639
+ reSendContentOffer(): void;
630
640
  /**
631
641
  * 定时上报会议质量、网络数据
632
642
  *
@@ -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-10-12 15:46:20
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 : 2021-10-18 16:03:49
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
  /**
@@ -30,6 +30,7 @@ export default class Peer {
30
30
  private internels;
31
31
  private isShareContent;
32
32
  private senderInterval;
33
+ private isResendContentOffer;
33
34
  constructor(client: Client, stream: Stream);
34
35
  getInternels(): IInternels;
35
36
  /**
@@ -45,7 +46,7 @@ export default class Peer {
45
46
  *
46
47
  * @private
47
48
  * @param { string } type 消息Key
48
- * @param { number } code 状态码
49
+ * @param { string } code 状态码
49
50
  * @param { string } msg 消息内容
50
51
  * @param { any } detail 消息数据
51
52
  */
@@ -106,7 +107,7 @@ export default class Peer {
106
107
  * @param { number } bandwidth 需要限定的带宽值
107
108
  * @param { boolean } isIncreaseBase 带宽是否需要✖️系数1000
108
109
  */
109
- setBandWidth(trackId: string, bandwidth?: number, isIncreaseBase?: boolean): Promise<void>;
110
+ setBandWidth(trackId: string, bandwidth: number | undefined, isIncreaseBase: boolean | undefined, stream: MediaStream | null): Promise<void>;
110
111
  /**
111
112
  * View the cb of ice connectionn status change
112
113
  * Maybe status:'new', 'checking', 'connected', 'completed', 'failed', 'disconnected', 'closed'
@@ -141,6 +142,8 @@ export default class Peer {
141
142
  * @param { IPushType } pushType 推送类型,all全推送,video只推送video,audio只推送audio, content只推送content video流
142
143
  */
143
144
  publish(stream: Stream, pushType?: IPushType): void;
145
+ reSendContentOffer(): void;
146
+ resetContentStream(contentStreams: IStreamObj[]): void;
144
147
  /**
145
148
  * 替换People Video Track轨道
146
149
  *
@@ -197,6 +200,15 @@ export default class Peer {
197
200
  * @param { IStreamObj } item 自定义Stream流对象
198
201
  */
199
202
  private addStreamRenders;
203
+ /**
204
+ * 向peer添加Track轨道数据
205
+ *
206
+ * @private
207
+ * @param { TCustomStream | MediaStreamTrack } track Track轨道数据
208
+ * @param { RTCRtpTransceiverDirection } direction 指定添加到peer上的方向
209
+ * @param { IStreamObj } item 自定义Stream流对象
210
+ */
211
+ private addTransceiverByPeer;
200
212
  /**
201
213
  * 关联自定义stream对象和Sender发送器数据
202
214
  *
@@ -214,7 +226,14 @@ export default class Peer {
214
226
  */
215
227
  private replaceAudioTrack;
216
228
  /**
217
- * Replace Track
229
+ * 替换视频Track轨道
230
+ *
231
+ * @private
232
+ * @param { IStreamObj[] } streamList 自定义媒体流对象列表数据
233
+ */
234
+ private replaceVideoTrack;
235
+ /**
236
+ * Replace all Track
218
237
  *
219
238
  * @private
220
239
  * @param { IStreamObj[] } streamList 自定义媒体流对象列表数据
@@ -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(): Promise<IStreamObj[]>;
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
  /**
@@ -5,7 +5,7 @@
5
5
  * @author jinghui-Luo
6
6
  *
7
7
  * Created at : 2020-12-18 16:54:15
8
- * Last modified : 2021-09-28 14:10:42
8
+ * Last modified : 2022-01-06 20:38:55
9
9
  */
10
10
  import Logger from '../tools/logger';
11
11
  declare class VideoManager {
@@ -11,6 +11,7 @@ export declare const platform: () => {
11
11
  isPc: boolean;
12
12
  isMac: boolean;
13
13
  isWindows: boolean;
14
+ isIPad: boolean;
14
15
  isPad: boolean;
15
16
  isChrome: boolean;
16
17
  isLinux: boolean;
@@ -51,3 +52,5 @@ export declare const getIOSVersion: () => {
51
52
  minor: any;
52
53
  } | undefined;
53
54
  export declare const getVerison: () => number;
55
+ export declare const isPC: boolean;
56
+ 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.3-beta.11 - build on 2022-01-13 14:59";
7
+ export declare const version = "2.0.5 - build on 2022-01-27 14:43";
8
8
  export declare const proxy: {
9
9
  wssHost: string;
10
10
  restHost: string;
@@ -16,3 +16,4 @@ export declare const detect: {
16
16
  isSupportH264: () => Promise<boolean>;
17
17
  osVersion: () => string;
18
18
  };
19
+ export declare const isFirefox: boolean;
@@ -6,6 +6,7 @@
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 | 2;
19
+ sign?: 0 | 1;
26
20
  clientSecret?: string;
27
21
  clientId?: string;
28
22
  }
@@ -33,13 +27,16 @@ 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?: string): Promise<any>;
37
33
  setLogger(logger: Logger): void;
38
34
  setBaseUrl(url: string): void;
39
35
  setClientId(clientId: string): void;
40
36
  setHttpConfig(config: IAxiosRequestConfig): void;
41
37
  setHeader(params: ISignParams): any;
42
- setLoginInfo(loginInfo: any): void;
38
+ setLoginInfo(loginInfo: IToken | null): void;
39
+ getLoginInfo(): any;
43
40
  assignOptions: (option?: AxiosRequestConfig | undefined) => AxiosRequestConfig & {
44
41
  params: any;
45
42
  };
@@ -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: number, detail?: any, msg?: string) => {
50
- code: number;
49
+ export declare const getStatus: (code: string, detail?: any, msg?: string) => {
50
+ code: string;
51
51
  msg: string;
52
52
  detail: any;
53
53
  };
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * SDK对外回调错误消息
3
3
  *
4
- * @property { number } code 错误码
4
+ * @property { string } code 错误码
5
5
  * @property { string } msg 错误信息
6
6
  * @property { unknwn } detail 数据详情
7
7
  */
8
8
  export interface IStatus {
9
- code: number;
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
+ }
@@ -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?: string;
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-beta.11",
3
+ "version": "2.0.5",
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-js": "^4.0.0",
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",