@xylink/xy-rtc-sdk 3.9.11-private.6 → 4.0.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.
Files changed (124) hide show
  1. package/README.MD +36 -13
  2. package/lib/action/index.d.ts +106 -36
  3. package/lib/enum/analyser.d.ts +7 -0
  4. package/lib/enum/client.d.ts +8 -2
  5. package/lib/enum/constraints.d.ts +51 -0
  6. package/lib/enum/device.d.ts +28 -0
  7. package/lib/enum/errorCode.d.ts +8 -2
  8. package/lib/enum/i18n.d.ts +6 -0
  9. package/lib/enum/index.d.ts +90 -7
  10. package/lib/enum/meeting.d.ts +4 -0
  11. package/lib/enum/polling.d.ts +2 -11
  12. package/lib/feature/customMessage/index.d.ts +29 -0
  13. package/lib/feature/edu/index.d.ts +34 -0
  14. package/lib/feature/edu/index.type.d.ts +29 -0
  15. package/lib/feature/index.d.ts +3 -0
  16. package/lib/feature/speaker/index.d.ts +81 -0
  17. package/lib/feature/speaker/index.type.d.ts +17 -0
  18. package/lib/index.d.ts +84 -31
  19. package/lib/interface/baseModule.type.d.ts +9 -0
  20. package/lib/interface/clientInterface.type.d.ts +128 -0
  21. package/lib/interface/contentTrackInterface.type.d.ts +15 -0
  22. package/lib/interface/event.type.d.ts +444 -0
  23. package/lib/interface/videoAudioTrackInterface.type.d.ts +17 -0
  24. package/lib/main/ability/const.d.ts +5 -0
  25. package/lib/main/ability/index.d.ts +37 -0
  26. package/lib/main/{iauth.d.ts → auth/index.d.ts} +34 -26
  27. package/lib/main/client.d.ts +643 -637
  28. package/lib/main/clientBase.d.ts +40 -0
  29. package/lib/main/clientState.d.ts +56 -0
  30. package/lib/main/device/index.d.ts +272 -0
  31. package/lib/main/device/index.type.d.ts +204 -0
  32. package/lib/main/helper/index.d.ts +118 -0
  33. package/lib/main/helper/index.type.d.ts +12 -0
  34. package/lib/main/layout/index.d.ts +74 -108
  35. package/lib/main/layout/index.type.d.ts +282 -0
  36. package/lib/main/layout/polling.d.ts +17 -13
  37. package/lib/main/layout/state.d.ts +163 -0
  38. package/lib/main/layout/template.d.ts +3 -3
  39. package/lib/main/media/index.d.ts +177 -0
  40. package/lib/main/media/index.type.d.ts +29 -0
  41. package/lib/main/meeting/control.d.ts +107 -0
  42. package/lib/main/meeting/control.type.d.ts +24 -0
  43. package/lib/main/{meeting.d.ts → meeting/index.d.ts} +58 -28
  44. package/lib/main/meeting/verify.d.ts +70 -0
  45. package/lib/main/meeting/verify.type.d.ts +12 -0
  46. package/lib/main/peer.d.ts +67 -19
  47. package/lib/main/plugin/index.d.ts +28 -0
  48. package/lib/{tools/quality.d.ts → main/quality/index.d.ts} +2 -2
  49. package/lib/{tools → main/quality}/quality.worker.d.ts +1 -1
  50. package/lib/main/{qualityManager.d.ts → quality/report.d.ts} +11 -5
  51. package/lib/main/render/index.d.ts +116 -0
  52. package/lib/main/render/index.type.d.ts +36 -0
  53. package/lib/main/render/videoManager.d.ts +190 -0
  54. package/lib/main/render/videoManager.type.d.ts +66 -0
  55. package/lib/main/roster/index.d.ts +39 -0
  56. package/lib/main/server/index.d.ts +79 -0
  57. package/lib/main/server/index.type.d.ts +21 -0
  58. package/lib/main/signal/index.d.ts +15 -0
  59. package/lib/main/socket/index.d.ts +95 -0
  60. package/lib/main/stream/index.d.ts +182 -0
  61. package/lib/main/track/baseTrack.d.ts +178 -0
  62. package/lib/main/track/contentTrack.d.ts +168 -0
  63. package/lib/main/track/customContentTrack.d.ts +18 -0
  64. package/lib/main/track/customVideoAudioTrack.d.ts +18 -0
  65. package/lib/main/track/helper.d.ts +53 -0
  66. package/lib/main/track/videoAudioCapture.d.ts +90 -0
  67. package/lib/main/track/videoAudioTrack.d.ts +273 -0
  68. package/lib/main/vom/index.d.ts +44 -0
  69. package/lib/main/vom/index.type.d.ts +1 -0
  70. package/lib/tools/analyser.d.ts +53 -0
  71. package/lib/tools/analyserManager.d.ts +55 -0
  72. package/lib/tools/dbManager.d.ts +12 -1
  73. package/lib/tools/{browser.d.ts → detectBrowser/index.d.ts} +53 -5
  74. package/lib/tools/detectStream/index.d.ts +84 -0
  75. package/lib/tools/detectStream/index.type.d.ts +56 -0
  76. package/lib/tools/detectTool/index.d.ts +191 -0
  77. package/lib/tools/detectTool/index.type.d.ts +51 -0
  78. package/lib/tools/emitter.d.ts +27 -6
  79. package/lib/tools/enum.d.ts +1 -1
  80. package/lib/tools/httpClient.d.ts +23 -6
  81. package/lib/tools/i18n.d.ts +1 -1
  82. package/lib/tools/index.d.ts +5 -5
  83. package/lib/tools/{logger.d.ts → log/logger.d.ts} +59 -29
  84. package/lib/tools/{logger.worker.d.ts → log/logger.worker.d.ts} +1 -1
  85. package/lib/tools/log/loggerManager.d.ts +70 -0
  86. package/lib/tools/pressure/index.d.ts +33 -0
  87. package/lib/tools/pressure/index.type.d.ts +22 -0
  88. package/lib/tools/promiseQueue.d.ts +51 -0
  89. package/lib/tools/queue.d.ts +12 -15
  90. package/lib/tools/resize.d.ts +65 -0
  91. package/lib/tools/snapshot.d.ts +31 -0
  92. package/lib/tools/socket.d.ts +109 -32
  93. package/lib/tools/template/index.d.ts +3 -3
  94. package/lib/tools/template/mobile.d.ts +1 -1
  95. package/lib/tools/template/polling.d.ts +1 -1
  96. package/lib/tools/utils.d.ts +22 -19
  97. package/lib/tools/verify.d.ts +7 -0
  98. package/lib/type/ability.d.ts +25 -0
  99. package/lib/type/analyser.d.ts +43 -0
  100. package/lib/type/{iauth.d.ts → auth.d.ts} +22 -29
  101. package/lib/type/base.d.ts +41 -33
  102. package/lib/type/capture.d.ts +9 -0
  103. package/lib/type/client.d.ts +404 -498
  104. package/lib/type/index.d.ts +26 -2
  105. package/lib/type/layout.d.ts +25 -49
  106. package/lib/type/logger.d.ts +37 -12
  107. package/lib/type/meeting.d.ts +266 -27
  108. package/lib/type/peer.d.ts +24 -1
  109. package/lib/type/polling.d.ts +1 -49
  110. package/lib/type/quality.d.ts +16 -6
  111. package/lib/type/socket.d.ts +42 -0
  112. package/lib/type/stream.d.ts +154 -116
  113. package/lib/type/track.d.ts +139 -0
  114. package/lib/xyrtc.cjs.js +1 -1
  115. package/lib/xyrtc.umd.js +1 -1
  116. package/package.json +11 -3
  117. package/lib/enum/contraints.d.ts +0 -50
  118. package/lib/main/deviceManager.d.ts +0 -185
  119. package/lib/main/helper.d.ts +0 -79
  120. package/lib/main/stream.d.ts +0 -396
  121. package/lib/main/videoManager.d.ts +0 -57
  122. package/lib/tools/audioLevel.d.ts +0 -23
  123. package/lib/tools/detect.d.ts +0 -43
  124. package/lib/type/device.d.ts +0 -83
@@ -4,10 +4,9 @@
4
4
  * @authors Luo-jinghui (luojinghui424@gmail.com)
5
5
  * @date 2019-11-01 14:14:45
6
6
  */
7
- import { AxiosRequestConfig, AxiosInstance } from 'axios';
8
- import Logger from './logger';
9
- import { IToken } from '../type';
10
- import XyApiGatewaySDK from '@xylink/xy_api_gateway';
7
+ import { AxiosRequestConfig, AxiosInstance, AxiosError } from 'axios';
8
+ import Logger from './log/logger';
9
+ import { IToken } from '../type/index';
11
10
  export interface IResponseSuccess {
12
11
  code: number;
13
12
  data: any;
@@ -21,6 +20,10 @@ export interface IAxiosRequestConfig extends AxiosRequestConfig {
21
20
  clientSecret?: string;
22
21
  clientId?: string;
23
22
  }
23
+ export declare const invalidError: {
24
+ token_expired: number;
25
+ gateway_timestamp_expired: number;
26
+ };
24
27
  declare class HttpClient {
25
28
  commonOption: IAxiosRequestConfig;
26
29
  axios: AxiosInstance;
@@ -47,12 +50,26 @@ declare class HttpClient {
47
50
  clientId: string;
48
51
  clientSecret: string;
49
52
  }): void;
50
- initXyApiGatewaySDK(): XyApiGatewaySDK;
51
- setSignHeader(config: any): Promise<any>;
53
+ private initXyApiGatewaySDK;
54
+ private setSignHeader;
52
55
  refreshToken({ baseURL, refresh_token }: {
53
56
  baseURL?: string | undefined;
54
57
  refresh_token?: string | undefined;
55
58
  }): Promise<any>;
59
+ /**
60
+ * 处理网关时间戳过期
61
+ *
62
+ * @param { AxiosError } error - response
63
+ * @returns { AxiosRequestConfig | null }
64
+ */
65
+ handleGatewayTimestampExpired(error: AxiosError): Promise<AxiosRequestConfig | null>;
66
+ /**
67
+ * token失效,刷新token
68
+ *
69
+ * @param { AxiosError } error - response
70
+ * @returns
71
+ */
72
+ handleTokenExpired(error: AxiosError): Promise<AxiosRequestConfig>;
56
73
  assignOptions: (option?: AxiosRequestConfig) => IAxiosRequestConfig & AxiosRequestConfig & {
57
74
  params: any;
58
75
  };
@@ -1,4 +1,4 @@
1
- import { TLocale } from '../type';
1
+ import { TLocale } from '../type/index';
2
2
  export declare let locale: TLocale;
3
3
  /**
4
4
  * 设置语言
@@ -1,8 +1,8 @@
1
1
  /**
2
- * 关闭视频流
2
+ * 转换HideId隐身入会字段
3
3
  *
4
- * @param { MediaStream } stream
4
+ * @param { string } hideId - HiedId隐藏入会配置
5
+ * @returns { string } hideId
5
6
  */
6
- declare const closePreviewStream: (stream: MediaStream) => Promise<void>;
7
- declare const setOutputAudioDevice: (element: any, outputValue: string) => void;
8
- export { closePreviewStream, setOutputAudioDevice };
7
+ declare const getHideId: (hideId: string | number) => string;
8
+ export { getHideId };
@@ -5,7 +5,7 @@
5
5
  * @authors Luo-jinghui (luojinghui424@gmail.com)
6
6
  * @date 2019-10-22 20:08:33
7
7
  */
8
- import { LogLevel, ILoggerConfig, TLogLevel } from '../type';
8
+ import { LogLevel, ILoggerConfig, TLogLevel, UploadLogParams } from '../../type/index';
9
9
  declare class Logger {
10
10
  private action;
11
11
  private worker;
@@ -14,30 +14,45 @@ declare class Logger {
14
14
  config: ILoggerConfig;
15
15
  isProgress: boolean;
16
16
  isUpdateVersion: boolean;
17
+ stopTaskKey: string;
17
18
  taskPromiseMap: {
18
19
  [key: string]: any;
19
20
  };
20
21
  constructor(config: ILoggerConfig);
22
+ /**
23
+ * 获取日志模块配置
24
+ *
25
+ * @returns { ILoggerConfig } - 日志模块配置
26
+ */
27
+ getConfig(): ILoggerConfig;
21
28
  /**
22
29
  * 启动日志模块
23
30
  *
24
- * @param { ILoggerConfig? } config - Logger配置
25
31
  * @param { boolean } enableClearTable - 是否清理表
26
32
  * @returns { boolean }
27
33
  */
28
- start(enableClearTable?: boolean): true | "The log module is already enabled, please stop it first";
34
+ start(enableClearTable?: boolean | undefined): true | "The log module is already enabled, please stop it first";
29
35
  /**
30
36
  * 接收WebWorker线程消息
31
37
  *
32
38
  * @param { any } msg - WebWorker消息
33
39
  */
34
40
  onMessage(msg: any): Promise<void>;
41
+ /**
42
+ * 停止Logger,销毁数据,更新表索引
43
+ */
44
+ private destroyPromiseTask;
35
45
  /**
36
46
  * 停止日志模块
47
+ */
48
+ stop(): Promise<unknown>;
49
+ /**
50
+ * 停止日志模块-内部调用
51
+ * 此方法不需要更新表的索引,会一直在同一个表读/写数据
37
52
  *
38
53
  * @param { boolean } enabledUpdateIndex - 是否更新表
39
54
  */
40
- stop(enabledUpdateIndex?: boolean): void;
55
+ stopWithoutUpdateIndex(): Promise<unknown>;
41
56
  /**
42
57
  * 监听WebWorker错误
43
58
  *
@@ -63,55 +78,65 @@ declare class Logger {
63
78
  */
64
79
  private getTableIndex;
65
80
  /**
66
- * 设置日志等级
81
+ * 调试模式下,控制台输出日志的等级
67
82
  *
68
83
  * @param { LogLevel } level 日志等级
69
84
  */
70
85
  setLogLevel: (level: TLogLevel) => void;
71
86
  /**
72
- * 设置Log Server服务器地址
87
+ * 设置日志服务器地址
73
88
  *
74
89
  * @public
75
90
  * @param { string } logServer Log服务器地址
76
91
  */
77
92
  setLogServer: (logServer: string) => void;
78
93
  /**
79
- * 控制台输出INFO信息,并写入日志
94
+ * 控制台输出LOG信息,并写入日志
80
95
  *
81
- * @param { string } title 日志key
82
- * @param { any } content 日志内容,必须是可序列化的数据
83
- * @param { any[] } rest 其他内容,同content
96
+ * @param { string } title 可选,日志的标题
97
+ * @param { any } content 可选,日志内容,必须是可序列化的数据
98
+ * @param { any[] } rest 可选,函数剩余参数
84
99
  */
85
100
  log(title: string, content?: any, ...rest: any[]): void;
86
101
  /**
87
- * 控制台输出debug信息,并写入日志
102
+ * 控制台输出调试信息,并写入日志
88
103
  *
89
104
  * @public
90
- * @param { string } title 日志key
91
- * @param { any } content 日志内容,必须是可序列化的数据
92
- * @param { any[] } rest 其他内容,同content
105
+ * @param { string } title 可选,日志的标题
106
+ * @param { any } content 可选,日志内容,必须是可序列化的数据
107
+ * @param { any[] } rest 可选,函数剩余参数
93
108
  */
94
109
  debug(title?: string, content?: any, ...rest: any[]): void;
95
110
  /**
96
- * 控制台输出warn信息,并写入日志
111
+ * 控制台输出警告信息,并写入日志
97
112
  * 输出 WARNING 和 ERROR 级别的日志信息
98
113
  *
99
114
  * @public
100
- * @param { string } title 日志key
101
- * @param { any } content 日志内容,必须是可序列化的数据
102
- * @param { any[] } rest 其他内容,同content
115
+ * @param { string } title 可选,日志的标题
116
+ * @param { any } content 可选,日志内容,必须是可序列化的数据
117
+ * @param { any[] } rest 可选,函数剩余参数
103
118
  */
104
119
  warn(title?: string, content?: any, ...rest: any[]): void;
105
120
  /**
106
- * 控制台输出error信息,并写入日志
121
+ * 控制台输出错误信息,并写入日志
107
122
  * 输出 ERROR 级别的日志信息
108
123
  *
109
124
  * @public
125
+ * @param { string } title 可选,日志的标题
126
+ * @param { any } content 可选,日志内容,必须是可序列化的数据
127
+ * @param { any[] } rest 可选,函数剩余参数
128
+ */
129
+ error(title: any, content?: any, ...rest: any[]): void;
130
+ /**
131
+ * 输出致命信息,并写入日志
132
+ * 输出 FATAL 级别的日志信息
133
+ *
134
+ * @public
110
135
  * @param { string } title 日志key
111
136
  * @param { any } content 日志内容,必须是可序列化的数据
112
137
  * @param { any[] } rest 其他内容,同content
113
138
  */
114
- error(title: any, content?: any, ...rest: any[]): void;
139
+ fatal(title: any, content?: any, ...rest: any[]): void;
115
140
  /**
116
141
  * 发送日志内容
117
142
  *
@@ -120,27 +145,26 @@ declare class Logger {
120
145
  */
121
146
  sendLog(message: any): void;
122
147
  /**
123
- * 下载日志数据到本地
148
+ * 下载日志数据到本地,可在浏览器控制台中调用
124
149
  */
125
150
  downloadLog: (fileName?: string | '') => Promise<unknown>;
126
151
  /**
127
- * 上传日志到小鱼Devops平台
152
+ * 上传会议日志到小鱼服务器
128
153
  *
129
- * @param { string } name 上传文件名
130
- * @param { string } account 上传账号
131
- * @param { string } comments 上传时备注信息
154
+ * @param { string } name 可选,上传文件名,默认值是""
155
+ * @param { string } account 可选,上传账号,默认值是""
156
+ * @param { string } comments 可选,上传时备注信息,默认值是""
132
157
  * @returns { boolean } 上传结果
133
158
  */
134
159
  uploadLog(name?: string, account?: string, comments?: string): Promise<unknown>;
135
160
  /**
136
161
  * 上传日志到小鱼Devops平台
137
162
  *
138
- * @param { string } name 上传文件名
139
- * @param { string } account 上传账号
140
- * @param { string } comments 上传时备注信息
163
+ * @param { UploadLogParams } config - 日志上传参数
164
+ * @param { Blob } blob - 日志Blob数据
141
165
  * @returns { boolean } 上传结果
142
166
  */
143
- uploadLogProcess(config: any, blob: Blob): Promise<any>;
167
+ uploadLogProcess(config: UploadLogParams, blob: Blob): Promise<boolean>;
144
168
  /**
145
169
  * 允许日志上传
146
170
  */
@@ -149,5 +173,11 @@ declare class Logger {
149
173
  * 禁用日志上传
150
174
  */
151
175
  disableLogUpload(): void;
176
+ /**
177
+ * 获取日志数据
178
+ *
179
+ * @returns
180
+ */
181
+ getLogData(): Promise<unknown>;
152
182
  }
153
183
  export default Logger;
@@ -4,7 +4,7 @@
4
4
  * @authors Luo-jinghui (luojinghui424@gmail.com)
5
5
  *
6
6
  * Created at : 2023-04-24 14:16:27
7
- * Last modified : 2024-04-17 19:52:00
7
+ * Last modified : 2024-04-23 19:02:52
8
8
  */
9
9
  declare const _default: {
10
10
  new (scriptURL: string | URL, options?: WorkerOptions | undefined): Worker;
@@ -0,0 +1,70 @@
1
+ import Logger from './logger';
2
+ import { ILoggerConfig, UploadLogParams } from '../../type/index';
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
+ * @since 4.0.0
32
+ * @param { ILoggerConfig } config - 日志模块配置
33
+ * @returns { Logger } - 日志库
34
+ */
35
+ createLogger(config: ILoggerConfig): Logger;
36
+ /**
37
+ * 设置日志上传地址
38
+ *
39
+ * @param { string } logServer - 日志上传服务器地址
40
+ * @param { string } dbName - 日志库名称
41
+ */
42
+ setLogServer(logServer?: string, dbName?: string): void;
43
+ /**
44
+ * 下载日志
45
+ *
46
+ * @param { string } dbName - 日志库名称,默认不传,下载所有日志
47
+ * @returns { boolean } - 上传结果
48
+ */
49
+ downloadLog(dbName?: string): Promise<boolean>;
50
+ /**
51
+ * 上传日志
52
+ *
53
+ * @param { UploadLogParams } params - 参数
54
+ * @property { string } params.name - 上传文件名
55
+ * @property { string } params.account - 上传账号
56
+ * @property { string } params.comments - 上传时备注信息
57
+ * @property { string } params.dbName - 日志库名称,默认不传,上传所有日志
58
+ * @returns { boolean } - 上传结果
59
+ */
60
+ uploadLog({ name, account, comments, dbName }: UploadLogParams): Promise<boolean>;
61
+ /**
62
+ * 导出所有日志库Blob数据
63
+ *
64
+ * @returns { Promise<Blob> } - 多个日志库合并后的blob数据
65
+ */
66
+ private exportAllBlob;
67
+ }
68
+ declare const logManager: LogManager;
69
+ export default LogManager;
70
+ export { logManager };
@@ -0,0 +1,33 @@
1
+ /**
2
+ * WebRTC SDK Pressure Manager
3
+ *
4
+ * Note: https://w3c.github.io/compute-pressure/#dfn-valid-source-types
5
+ *
6
+ * Created at : 2024-06-28 16:55:47
7
+ * Last modified : 2024-06-28 18:24:13
8
+ */
9
+ import { XYBaseModule } from '../../interface/baseModule.type';
10
+ import Logger from '../log/logger';
11
+ /**
12
+ * @class
13
+ * @description: Device pressure
14
+ */
15
+ export declare class XYDevicePressure implements XYBaseModule {
16
+ private observer;
17
+ private interval;
18
+ private logger;
19
+ private pressureState;
20
+ constructor(logger: Logger);
21
+ /**
22
+ * 初始化设备压力监听
23
+ */
24
+ init(): void;
25
+ /**
26
+ * 监听回调事件
27
+ */
28
+ private pressureChange;
29
+ /**
30
+ * 资源销毁
31
+ */
32
+ destroy(): void;
33
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * 设备压力等级
3
+ *
4
+ * @param nominal - 正常,目标设备的状况处于可接受的水平,对用户没有明显的不利影响
5
+ * @param fair - 一般,设备压力略有升高,风扇活跃,除此之外,设备可以运行正常
6
+ * @param serious - 严重-设备压力持续大幅度升高,系统可能进行节流减少压力和热量
7
+ * @param critical - 恶略-设备温度显著升高,需要冷却以避免任何潜在问题
8
+ */
9
+ export declare enum PressureState {
10
+ 'nominal' = 0,
11
+ 'fair' = 1,
12
+ 'serious' = 2,
13
+ 'critical' = 3
14
+ }
15
+ /**
16
+ * 压力数据
17
+ */
18
+ export interface XYDevicePressureState {
19
+ source: string;
20
+ state: PressureState;
21
+ time: number;
22
+ }
@@ -0,0 +1,51 @@
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 { boolean } - 结果,真假值
38
+ */
39
+ isTaskEnded(): boolean;
40
+ /**
41
+ * 获取执行中的任务数量
42
+ *
43
+ * @returns { number }
44
+ */
45
+ taskLength(): number;
46
+ /**
47
+ * 清空任务队列
48
+ */
49
+ clear(): void;
50
+ }
51
+ 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,65 @@
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
+ /**
10
+ * 元素尺寸数据
11
+ */
12
+ export interface ResizeData {
13
+ width: number;
14
+ height: number;
15
+ element: HTMLElement | null;
16
+ }
17
+ export default class Resize {
18
+ private eleId;
19
+ private element;
20
+ private resizeObserver;
21
+ private resizeMode;
22
+ private detectCount;
23
+ private maxDetectCount;
24
+ private detectTimer;
25
+ private onResize;
26
+ constructor();
27
+ /**
28
+ * 上报Element元素的尺寸信息
29
+ */
30
+ private handleResize;
31
+ /**
32
+ * 初始化监听Dom尺寸变化
33
+ *
34
+ * @param { string } eleId - 监听的容器ID,如果配置为空,则直接监听window resize事件
35
+ * @param { function } onResize - 变化回调函数
36
+ */
37
+ init(eleId: string, onResize: () => void): void;
38
+ /**
39
+ * 启动定时器,监听是否存在指定的Element元素
40
+ * 存在则转换为Observer监听Dom方式
41
+ */
42
+ startDetectTimer(): void;
43
+ /**
44
+ * 清理检测Element的定时器
45
+ */
46
+ clearDetectTimer(): void;
47
+ /**
48
+ * 启动Window Resize监听事件
49
+ */
50
+ startListenerResize(): void;
51
+ /**
52
+ * 启动Element Dom监听大小变化事件
53
+ */
54
+ startObserverResize(): void;
55
+ /**
56
+ * 监听事件销毁事件
57
+ */
58
+ destroy(): void;
59
+ /**
60
+ * 移除Window绑定事件
61
+ */
62
+ removeResizeListener(): void;
63
+ }
64
+ declare const resize: Resize;
65
+ 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/index';
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;