@xylink/xy-rtc-sdk 2.1.2-beta.7 → 2.1.3-beta.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.
@@ -225,6 +225,12 @@ declare class Action {
225
225
  * @returns
226
226
  */
227
227
  getWebRxBandwidth(userId: number): Promise<any>;
228
+ /**
229
+ * 刷新Token
230
+ *
231
+ * @returns
232
+ */
233
+ refreshToken(refresh_token: string): Promise<any>;
228
234
  }
229
235
  declare const _default: Action;
230
236
  export default _default;
@@ -113,3 +113,4 @@ export declare const CONTENT_CONTRAINTS: {
113
113
  */
114
114
  export declare const PEOPLE_CONTRAINTS: any;
115
115
  export declare const RESOLUTION_MAP: Record<string, number>;
116
+ export declare const MIN_BANDWIDTH_MAP: Record<string, number>;
@@ -14,6 +14,8 @@ export declare const DEVICE_TYPE = 17;
14
14
  export declare const SELF_MOCK_PID = 9999999999;
15
15
  export declare const STREAM_CHANNEL_COUNT = 11;
16
16
  export declare const MAX_PARTICIPANT_COUNT = 112;
17
+ export declare const MAX_CUSTOM_MESSAGE_LEN = 1373333;
18
+ export declare const MAX_CUSTOM_MESSAGE_LOG_LEN = 13333;
17
19
  export declare const STREAM_ERROR_CODE_MAP: string[];
18
20
  /**
19
21
  * 支持呼叫的会议室类型
@@ -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, IPublishParams, ICustomLayout, ICustomStreamTrack, IInternels, IVideoAudioType, IShareContentStatus, IPushType, IMode, IReqInfo, TCommand, ILayout, IConference, IConferenceInfo, IContentMode, IToken, AutoMute, Key, IRecordPermission, TLocalLanguage } from '../type';
7
+ import { IClientConfig, IMackCall, IInvite, IRoster, ILayoutRoster, ISpeakerInfo, IScreenInfo, IServers, ILoginExtAccount, IPublishParams, ICustomLayout, ICustomStreamTrack, IInternels, IVideoAudioType, IShareContentStatus, IPushType, IMode, IReqInfo, TCommand, ILayout, IConference, IConferenceInfo, IContentMode, IToken, AutoMute, Key, IRecordPermission, TLocalLanguage, ICustomMessageConfig } from '../type';
8
8
  import Emmitter from '../tools/emmitter';
9
9
  import Socket from '../tools/socket';
10
10
  import Stream from './stream';
@@ -72,6 +72,7 @@ export default class Client extends Emmitter {
72
72
  private recordState;
73
73
  private qualityManager;
74
74
  private isShareContent;
75
+ private isSubscribeTranslation;
75
76
  private onDocumentChange;
76
77
  constructor(config: IClientConfig, servers: IServers, logger: Logger);
77
78
  static instance: Client;
@@ -459,6 +460,20 @@ export default class Client extends Emmitter {
459
460
  * @param { ISubTitle } data 字幕、点名消息
460
461
  */
461
462
  private onSubTitle;
463
+ /**
464
+ * 发送自定义消息
465
+ *
466
+ * @public
467
+ * @param { object } config - 配置参数
468
+ * @param { number } config.toPid - 消息的接收方pid,0表示广播消息、非0表示单点消息;
469
+ * @param { string } config.data - 消息内容,JSON字符串;因业务数据可能会传输图片,需要对二进制数据进行base64编码,消息长度限制最大:1030KB
470
+ * @return { { code: string, message: string, data: null | object } } 返回结果
471
+ */
472
+ sendCustomMessage(config: ICustomMessageConfig): {
473
+ code: string;
474
+ msg: string;
475
+ detail: any;
476
+ };
462
477
  /**
463
478
  * 处理媒体消息
464
479
  *
@@ -680,6 +695,12 @@ export default class Client extends Emmitter {
680
695
  * @param { boolean } isLog 是否写入日志
681
696
  */
682
697
  sendSocketMessage(data: any, isAutoAdd?: boolean, isLog?: boolean): void;
698
+ /**
699
+ * 获取用户、会议室基本信息
700
+ *
701
+ * @param { ICall } params
702
+ * @returns
703
+ */
683
704
  private getBasicInfo;
684
705
  /**
685
706
  * 校验会议室号
@@ -689,6 +710,10 @@ export default class Client extends Emmitter {
689
710
  * @returns { Promise<{success: boolean; data: any;}> } 是否通过校验
690
711
  */
691
712
  private verifyMeeting;
713
+ /**
714
+ * 刷新Token
715
+ */
716
+ refreshToken(refresh_token: string): Promise<any>;
692
717
  /**
693
718
  * 设置扬声器
694
719
  *
@@ -19,7 +19,6 @@ import { IDeviceList, ISelectedDevice, ICurrentPermission } from '../type';
19
19
  */
20
20
  declare class DeviceManager extends Emmitter {
21
21
  private navigator;
22
- private mediaDevices;
23
22
  private currentDeviceList;
24
23
  private nextDeviceList;
25
24
  private currentUsedDevice;
@@ -43,7 +42,7 @@ declare class DeviceManager extends Emmitter {
43
42
  *
44
43
  * @param devices 设备数据
45
44
  */
46
- setCurrentUsedDevice(devices: ISelectedDevice): void;
45
+ setCurrentUsedDevice(currentDevice: ISelectedDevice): Promise<void>;
47
46
  /**
48
47
  * 设置当前正在使用的设备信息
49
48
  * 切换设备时,需重新设置此值,为下次diffDevice 使用
@@ -32,6 +32,7 @@ export default class Peer {
32
32
  private senderInterval;
33
33
  private isResendContentOffer;
34
34
  private isRestartIceConnection;
35
+ private isFirstConnected;
35
36
  constructor(client: Client, stream: Stream);
36
37
  getInternels(): IInternels;
37
38
  /**
@@ -135,6 +136,7 @@ export default class Peer {
135
136
  * 关闭PeerConnection连接、销毁状态
136
137
  */
137
138
  close(): void;
139
+ setRestartIceConnection(isRestartIceConnection?: boolean): void;
138
140
  /**
139
141
  * add Track for stream, default push all
140
142
  *
@@ -184,6 +186,13 @@ export default class Peer {
184
186
  * @private
185
187
  */
186
188
  private calcMeetingStats;
189
+ /**
190
+ * 过滤远端音频中没有带宽或者没有音量的数据
191
+ *
192
+ * @param { IInternels } internels
193
+ * @returns
194
+ */
195
+ private filterInternels;
187
196
  /**
188
197
  * 计算丢包率
189
198
  *
@@ -261,6 +270,13 @@ export default class Peer {
261
270
  * @returns { ISender } 自定义统计数据内容
262
271
  */
263
272
  private getSenderStatus;
273
+ /**
274
+ * 计算音量值, 显示0-100
275
+ *
276
+ * @param { number } audioLevel
277
+ * @returns
278
+ */
279
+ private calcAudioLevel;
264
280
  /**
265
281
  * 获取receiver的数据
266
282
  *
@@ -206,8 +206,8 @@ export default class Stream extends Emmitter {
206
206
  */
207
207
  createElectronContentStream(selectedSourceId: string): Promise<IStreamObj[]>;
208
208
  getPreviewStream(isVideo?: boolean, isAudio?: boolean, params?: {
209
- video: {};
210
- audio: {};
209
+ video: any;
210
+ audio: any;
211
211
  }): Promise<MediaStream>;
212
212
  private getUserMedia;
213
213
  private handleCloseShareContentEvent;
@@ -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-06-09 17:42:49
8
+ * Last modified : 2022-08-31 20:10:23
9
9
  */
10
10
  import Logger from '../tools/logger';
11
11
  declare class VideoManager {
@@ -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.1.2-beta.7 - build on 2022-08-01 17:25";
7
+ export declare const version = "2.1.3-beta.0 - build on 2022-12-02 19:45";
8
8
  export declare const proxy: {
9
9
  wssHost: string;
10
10
  restHost: string;
@@ -10,6 +10,7 @@ declare class DB {
10
10
  dbName: string;
11
11
  tableCount: number;
12
12
  tableName: string;
13
+ maxTableCount: number;
13
14
  constructor(tableCount?: number, tableName?: string, dbName?: string);
14
15
  /**
15
16
  * 表 添加数据
@@ -3,17 +3,43 @@
3
3
  * @authors Luo-jinghui (luojinghui424@gmail.com)
4
4
  * @date 2019-10-22 11:11:55
5
5
  */
6
+ interface ISupportFeature {
7
+ isSupportRTC: boolean;
8
+ isSupportAddtrack: boolean;
9
+ isSupportAddTransceiver: boolean;
10
+ isSupportReplaceTrack: boolean;
11
+ isApplyConstraints: boolean;
12
+ isSupportSetStreams: boolean;
13
+ }
14
+ interface ISupportTest {
15
+ isSupportPeer: boolean;
16
+ isSupportAddtrack: boolean;
17
+ isSupportAddTransceiver: boolean;
18
+ isSupportReplaceTrack: boolean;
19
+ isApplyConstraints: boolean;
20
+ isSupportSetStreams: boolean;
21
+ }
6
22
  export declare const detect: {
7
23
  isMinBrowser: () => boolean;
8
24
  isMobile: () => boolean;
9
25
  isFirefox: () => boolean;
10
26
  isSupportReauthorize: () => boolean;
11
27
  isSupportAppendTrack: () => boolean;
12
- isSupportRTC: () => boolean;
13
- isSupportPeerCB: () => boolean;
28
+ isSupportUserMedia: () => boolean;
29
+ isSupportRTC: (videoCapture?: MediaStream) => Promise<ISupportFeature>;
30
+ isSupportPeerCB: (videoCapture?: MediaStream) => Promise<ISupportTest>;
14
31
  isSupportWebsocket: () => boolean;
15
32
  isSupportMedia: () => boolean;
16
33
  isSupportH264: () => Promise<boolean>;
17
34
  osVersion: () => string;
35
+ getNetWork: () => {
36
+ type: any;
37
+ downlink: any;
38
+ effectiveType: any;
39
+ rtt: any;
40
+ downlinkMax: any;
41
+ saveData: any;
42
+ } | null;
18
43
  };
19
44
  export declare const isFirefox: boolean;
45
+ export {};
@@ -30,7 +30,10 @@ declare class HttpClient {
30
30
  private clientSecret;
31
31
  private retryCount;
32
32
  constructor(commonOption: IAxiosRequestConfig);
33
- refreshToken(baseURL?: string): Promise<any>;
33
+ refreshToken({ baseURL, refresh_token }: {
34
+ baseURL?: string | undefined;
35
+ refresh_token?: string | undefined;
36
+ }): Promise<any>;
34
37
  setLogger(logger: Logger): void;
35
38
  setBaseUrl(url: string): void;
36
39
  setClientInfo({ clientId, clientSecret }: {
@@ -1,3 +1,8 @@
1
+ /**
2
+ * 关闭视频流
3
+ *
4
+ * @param { MediaStream } stream
5
+ */
1
6
  declare const closePreviewStream: (stream: MediaStream) => Promise<void>;
2
7
  declare const setOutputAudioDevice: (element: any, outputValue: string) => void;
3
8
  export { closePreviewStream, setOutputAudioDevice };
@@ -27,6 +27,8 @@ 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;
@@ -36,10 +38,11 @@ declare class Socket {
36
38
  onCloseSocket: (e: CloseEvent) => void;
37
39
  onErrorSocket: (e: any) => void;
38
40
  sendHeartBeat(): void;
39
- creatTimeout(): void;
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;
@@ -23,8 +23,12 @@ export interface ICheckSystemRequirements {
23
23
  detail: {
24
24
  isSupportRTC: boolean;
25
25
  isSupportWebsocket: boolean;
26
- isSupportH264: boolean;
27
26
  isSupportBrowser: boolean;
27
+ isSupportMobileBrowser: boolean;
28
+ isSupportH264: boolean;
29
+ isSupportAddTransceiver: boolean;
30
+ isSupportAddtrack: boolean;
31
+ isSupportUserMedia: boolean;
28
32
  };
29
33
  }
30
34
  /**
@@ -1103,4 +1103,28 @@ export interface ITranslationContent {
1103
1103
  srcLang: string;
1104
1104
  targetLang: string;
1105
1105
  }
1106
+ /**
1107
+ * 用户自定义消息
1108
+ *
1109
+ * @property { number } toPid - 消息的接收方pid,0表示广播消息、非0表示单点消息;
1110
+ * @property { string } data - 消息内容,可以被JSON序列化的字符串;因业务数据可能会传输图片,需要进行base64编码,消息最大长度限制:1MB
1111
+ */
1112
+ export interface ICustomMessageConfig {
1113
+ toPid: number;
1114
+ data: string;
1115
+ }
1116
+ /**
1117
+ * 接收到自定义消息
1118
+ *
1119
+ * @property { string } type - 消息Type
1120
+ * @property { number } fromPid - 消息的发送方pid
1121
+ * @property { number } toPid - 消息的接收方pid,0表示广播消息、非0表示单点消息;
1122
+ * @property { string } data - 消息内容,可以被JSON序列化的字符串;
1123
+ */
1124
+ export interface IReceiveCustomMessage {
1125
+ type: string;
1126
+ fromPid: number;
1127
+ toPid: number;
1128
+ data: string;
1129
+ }
1106
1130
  export {};
@@ -361,11 +361,15 @@ export interface ISender {
361
361
  * @property { ConstrainDouble } frameRate 帧率配置
362
362
  * @property { number } aspectRatio 视频比例
363
363
  * @property { 'crop-and-scale' } resizeMode 裁剪模式,此处使用裁剪比例模式,以满足分辨率要求;
364
+ * @property { number } width 采集分辨率-width
365
+ * @property { number } height 采集分辨率-height
364
366
  */
365
367
  export interface IBASE_CONTRAINTS {
366
368
  frameRate?: ConstrainDouble;
367
369
  aspectRatio: number;
368
370
  resizeMode: 'crop-and-scale';
371
+ width?: number;
372
+ height?: number;
369
373
  }
370
374
  /**
371
375
  * 初始化视频约束设置
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xylink/xy-rtc-sdk",
3
- "version": "2.1.2-beta.7",
3
+ "version": "2.1.3-beta.0",
4
4
  "description": "XYRTC SDK(小鱼易连web音视频 sdk)",
5
5
  "keywords": [
6
6
  "webrtc",