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

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,14 +4,17 @@
4
4
  * @authors Luo-jinghui (luojinghui424@gmail.com)
5
5
  * @date 2019-10-27 23:12:45
6
6
  */
7
+ import Logger from '../tools/logger';
7
8
  import Emmitter from '../tools/emmitter';
8
- import { IStreamChangeType, IStreamObj, IGetMediaStreams, ISource, IStreamInitConfog, IStreamCurrent } from '../type';
9
+ import { IStreamChangeType, IStreamObj, IGetMediaStreams, ISource, IStreamInitConfog, IStreamCurrent, IMediaSupportedConstraints, IStreamChange, IStatus } from '../type';
9
10
  import Peer from './peer';
10
11
  import Client from './client';
11
12
  export default class Stream extends Emmitter {
12
13
  streams: IStreamObj[];
13
14
  config: IStreamInitConfog;
14
15
  current: IStreamCurrent;
16
+ isSupportReauthorize: boolean;
17
+ private isSupportAppendTrack;
15
18
  private client;
16
19
  private audioLevel;
17
20
  private logger;
@@ -22,30 +25,33 @@ export default class Stream extends Emmitter {
22
25
  private isShareContent;
23
26
  private audioDeviceId;
24
27
  private videoDeviceId;
25
- constructor({ logger }: {
26
- logger: any;
28
+ constructor(params: {
29
+ logger: Logger;
30
+ client?: Client;
27
31
  });
28
32
  static instance: Stream;
29
- static getStreamInstance(params: any): Stream;
30
- static getContraints(video?: boolean, audio?: boolean, config?: any): {
31
- audio: {};
32
- video: {};
33
- };
34
- static getSupportConstraints(): any;
33
+ static getStreamInstance(params: {
34
+ logger: Logger;
35
+ client?: Client;
36
+ }): Stream;
37
+ static getContraints(video?: boolean, audio?: boolean, config?: any): IMediaSupportedConstraints;
38
+ static getSupportConstraints(): MediaTrackSupportedConstraints;
35
39
  getLocalStream(): IStreamObj[];
36
- getIndexFromStreamChange(stream: MediaStream, streamChangeInfo: any): any;
40
+ getIndexFromStreamChange(stream: MediaStream, streamChangeInfo: IStreamChange[]): number;
37
41
  /**
38
42
  * stream 取消监听事件
39
43
  *
40
44
  * @param {string} key
41
45
  * @param {function} listener
42
46
  */
43
- off(key: any): void;
47
+ off(key: string): void;
44
48
  /**
45
49
  * 媒体网关发给WEB JS的视频流的分辨率、带宽信息、帧率
46
- * WEB JS收到消息后推送视频流
50
+ * WEB收到消息后推送相应视频流/调整带宽
47
51
  *
48
- * @param body
52
+ * @param { IStreamChangeType } body StreamChange消息内容
53
+ * @param { Peer } peer Peer模块
54
+ * @param { number } mediaGroupId 当前stream是否是content画面
49
55
  */
50
56
  handleChangeStream(body: IStreamChangeType, peer: Peer, mediaGroupId: number): Promise<void>;
51
57
  /**
@@ -59,8 +65,17 @@ export default class Stream extends Emmitter {
59
65
  switchDevice(type: 'audio' | 'video', deviceId: string): Promise<boolean>;
60
66
  sendStreamStatus(): void;
61
67
  private replaceAudioTrack;
68
+ /**
69
+ * 设备切换(视频)
70
+ * 1. 如果无法append多个track(Firefox会出现视频卡死现象), 则先删除video track
71
+ * 2. 创建新的stream, 获取到对应的videoTrack,添加给原先的stream
72
+ * 3. 如果可以append多个track,则此时会产生两个videoTrack,需删除原先的track. (后删除 可避免黑屏现象)
73
+ *
74
+ * @private
75
+ * @returns
76
+ */
62
77
  private replaceVideoTrack;
63
- setAudioOrVideoStatus(type: string): Promise<never>;
78
+ setAudioOrVideoStatus(type: string): Promise<undefined>;
64
79
  private setStreamStatus;
65
80
  private getNextAudioContraints;
66
81
  private getNextAudioMedia;
@@ -68,16 +83,65 @@ export default class Stream extends Emmitter {
68
83
  private getNextVideoContraints;
69
84
  private getNextVideoMedia;
70
85
  private createNextVideoTracks;
86
+ /**
87
+ * 删除video track
88
+ *
89
+ * @private
90
+ * @param { boolean } forceRemove 是否强制删除track, 默认不强制,只有track数量大于1才进行删除
91
+ * @returns
92
+ */
71
93
  private removePreviousVideoTracks;
94
+ /**
95
+ * 获取stop的track
96
+ *
97
+ * @param tracks
98
+ * @returns
99
+ */
100
+ private getEndedTrack;
72
101
  setStreamTracksStatus(stream: MediaStream, type: string): void;
73
102
  close(): void;
74
103
  private closeStreams;
75
104
  getMediaStreams(): IGetMediaStreams;
76
- init(config?: IStreamInitConfog): Promise<{
77
- code: number;
78
- msg: string;
79
- detail: {};
80
- }>;
105
+ /**
106
+ * 初始化流
107
+ *
108
+ * @param config
109
+ * @param params
110
+ * @returns
111
+ */
112
+ init(config?: IStreamInitConfog, params?: {
113
+ muteVideo?: boolean;
114
+ muteAudio?: boolean;
115
+ }): Promise<IStatus>;
116
+ /**
117
+ *
118
+ * @param { boolean } video 是否开启摄像头
119
+ * @param { boolean } audio 是否开启麦克风
120
+ * @param { string } videoId 摄像头设备ID
121
+ * @param { string } audioId 麦克风设备ID
122
+ * @param { boolean } isReduceResolution 是否降低分辨率采集, 默认采集720P,降低分辨率则采集360P
123
+ * @returns
124
+ */
125
+ private getStream;
126
+ /**
127
+ * 无流入会
128
+ *
129
+ * @private
130
+ * @param status
131
+ * @returns
132
+ */
133
+ private dealWithoutStreams;
134
+ /**
135
+ * 获取约束设置
136
+ *
137
+ * @private
138
+ * @param { boolean } video 是否采集视频流
139
+ * @param { boolean } audio 是否采集音频流
140
+ * @param { string } videoDeviceId 摄像头设备ID
141
+ * @param { string } audioDeviceId 麦克风设备ID
142
+ * @param { boolean } isReduceResolution 是否降低分辨率采集, 默认采集720P,降低分辨率则采集360P
143
+ * @returns
144
+ */
81
145
  private getInitContraints;
82
146
  private initStreams;
83
147
  /**
@@ -97,7 +161,7 @@ export default class Stream extends Emmitter {
97
161
  /**
98
162
  * 获取当前时刻音量大小,范围:0-100
99
163
  */
100
- getAudioLevel(stream?: MediaStream): Promise<Number>;
164
+ getAudioLevel(stream?: MediaStream): Promise<number>;
101
165
  /**
102
166
  * clear audio object
103
167
  */
@@ -107,14 +171,14 @@ export default class Stream extends Emmitter {
107
171
  * 创建share content stream
108
172
  */
109
173
  createContentStream(): Promise<IStreamObj[]>;
110
- electronCapture(selectedSourceId: any): Promise<unknown>;
111
- getElectronContentSources(desktopCapturer: any, types?: any): Promise<ISource[]>;
174
+ electronCapture(selectedSourceId: string): Promise<unknown>;
175
+ getElectronContentSources(desktopCapturer: any, types?: any): Promise<ISource[] | any>;
112
176
  /**
113
177
  * Create share electron content stream
114
178
  *
115
179
  * @param selectedSourceId content stream source id
116
180
  */
117
- createElectronContentStream(selectedSourceId: any): Promise<IStreamObj[]>;
181
+ createElectronContentStream(selectedSourceId: string): Promise<IStreamObj[]>;
118
182
  getPreviewStream(isVideo?: boolean, isAudio?: boolean, params?: {
119
183
  video: {};
120
184
  audio: {};
@@ -5,11 +5,11 @@
5
5
  * @author jinghui-Luo
6
6
  *
7
7
  * Created at : 2020-12-18 16:54:15
8
- * Last modified : 2021-03-04 11:04:51
8
+ * Last modified : 2021-09-28 14:10:42
9
9
  */
10
10
  import Logger from '../tools/logger';
11
11
  declare class VideoManager {
12
- videoEle: HTMLVideoElement;
12
+ videoEle: HTMLVideoElement | null;
13
13
  state: '' | 'CANPLAY' | 'ENDED' | 'REQUEST';
14
14
  private key;
15
15
  private wrapEleId;
@@ -38,7 +38,7 @@ declare class VideoManager {
38
38
  private removeEventListener;
39
39
  private initStreamTrackEventListener;
40
40
  private removeStreamTrackEventListener;
41
- isHaveSrcObject(): MediaStream | MediaSource | Blob;
41
+ isHaveSrcObject(): MediaProvider | null;
42
42
  setSource(key: string, wrapEleId: string): void;
43
43
  destroy(): void;
44
44
  setVideoStatusChange(cb: any): void;
@@ -10,6 +10,8 @@ export declare const platform: () => {
10
10
  isAndroid: boolean;
11
11
  isPc: boolean;
12
12
  isMac: boolean;
13
+ isWindows: boolean;
14
+ isPad: boolean;
13
15
  isChrome: boolean;
14
16
  isLinux: boolean;
15
17
  isFirefox: boolean;
@@ -19,20 +21,33 @@ export declare const platform: () => {
19
21
  isZhazha: boolean;
20
22
  isEdge: boolean;
21
23
  isSafari: boolean;
24
+ isHuaweiBrowser: boolean;
22
25
  };
23
26
  export declare const getChromeVersion: () => {
24
27
  major: any;
25
28
  minor: any;
26
29
  build: any;
27
30
  patch: any;
28
- };
31
+ } | undefined;
29
32
  export declare const getEdgeVersion: () => {
30
33
  major: any;
31
34
  minor: any;
32
35
  build: any;
33
- };
36
+ } | undefined;
34
37
  export declare const getSafariVersion: () => {
35
38
  major: any;
36
39
  minor: any;
37
- };
40
+ } | undefined;
41
+ export declare const getFirefoxVersion: () => {
42
+ major: any;
43
+ minor: any;
44
+ } | undefined;
45
+ export declare const getAndroidVersion: () => {
46
+ major: any;
47
+ minor: any;
48
+ } | undefined;
49
+ export declare const getIOSVersion: () => {
50
+ major: any;
51
+ minor: any;
52
+ } | undefined;
38
53
  export declare const getVerison: () => number;
@@ -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.1-beta.8 - build on 2021-03-26 19:11";
7
+ export declare const version = "2.0.3-beta.11 - build on 2022-01-13 14:59";
8
8
  export declare const proxy: {
9
9
  wssHost: string;
10
10
  restHost: string;
@@ -14,7 +14,7 @@ declare class DB {
14
14
  stop(): void;
15
15
  isOpen(): any;
16
16
  export(): Promise<boolean>;
17
- upload(displayName: string): Promise<any>;
17
+ upload(displayName: string): Promise<Blob | null>;
18
18
  progressCallback({ totalRows, completedRows }: any): boolean;
19
19
  open(): void;
20
20
  tempStart(): Promise<void>;
@@ -5,8 +5,14 @@
5
5
  */
6
6
  export declare const detect: {
7
7
  isMinBrowser: () => boolean;
8
+ isMobile: () => boolean;
9
+ isFirefox: () => boolean;
10
+ isSupportReauthorize: () => boolean;
11
+ isSupportAppendTrack: () => boolean;
8
12
  isSupportRTC: () => boolean;
9
13
  isSupportPeerCB: () => boolean;
10
14
  isSupportWebsocket: () => boolean;
11
15
  isSupportMedia: () => boolean;
16
+ isSupportH264: () => Promise<boolean>;
17
+ osVersion: () => string;
12
18
  };
@@ -7,9 +7,9 @@
7
7
  export default class Emmitter {
8
8
  private events;
9
9
  constructor();
10
- on(key: any, listener: any, total?: number): void;
11
- once(key: any, listener: any, total?: number): void;
12
- removeListener(key: any): void;
10
+ on(key: string, listener: Function, total?: number): void;
11
+ once(key: string, listener: Function, total?: number): void;
12
+ removeListener(key: string): void;
13
13
  removeAllListener(): void;
14
- emmit(key: any, ...args: any[]): void;
14
+ emmit<T>(key: string, ...args: T[]): void;
15
15
  }
@@ -1,59 +1,6 @@
1
- export declare const STR_CALL_LOCAL_NET_DISCONNECT = "\u7F51\u7EDC\u4E2D\u65AD\uFF0C\u547C\u53EB\u5DF2\u65AD\u5F00";
2
- export declare const STR_SIGNAL_TIMEOUT = "\u5A92\u4F53\u8D85\u65F6";
3
- export declare const STR_EXCEPTION_CALL_EXIST = "\u60A8\u6B63\u5728\u547C\u53EB\u4E2D\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5";
4
- export declare const STR_CALL_FAIL_UNKNOW_REASON = "\u547C\u53EB\u5F02\u5E38\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5";
5
- export declare const STR_CALL_TIME_OUT = "\u5BF9\u65B9\u6CA1\u6709\u5E94\u7B54\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5";
6
- export declare const STR_CALL_INVALID_NEMONO = "\u65E0\u6548\u7684\u7EC8\u7AEF\u53F7\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165";
7
- export declare const STR_CALL_USER_NOT_ALLOWED = "\u5BF9\u65B9\u7EC8\u7AEF\u4E0D\u5141\u8BB8\u5916\u4EBA\u62E8\u6253\uFF0C\u8BF7\u4E0E\u5BF9\u65B9\u786E\u8BA4\u540E\u518D\u62E8";
8
- export declare const STR_NEN_NORMAL_CONF_SESSION_EXCEED = "\u5F53\u524D\u4F1A\u8BAE\u4EBA\u6570\u5DF2\u8D85\u9650\uFF0C\u8BF7\u52A0\u5165\u4F01\u4E1A\u901A\u8BAF\u5F55\uFF0C\u53EF\u652F\u6301\u66F4\u591A\u65B9\u4F1A\u8BAE\u3002";
9
- export declare const STR_CALL_NOT_ALLOW_NEMO_CALL = "\u5BF9\u65B9\u7EC8\u7AEF\u4E0D\u5141\u8BB8\u964C\u751F\u4EBA\u547C\u53EB";
10
- export declare const STR_CONFMGMT_CONFOVER = "\u4E3B\u6301\u4EBA\u7ED3\u675F\u4F1A\u8BAE";
11
- export declare const STR_CONFMGMT_KICKOUT = "\u4E3B\u6301\u4EBA\u79FB\u9664\u5F53\u524D\u7684\u5C0F\u7A0B\u5E8F";
12
- export declare const STR_MEETING_LOCKED = "\u4F1A\u8BAE\u5DF2\u7ECF\u88AB\u9501\u5B9A\uFF0C\u65E0\u6CD5\u52A0\u5165";
13
- export declare const STR_NORMAL_CONF_SESSION_EXCEED = "\u60A8\u547C\u53EB\u7684\u4F1A\u8BAE\u5DF2\u8FBE\u5230\u6700\u5927\u652F\u6301\u4EBA\u6570";
14
- export declare const STR_NOT_ALLOW_CONFERENCE_CALL = "\u60A8\u547C\u53EB\u7684\u4E91\u4F1A\u8BAE\u5BA4\u4E0D\u5141\u8BB8\u901A\u8BAF\u5F55\u5916\u6210\u5458\u547C\u5165\uFF0C\u8BF7\u8054\u7CFB\u4E91\u4F1A\u8BAE\u5BA4\u7BA1\u7406\u5458";
15
- export declare const STR_NOT_ALLOW_CONFERENCE_ANONYMOUS_CALL = "\u60A8\u547C\u53EB\u7684\u4E91\u4F1A\u8BAE\u5BA4\u4E0D\u5141\u8BB8\u533F\u540D\u7528\u6237\u547C\u5165\uFF0C\u8BF7\u8054\u7CFB\u4E91\u4F1A\u8BAE\u5BA4\u7BA1\u7406\u5458";
16
- export declare const STR_TIME_OUT = "\u5BF9\u65B9\u65E0\u5E94\u7B54";
17
- export declare const STR_BUSY = "\u5BF9\u65B9\u5FD9";
18
- export declare const STR_PEER_NOT_FOUND = "\u5BF9\u65B9\u4E0D\u5728\u7EBF";
19
- export declare const STR_STATUS_OK = "\u901A\u8BDD\u5DF2\u7ED3\u675F";
20
- export declare const STR_EXCEPTION_PARAM_ERROR = "\u547C\u53EB\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5";
21
- export declare const STR_MEETING_DISCONNECT_USER_CONF_SESSION_EXCEED = "\u6B64\u4E91\u4F1A\u8BAE\u5BA4\u5DF2\u8FBE\u5141\u8BB8\u547C\u5165\u7684\u4E0A\u9650";
22
- export declare const STR_MEETING_DISCONNECT_DEP_CONF_SESSION_EXCEED = "\u6B64\u4E91\u4F1A\u8BAE\u5BA4\u5DF2\u8FBE\u90E8\u95E8\u5141\u8BB8\u547C\u5165\u7684\u4E0A\u9650";
23
- export declare const STR_MEETING_DISCONNECT_ENT_CONF_SESSION_EXCEED = "\u6B64\u4E91\u4F1A\u8BAE\u5BA4\u5DF2\u8FBE\u4F01\u4E1A\u5141\u8BB8\u547C\u5165\u7684\u4E0A\u9650";
24
- export declare const STR_NO_AUTHORITY = "\u6CA1\u6709\u547C\u53EB\u6743\u9650";
25
- export declare const STR_KickoutTipContent = "\u60A8\u7684\u8D26\u53F7\u5728\u53E6\u4E00\u5730\u70B9\u767B\u5F55\uFF0C\u60A8\u88AB\u8FEB\u4E0B\u7EBF";
26
- export declare const STR_UNSUPPORT_CALL = "\u60A8\u7684\u7EC8\u7AEF\u76EE\u524D\u65E0\u6CD5\u652F\u6301\u6B64\u7C7B\u547C\u53EB";
27
- export declare const STR_SHARE_CONTENT_FAILED = "\u5206\u4EAB\u5C4F\u5E55\u5931\u8D25";
1
+ import { TLocale } from 'src/type';
28
2
  export declare const FailEnumMap: {
29
- LOCAL_NET_DISCONNECT: string;
30
- SIGNAL_TIMEOUT: string;
31
- MEDIA_TIMEOUT: string;
32
- EXCEPTION_CALL_EXIST: string;
33
- EXCEPTION_CALL_NOT_EXIST: string;
34
- EXCEPTION_UNKNOWN: string;
35
- TIME_OUT: string;
36
- INVALID_NEMONO: string;
37
- USER_NOT_ALLOWED: string;
38
- NEN_NORMAL_CONF_SESSION_EXCEED: string;
39
- NOT_ALLOW_NEMO_CALL: string;
40
- CONFMGMT_CONFOVER: string;
41
- CONFMGMT_KICKOUT: string;
42
- MEETING_LOCKED: string;
43
- NORMAL_CONF_SESSION_EXCEED: string;
44
- NORMAL_EN_NEMO_SESSION_EXCEED: string;
45
- LARGE_CONF_SESSION_EXCEED: string;
46
- NOT_ALLOW_CONFERENCE_CALL: string;
47
- NOT_ALLOW_CONFERENCE_ANONYMOUS_CALL: string;
48
- BUSY: string;
49
- PEER_NOT_FOUND: string;
50
- STATUS_OK: string;
51
- EXCEPTION_PARAM_ERROR: string;
52
- MEETING_DISCONNECT_USER_CONF_SESSION_EXCEED: string;
53
- MEETING_DISCONNECT_DEP_CONF_SESSION_EXCEED: string;
54
- MEETING_DISCONNECT_ENT_CONF_SESSION_EXCEED: string;
55
- NO_AUTHORITY: string;
56
- KickoutTipContent: string;
57
- UNSUPPORT_CALL: string;
58
- SHARE_CONTENT_FAILED: string;
3
+ [key in TLocale]: {
4
+ [key: string]: string;
5
+ };
59
6
  };
@@ -18,26 +18,34 @@ export interface ISignParams {
18
18
  method: string;
19
19
  url: string;
20
20
  data: string;
21
+ clientId: string;
22
+ clientSecret: string;
23
+ }
24
+ export interface IAxiosRequestConfig extends AxiosRequestConfig {
25
+ sign?: 0 | 1 | 2;
26
+ clientSecret?: string;
27
+ clientId?: string;
21
28
  }
22
29
  declare class HttpClient {
23
30
  commonOption: AxiosRequestConfig;
24
31
  axios: AxiosInstance;
25
32
  loginInfo: any;
26
- logger: Logger;
33
+ logger: Logger | null;
27
34
  private baseUrl;
28
35
  private clientId;
29
- constructor(commonOption: AxiosRequestConfig);
36
+ constructor(commonOption: IAxiosRequestConfig);
30
37
  setLogger(logger: Logger): void;
31
38
  setBaseUrl(url: string): void;
32
39
  setClientId(clientId: string): void;
40
+ setHttpConfig(config: IAxiosRequestConfig): void;
33
41
  setHeader(params: ISignParams): any;
34
42
  setLoginInfo(loginInfo: any): void;
35
- assignOptions: (option?: AxiosRequestConfig) => AxiosRequestConfig & {
43
+ assignOptions: (option?: AxiosRequestConfig | undefined) => AxiosRequestConfig & {
36
44
  params: any;
37
45
  };
38
- get: (url: string, option?: AxiosRequestConfig) => any;
39
- put: (url: string, data?: any, option?: AxiosRequestConfig) => any;
40
- post: (url: string, data?: any, option?: AxiosRequestConfig) => any;
41
- delete: (url: string, option?: AxiosRequestConfig) => any;
46
+ get: (url: string, option?: IAxiosRequestConfig | undefined) => any;
47
+ put: (url: string, data?: any, option?: AxiosRequestConfig | undefined) => any;
48
+ post: (url: string, data?: any, option?: AxiosRequestConfig | undefined) => any;
49
+ delete: (url: string, option?: AxiosRequestConfig | undefined) => any;
42
50
  }
43
51
  export default HttpClient;
@@ -0,0 +1,8 @@
1
+ import { TLocale } from 'src/type';
2
+ export declare let locale: TLocale;
3
+ /**
4
+ * 设置语言
5
+ *
6
+ * @param { TLocale } language 语言
7
+ */
8
+ export declare const setLocale: (language: TLocale) => void;
@@ -1,3 +1,3 @@
1
1
  declare const closePreviewStream: (stream: MediaStream) => Promise<void>;
2
- declare const setOutputAudioDevice: (element: any, outputValue: any) => void;
2
+ declare const setOutputAudioDevice: (element: any, outputValue: string) => void;
3
3
  export { closePreviewStream, setOutputAudioDevice };
@@ -4,6 +4,14 @@
4
4
  * @authors Luo-jinghui (luojinghui424@gmail.com)
5
5
  * @date 2019-10-22 20:08:33
6
6
  */
7
+ /**
8
+ * @value INFO 所有信息
9
+ * @value DEBUG 所有调试信息
10
+ * @value WARNING 所有警告信息
11
+ * @value ERROR 所有错误信息
12
+ * @value NONE 不打印任何信息
13
+ */
14
+ declare type TypeLogLevel = 'INFO' | 'DEBUG' | 'WARNING' | 'ERROR' | 'NONE';
7
15
  interface ILogLevel {
8
16
  INFO: 'INFO';
9
17
  DEBUG: 'DEBUG';
@@ -18,33 +26,127 @@ interface ILog {
18
26
  rest: any;
19
27
  }
20
28
  declare class Logger {
29
+ /**
30
+ * @member { DB } db indexDB数据库
31
+ */
21
32
  private db;
33
+ /**
34
+ * @member { boolean } isArrowUpload 是否运训上传日志到小鱼云服务器
35
+ */
22
36
  private isArrowUpload;
37
+ /**
38
+ * @member { boolean } isAddCache 是否允许缓存写入数据库失败的数据
39
+ */
23
40
  private isAddCache;
41
+ /**
42
+ * @member { ILogLevel } LogLevel 设置日志等级
43
+ */
24
44
  LogLevel: ILogLevel;
45
+ /**
46
+ * @member { string } currentLevel 设置当前日志等级
47
+ */
25
48
  currentLevel: string;
49
+ /**
50
+ * @member { ILog[] } cacheData 缓存日志信息
51
+ */
26
52
  cacheData: ILog[];
27
53
  constructor();
28
54
  stopDB: () => void;
29
55
  openDB: () => void;
56
+ /**
57
+ * 如果db没有开启,那么需要初始话db,并清理之前的数据
58
+ */
30
59
  initDB: () => Promise<void>;
31
- setLogLevel: (level: string) => void;
32
- putLog: (title: any, content: any, rest: any, nowTime: any) => Promise<void>;
33
- debug(title?: any, content?: any, ...rest: any[]): void;
34
- log(title: any, content?: any, ...rest: any[]): void;
35
- warn(title: any, content?: any, ...rest: any[]): void;
60
+ /**
61
+ * 设置日志等级
62
+ *
63
+ * @public
64
+ * @param { TypeLogLevel } level 日志等级
65
+ */
66
+ setLogLevel: (level: TypeLogLevel) => void;
67
+ /**
68
+ * 写入数据库
69
+ *
70
+ * @param { string } title 日志key
71
+ * @param { any } content 日志内容,必须是可序列化的数据
72
+ * @param { any } rest 其他内容,同content
73
+ * @param { any } nowTime 日志写入时间
74
+ */
75
+ putLog: (title: string, content: any, rest: any, nowTime: any) => Promise<void>;
76
+ /**
77
+ * 控制台输出debug信息,并写入日志
78
+ *
79
+ * @public
80
+ * @param { string } title 日志key
81
+ * @param { any } content 日志内容,必须是可序列化的数据
82
+ * @param { any[] } rest 其他内容,同content
83
+ */
84
+ debug(title?: string, content?: any, ...rest: any[]): void;
85
+ /**
86
+ * 控制台输出log信息,并写入日志
87
+ * 输出 INFO、WARNING、ERROR 级别的日志信息
88
+ *
89
+ * @public
90
+ * @param { string } title 日志key
91
+ * @param { any } content 日志内容,必须是可序列化的数据
92
+ * @param { any[] } rest 其他内容,同content
93
+ */
94
+ log(title: string, content?: any, ...rest: any[]): void;
95
+ /**
96
+ * 控制台输出warn信息,并写入日志
97
+ * 输出 WARNING 和 ERROR 级别的日志信息
98
+ *
99
+ * @public
100
+ * @param { string } title 日志key
101
+ * @param { any } content 日志内容,必须是可序列化的数据
102
+ * @param { any[] } rest 其他内容,同content
103
+ */
104
+ warn(title: string, content?: any, ...rest: any[]): void;
105
+ /**
106
+ * 控制台输出error信息,并写入日志
107
+ * 输出 ERROR 级别的日志信息
108
+ *
109
+ * @public
110
+ * @param { string } title 日志key
111
+ * @param { any } content 日志内容,必须是可序列化的数据
112
+ * @param { any[] } rest 其他内容,同content
113
+ */
36
114
  error(title: any, content?: any, ...rest: any[]): void;
115
+ /**
116
+ * 允许日志上传
117
+ *
118
+ * @public
119
+ */
37
120
  enableLogUpload(): void;
121
+ /**
122
+ * 禁用日志上传
123
+ *
124
+ * @public
125
+ */
38
126
  disableLogUpload(): void;
127
+ /**
128
+ * 下载会议日志数据到本地
129
+ *
130
+ * @public
131
+ */
39
132
  downloadLog: () => Promise<void>;
40
133
  /**
41
134
  * Upload sdk log file to redmine platform
42
135
  * redmine url: http://172.20.33.81:8080/redmine/projects/crashandupload/issues
43
136
  *
44
- * @param name file's name
45
- * @param account file's account
137
+ * @public
138
+ * @param { string } name 上传文件名
139
+ * @param { string } account 上传账号
140
+ * @param { string } comments 上传时备注信息
141
+ * @returns { boolean } 上传结果
142
+ */
143
+ uploadLog(name?: string, account?: string, comments?: string): Promise<any>;
144
+ /**
145
+ * 设置Log Server服务器地址
146
+ *
147
+ * @public
148
+ * @param { string } logServer Log服务器地址
46
149
  */
47
- uploadLog(name: any, account?: string, comments?: string): Promise<boolean>;
48
150
  setLogServer: (logServer: string) => void;
49
151
  }
50
152
  export default Logger;
@@ -13,7 +13,7 @@ interface socketOptions {
13
13
  params?: any;
14
14
  }
15
15
  declare class Socket {
16
- socket: any;
16
+ socket: WebSocket;
17
17
  private messageList;
18
18
  private options;
19
19
  private headBeatTimer;
@@ -26,6 +26,7 @@ declare class Socket {
26
26
  private isConnected;
27
27
  private isClose;
28
28
  private logger;
29
+ private client;
29
30
  constructor(options: socketOptions, client: any);
30
31
  connect(isReconnect?: boolean): void;
31
32
  addEvent(): void;
@@ -36,12 +37,13 @@ declare class Socket {
36
37
  onErrorSocket: (e: any) => void;
37
38
  sendHeartBeat(): void;
38
39
  creatTimeout(): void;
39
- handlePang(): void;
40
40
  emit(type: string, data: any): void;
41
+ clearPangTimer(): void;
42
+ clearBeatTimer(): void;
41
43
  reset(): void;
42
44
  on(type: string, fn: any): void;
43
45
  close(isReconnect?: boolean): void;
44
- send(data: any, parase?: boolean): void;
46
+ send(data: any, parase?: boolean, isLog?: boolean): void;
45
47
  stopCall(): void;
46
48
  reConnect(): void;
47
49
  }
@@ -43,10 +43,12 @@ export declare const getMillTime: () => string;
43
43
  * @param format
44
44
  */
45
45
  export declare const diffTime: (time1: number, time2: number, format?: string) => number;
46
- export declare const mapToObj: (data: any) => {};
47
- export declare const getStatus: (code: number, msg: string, detail?: {}) => {
46
+ export declare function mapToObj<T>(data: Map<string, T>): {
47
+ [key: string]: T;
48
+ };
49
+ export declare const getStatus: (code: number, detail?: any, msg?: string) => {
48
50
  code: number;
49
51
  msg: string;
50
- detail: {};
52
+ detail: any;
51
53
  };
52
- export declare const getErrorMsg: (err: any) => string;
54
+ export declare const getErrorMsg: (err: Error) => string;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * SDK对外回调错误消息
3
+ *
4
+ * @property { number } code 错误码
5
+ * @property { string } msg 错误信息
6
+ * @property { unknwn } detail 数据详情
7
+ */
8
+ export interface IStatus {
9
+ code: number;
10
+ msg: string;
11
+ detail: any;
12
+ }
13
+ /**
14
+ * 国际化,目前只支持 英文、中文、繁体
15
+ *
16
+ */
17
+ export declare type TLocale = 'en_US' | 'zh_CN' | 'zh_TW';
18
+ /**
19
+ * 是否支持入会
20
+ */
21
+ export interface ICheckSystemRequirements {
22
+ result: boolean;
23
+ detail: {
24
+ isSupportRTC: boolean;
25
+ isSupportWebsocket: boolean;
26
+ isSupportH264: boolean;
27
+ isSupportBrowser: boolean;
28
+ };
29
+ }