@xylink/xy-rtc-sdk 3.9.1 → 3.10.0-beta.4

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.
Files changed (51) hide show
  1. package/lib/action/index.d.ts +101 -19
  2. package/lib/enum/client.d.ts +1 -1
  3. package/lib/enum/{contraints.d.ts → constraints.d.ts} +6 -0
  4. package/lib/enum/device.d.ts +34 -0
  5. package/lib/enum/errorCode.d.ts +7 -1
  6. package/lib/enum/i18n.d.ts +6 -0
  7. package/lib/enum/index.d.ts +60 -6
  8. package/lib/enum/meeting.d.ts +4 -0
  9. package/lib/feature/index.d.ts +1 -0
  10. package/lib/feature/speaker.d.ts +61 -0
  11. package/lib/index.d.ts +11 -10
  12. package/lib/main/ability/const.d.ts +2 -0
  13. package/lib/main/ability/index.d.ts +31 -0
  14. package/lib/main/{iauth.d.ts → auth.d.ts} +8 -8
  15. package/lib/main/client.d.ts +191 -99
  16. package/lib/main/clientImplements.d.ts +99 -0
  17. package/lib/main/deviceManager.d.ts +150 -93
  18. package/lib/main/helper.d.ts +62 -9
  19. package/lib/main/layout/index.d.ts +67 -31
  20. package/lib/main/meeting.d.ts +32 -26
  21. package/lib/main/peer.d.ts +3 -1
  22. package/lib/main/stream.d.ts +47 -21
  23. package/lib/main/videoManager.d.ts +95 -12
  24. package/lib/tools/{audioLevel.d.ts → analyser.d.ts} +11 -4
  25. package/lib/tools/browser.d.ts +2 -0
  26. package/lib/tools/httpClient.d.ts +27 -6
  27. package/lib/tools/index.d.ts +12 -5
  28. package/lib/tools/{logger.d.ts → log/logger.d.ts} +18 -7
  29. package/lib/tools/log/loggerManager.d.ts +69 -0
  30. package/lib/tools/promiseQueue.d.ts +45 -0
  31. package/lib/tools/queue.d.ts +12 -15
  32. package/lib/tools/resize.d.ts +62 -0
  33. package/lib/tools/snapshot.d.ts +31 -0
  34. package/lib/tools/socket.d.ts +99 -32
  35. package/lib/tools/utils.d.ts +13 -5
  36. package/lib/type/ability.d.ts +25 -0
  37. package/lib/type/analyser.d.ts +18 -0
  38. package/lib/type/{iauth.d.ts → auth.d.ts} +0 -7
  39. package/lib/type/base.d.ts +16 -0
  40. package/lib/type/client.d.ts +154 -74
  41. package/lib/type/device.d.ts +103 -31
  42. package/lib/type/index.d.ts +3 -1
  43. package/lib/type/layout.d.ts +34 -0
  44. package/lib/type/logger.d.ts +19 -1
  45. package/lib/type/meeting.d.ts +294 -10
  46. package/lib/type/socket.d.ts +60 -0
  47. package/lib/type/stream.d.ts +20 -12
  48. package/lib/xyrtc.cjs.js +1 -1
  49. package/lib/xyrtc.umd.js +1 -1
  50. package/package.json +7 -5
  51. /package/lib/tools/{logger.worker.d.ts → log/logger.worker.d.ts} +0 -0
@@ -0,0 +1,69 @@
1
+ import Logger from './logger';
2
+ import { ILoggerConfig, UploadLogParams } from '../../type';
3
+ declare class LogManager {
4
+ private logMap;
5
+ private static instance;
6
+ private action;
7
+ constructor();
8
+ static getInstance(): LogManager;
9
+ /**
10
+ * 根据数据库名称获取对应的日志库
11
+ *
12
+ * @param { string } dbName - 日志库名称
13
+ * @returns { Logger } - 对应的日质库
14
+ */
15
+ getLogger(dbName: string): Logger | undefined;
16
+ /**
17
+ * 销毁日志模块
18
+ *
19
+ * @param { string } dbName - 日志库名称,默认不传,销毁所有日志模块
20
+ */
21
+ destroy(dbName?: string): void;
22
+ /**
23
+ * 停止日志模块
24
+ *
25
+ * @param { string } dbName - 日志库名称,默认不传,停止所有日志模块
26
+ */
27
+ stop(dbName?: string): void;
28
+ /**
29
+ * 创建单个日志库
30
+ *
31
+ * @param { ILoggerConfig } config - 日志模块配置
32
+ * @returns { Logger } - 日志库
33
+ */
34
+ createLogger(config: ILoggerConfig): Logger;
35
+ /**
36
+ * 设置日志上传地址
37
+ *
38
+ * @param { string } logServer - 日志上传服务器地址
39
+ * @param { string } dbName - 日志库名称
40
+ */
41
+ setLogServer(logServer?: string, dbName?: string): void;
42
+ /**
43
+ * 下载日志
44
+ *
45
+ * @param { string } dbName - 日志库名称,默认不传,下载所有日志
46
+ * @returns { boolean } - 上传结果
47
+ */
48
+ downloadLog(dbName?: string): Promise<boolean>;
49
+ /**
50
+ * 上传日志
51
+ *
52
+ * @param { UploadLogParams } params - 参数
53
+ * @property { string } params.name - 上传文件名
54
+ * @property { string } params.account - 上传账号
55
+ * @property { string } params.comments - 上传时备注信息
56
+ * @property { string } params.dbName - 日志库名称,默认不传,上传所有日志
57
+ * @returns { boolean } - 上传结果
58
+ */
59
+ uploadLog({ name, account, comments, dbName }: UploadLogParams): Promise<any>;
60
+ /**
61
+ * 导出所有日志库Blob数据
62
+ *
63
+ * @returns { Promise<Blob> } - 多个日志库合并后的blob数据
64
+ */
65
+ private exportAllBlob;
66
+ }
67
+ declare const logManager: LogManager;
68
+ export default LogManager;
69
+ export { logManager };
@@ -0,0 +1,45 @@
1
+ /**
2
+ * XYLink WebRTC SDK Queue Task Lib
3
+ *
4
+ * Created at : 2023-04-19 09:46:28
5
+ * Last modified : 2023-04-25 16:54:44
6
+ */
7
+ type AsyncFn<T> = (...args: any[]) => Promise<T>;
8
+ declare class PromiseQueue<T> {
9
+ private isRunning;
10
+ private taskCompletedCB;
11
+ private waitingQueue;
12
+ constructor();
13
+ /**
14
+ * 监听任务执行完成状态
15
+ *
16
+ * @param { (() => void) | null } callback - 任务结束回调
17
+ */
18
+ onTaskCompleted(callback: () => void): void;
19
+ /**
20
+ * 添加同步任务
21
+ *
22
+ * @param { AsyncFn<T> } task - 同步任务函数
23
+ * @returns { Promise<T> }
24
+ */
25
+ addTask(task: AsyncFn<T>): Promise<T>;
26
+ /**
27
+ * 执行同步任务队列
28
+ *
29
+ * @param { AsyncFn<T> } task - 同步任务函数
30
+ * @param { Fn } resolve - Resolve函数
31
+ * @param { Fn } reject - Reject函数
32
+ */
33
+ private execute;
34
+ /**
35
+ * 获取执行中的任务数量
36
+ *
37
+ * @returns { number }
38
+ */
39
+ taskLength(): number;
40
+ /**
41
+ * 清空任务队列
42
+ */
43
+ clear(): void;
44
+ }
45
+ export default PromiseQueue;
@@ -4,37 +4,34 @@
4
4
  * Created at : 2023-04-19 09:46:28
5
5
  * Last modified : 2023-04-25 16:54:44
6
6
  */
7
- type AsyncFn<T> = (...args: any[]) => Promise<T>;
8
- declare class Queue<T> {
9
- private isRunning;
7
+ type Fn = (...args: any[]) => any;
8
+ declare class Queue {
9
+ private isLock;
10
10
  private taskCompletedCB;
11
11
  private waitingQueue;
12
12
  constructor();
13
13
  /**
14
14
  * 监听任务执行完成状态
15
15
  *
16
- * @param { (() => void) | null } callback - 任务结束回调
16
+ * @param { Fn } callback - 任务结束回调
17
17
  */
18
- onTaskCompleted(callback: () => void): void;
18
+ onTaskCompleted(callback: Fn): void;
19
19
  /**
20
- * 添加同步任务
20
+ * 添加任务
21
21
  *
22
- * @param { AsyncFn<T> } task - 同步任务函数
23
- * @returns { Promise<T> }
22
+ * @param { Fn } task - 任务函数
24
23
  */
25
- addTask(task: AsyncFn<T>): Promise<T>;
24
+ addTask(task: Fn): void;
26
25
  /**
27
- * 执行同步任务队列
26
+ * 执行任务队列
28
27
  *
29
- * @param { AsyncFn<T> } task - 同步任务函数
30
- * @param { Fn } resolve - Resolve函数
31
- * @param { Fn } reject - Reject函数
28
+ * @param { Fn} task - 无值时,执行所有任务
32
29
  */
33
- private execute;
30
+ execute(task?: Fn): void;
34
31
  /**
35
32
  * 获取执行中的任务数量
36
33
  *
37
- * @returns { number }
34
+ * @returns { number } - 任务队列长度
38
35
  */
39
36
  taskLength(): number;
40
37
  /**
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Dom and Window resize event
3
+ *
4
+ * @author jinghuiLuo - luojinghui424@gmail
5
+ *
6
+ * Created at : 2022-10-31 17:18:32
7
+ * Last modified : 2022-10-31 17:56:04
8
+ */
9
+ export interface ResizeData {
10
+ width: number;
11
+ height: number;
12
+ element: HTMLElement | null;
13
+ }
14
+ export default class Resize {
15
+ private eleId;
16
+ private element;
17
+ private resizeObserver;
18
+ private resizeMode;
19
+ private detectCount;
20
+ private maxDetectCount;
21
+ private detectTimer;
22
+ private onResize;
23
+ constructor();
24
+ /**
25
+ * 上报Element元素的尺寸信息
26
+ */
27
+ private handleResize;
28
+ /**
29
+ * 初始化监听Dom尺寸变化
30
+ *
31
+ * @param { string } eleId - 监听的容器ID,如果配置为空,则直接监听window resize事件
32
+ * @param { function } onResize - 变化回调函数
33
+ */
34
+ init(eleId: string, onResize: () => void): void;
35
+ /**
36
+ * 启动定时器,监听是否存在指定的Element元素
37
+ * 存在则转换为Observer监听Dom方式
38
+ */
39
+ startDetectTimer(): void;
40
+ /**
41
+ * 清理检测Element的定时器
42
+ */
43
+ clearDetectTimer(): void;
44
+ /**
45
+ * 启动Window Resize监听事件
46
+ */
47
+ startListenerResize(): void;
48
+ /**
49
+ * 启动Element Dom监听大小变化事件
50
+ */
51
+ startObserverResize(): void;
52
+ /**
53
+ * 监听事件销毁事件
54
+ */
55
+ destroy(): void;
56
+ /**
57
+ * 移除Window绑定事件
58
+ */
59
+ removeResizeListener(): void;
60
+ }
61
+ declare const resize: Resize;
62
+ export { resize };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * snapshot implements lib
3
+ *
4
+ * @summary Implement drawing of video onto canvas and obtain screenshots
5
+ *
6
+ * Created at : 2023-08-30 15:24:24
7
+ * Last modified : 2023-09-12 18:03:44
8
+ */
9
+ import { SnapshotOptions, SnapshotResult } from '../type';
10
+ declare class Snapshot {
11
+ private canvas;
12
+ private ctx;
13
+ constructor(canvas?: HTMLCanvasElement);
14
+ getCanvas(): HTMLCanvasElement;
15
+ /**
16
+ * 根据传入的video元素,获取对应的截图
17
+ *
18
+ * @param { HTMLVideoElement } videoEle - video标签元素
19
+ * @param { IOptions } options - 绘制参数
20
+ * @returns
21
+ */
22
+ getVideoImage(videoEle: HTMLVideoElement, options?: SnapshotOptions): SnapshotResult;
23
+ /**
24
+ * 根据相关参数,将video绘制到canvas上
25
+ *
26
+ * @param { IOptions } options - 绘制参数
27
+ * @returns
28
+ */
29
+ private drawFrame;
30
+ }
31
+ export default Snapshot;
@@ -3,21 +3,12 @@
3
3
  * @authors Luo-jinghui (luojinghui424@gmail.com)
4
4
  * @date 2019-10-24 12:01:27
5
5
  */
6
- interface socketOptions {
7
- url: string;
8
- protocols?: string[];
9
- pingData?: string;
10
- pangData?: string;
11
- openHeatBeat?: boolean;
12
- autoReConnect?: boolean;
13
- params?: any;
14
- }
15
- declare class Socket {
6
+ import Logger from './log/logger';
7
+ import { SocketOptions } from '../type/socket';
8
+ import Emitter from './emitter';
9
+ declare class Socket extends Emitter {
16
10
  socket: WebSocket;
17
- private messageList;
18
11
  private options;
19
- private headBeatTimer;
20
- private pangTimer;
21
12
  private heatBeatFrequency;
22
13
  private timeOffset;
23
14
  private reconnectCount;
@@ -26,28 +17,104 @@ declare class Socket {
26
17
  private isConnected;
27
18
  private isClose;
28
19
  private logger;
29
- private client;
30
20
  private reconnectOffset;
21
+ private headBeatTimer;
22
+ private pangTimer;
31
23
  private reconnectTimer;
32
- constructor(options: socketOptions, client: any);
33
- connect(isReconnect?: boolean): void;
34
- addEvent(): void;
35
- removeEvent(): void;
36
- onOpenSocket: (e: any) => void;
37
- onHandleMessage: (e: any) => void;
38
- onCloseSocket: (e: CloseEvent) => void;
39
- onErrorSocket: (e: any) => void;
40
- sendHeartBeat(): void;
41
- clearTimeout(): void;
42
- emit(type: string, data: any): void;
43
- clearPangTimer(): void;
44
- clearBeatTimer(): void;
45
- clearReconnectTimer(): void;
46
- reset(): void;
47
- on(type: string, fn: any): void;
24
+ private taskQueue;
25
+ constructor(options: SocketOptions, logger: Logger);
26
+ /**
27
+ * 连接socket
28
+ *
29
+ * @param { boolean } isReconnect - 是否是重连
30
+ */
31
+ private connect;
32
+ /**
33
+ * 监听socket事件
34
+ */
35
+ private addEvent;
36
+ /**
37
+ * 移除监听socket事件
38
+ */
39
+ private removeEvent;
40
+ /**
41
+ * WS 连接成功
42
+ *
43
+ * @param { Event } e - 连接事件
44
+ */
45
+ private onOpenSocket;
46
+ /**
47
+ * 处理WS消息
48
+ *
49
+ * @param e
50
+ * @returns
51
+ */
52
+ private onHandleMessage;
53
+ /**
54
+ * 处理WS关闭消息
55
+ *
56
+ * @param { CloseEvent } e - 关闭事件
57
+ * @returns
58
+ */
59
+ private onCloseSocket;
60
+ /**
61
+ * 监听Error事件
62
+ *
63
+ * @param { Event } e - 错误事件
64
+ * @returns
65
+ */
66
+ private onErrorSocket;
67
+ /**
68
+ * 处理Error/Close后的重连
69
+ */
70
+ private handleReconnectCount;
71
+ /**
72
+ * 发送心跳事件
73
+ */
74
+ private sendHeartBeat;
75
+ /**
76
+ * 创建倒计时,响应是否接收到pang消息
77
+ */
78
+ private startTimerAndHandlePang;
79
+ /**
80
+ * 关闭socket
81
+ *
82
+ * @param { boolean } isReconnect - 是否是重连
83
+ */
48
84
  close(isReconnect?: boolean): void;
85
+ /**
86
+ * 发送数据
87
+ *
88
+ * @param { any } data - 发送的数据
89
+ * @param { boolean } parse - 是否需要JSON.stringify
90
+ * @param { boolean } isLog - 是否需要打印日志
91
+ */
49
92
  send(data: any, parse?: boolean, isLog?: boolean): void;
50
- stopCall(): void;
51
- reConnect(): void;
93
+ /**
94
+ * wss 重连
95
+ */
96
+ private reConnect;
97
+ /**
98
+ * 发送消息到消息队列
99
+ *
100
+ * @param { any } data - 消息数据
101
+ */
102
+ private sendMessageToQueue;
103
+ /**
104
+ * 清除pang定时器
105
+ */
106
+ private clearPangTimer;
107
+ /**
108
+ * 清除心跳定时器
109
+ */
110
+ private clearBeatTimer;
111
+ /**
112
+ * 清除ws重连定时器
113
+ */
114
+ private clearReconnectTimer;
115
+ /**
116
+ * 重置参数
117
+ */
118
+ private reset;
52
119
  }
53
120
  export default Socket;
@@ -38,12 +38,13 @@ export declare const getTime: () => string;
38
38
  */
39
39
  export declare const getMillTime: () => string;
40
40
  /**
41
- * 获取时间戳差值
42
- * @param time1
43
- * @param time2
44
- * @param format
41
+ * 计算两个时间戳相差的天数
42
+ *
43
+ * @param { number } time1 - 时间戳1
44
+ * @param { number } time2 - 时间戳2
45
+ * @returns { number } day - 天数
45
46
  */
46
- export declare const diffTime: (time1: number, time2: number, format?: string) => number;
47
+ export declare const diffTime: (time1: number, time2: number) => number;
47
48
  export declare function mapToObj<T>(data: Map<string, T>): {
48
49
  [key: string]: T;
49
50
  };
@@ -78,3 +79,10 @@ export declare const TYPEOF: {
78
79
  isSpecialChar(val: any): boolean;
79
80
  isWhiteSpace(val: any): boolean;
80
81
  };
82
+ /**
83
+ * JSON字符串转对象
84
+ *
85
+ * @param { any } jsonString
86
+ * @returns { object}
87
+ */
88
+ export declare const jsonStringToObject: (jsonString: any) => any;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * 能力集 key
3
+ *
4
+ * @param { string } USE_SEC_API - 终端是否要使用uss新接口
5
+ * @param { string } MEETING_SHARE_NEW_PAGE_API - 终端是否要使用uss新接口
6
+ */
7
+ export declare enum AbilityKey {
8
+ USE_SEC_API = "use_sec_api",
9
+ MEETING_SHARE_NEW_PAGE_API = "meeting_share_new_page_api"
10
+ }
11
+ /**
12
+ * 能力集
13
+ */
14
+ export type AbilityResult = {
15
+ [key in AbilityKey]?: boolean;
16
+ };
17
+ /**
18
+ * 本地能力集
19
+ */
20
+ export type LocalAbility = {
21
+ [key in string]: {
22
+ value: number;
23
+ offset: number;
24
+ };
25
+ };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Audio Analyser Lib
3
+ *
4
+ * @summary short description for the file
5
+ *
6
+ * Created at : 2023-09-05 17:17:12
7
+ * Last modified : 2023-09-08 15:37:56
8
+ */
9
+ /**
10
+ * 分析器配置
11
+ *
12
+ * @param { number } fftSize - 执行快速傅里叶变换 (FFT) 以获得频域数据时使用的样本窗口大小,可选值:32/64/125/256/512/1024/2048
13
+ * @param { number } cardinalNumber - 转换0-128的基数,默认是1:1,配置128,如果将声量转为1:2效果,则配置为64,依此类推
14
+ */
15
+ export interface AnalyserConfig {
16
+ fftSize?: number;
17
+ cardinalNumber?: number;
18
+ }
@@ -1,10 +1,3 @@
1
- /**
2
- *
3
- * @param { string } extId
4
- */
5
- export interface ExtInfo {
6
- extId: string;
7
- }
8
1
  /**
9
2
  * 登录方式
10
3
  *
@@ -81,3 +81,19 @@ export interface IReturnResult {
81
81
  detail: any;
82
82
  }
83
83
  export type Key = string | number;
84
+ /**
85
+ * localStorage Key
86
+ *
87
+ * @param { XY_ABILITY } - 能力结果
88
+ * @param { XY_LOG_SERVER } - 日志服务
89
+ * @param { XY_ERROR_CODE } - 错误码
90
+ * @param { XY_I18N_CODE } - 国际化
91
+ * @param { XY_TIMESTAMP } - 时间戳
92
+ */
93
+ export declare enum STORAGE {
94
+ XY_ABILITY = "XY-ABILITY",
95
+ XY_LOG_SERVER = "xy-log-server",
96
+ XY_ERROR_CODE = "xy-error-code",
97
+ XY_I18N_CODE = "xy-i18n-code",
98
+ XY_TIMESTAMP = "xy-timestamp"
99
+ }