@xmaxai/web-sdk 1.0.0 → 1.0.1
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.
- package/dist/{VideoContentMode-BXkqM4XG.d.cts → VideoContentMode-BM97_H8V.d.cts} +96 -21
- package/dist/{VideoContentMode-BXkqM4XG.d.ts → VideoContentMode-BM97_H8V.d.ts} +96 -21
- package/dist/{chunk-JJWUZ3AW.cjs → chunk-FH3OPC6F.cjs} +1486 -544
- package/dist/chunk-FH3OPC6F.cjs.map +1 -0
- package/dist/{chunk-MJ72WWQX.js → chunk-NW6YF4JT.js} +1449 -507
- package/dist/chunk-NW6YF4JT.js.map +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +624 -162
- package/dist/index.d.ts +624 -162
- package/dist/index.js +1 -1
- package/dist/react/index.cjs +3 -3
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +31 -11
- package/dist/react/index.d.ts +31 -11
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/package.json +7 -8
- package/README.md +0 -430
- package/dist/chunk-JJWUZ3AW.cjs.map +0 -1
- package/dist/chunk-MJ72WWQX.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,28 +1,47 @@
|
|
|
1
|
-
import { R as RealtimeVideoFormat, a as RealtimeVideoTrack, C as CameraPosition, V as VideoContentMode } from './VideoContentMode-
|
|
2
|
-
export { b as RealtimeVideoEncoderPreference, c as RealtimeVideoFormatInit } from './VideoContentMode-
|
|
1
|
+
import { R as RealtimeVideoFormat, a as RealtimeVideoTrack, C as CameraPosition, V as VideoContentMode } from './VideoContentMode-BM97_H8V.cjs';
|
|
2
|
+
export { b as RealtimeVideoEncoderPreference, c as RealtimeVideoFormatInit } from './VideoContentMode-BM97_H8V.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* SDK 当前支持的实时生成模型。
|
|
6
6
|
*/
|
|
7
7
|
declare enum RealtimeModel {
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Xmax X2.0 实时生成模型。
|
|
10
|
+
*/
|
|
11
|
+
x2_0 = "x2.0",
|
|
12
|
+
/**
|
|
13
|
+
* Xmax X2.0 Pro 实时生成模型。
|
|
14
|
+
*/
|
|
15
|
+
x2_0_pro = "x2.0-pro",
|
|
16
|
+
/**
|
|
17
|
+
* Xmax X2 Fast 1080P 实时生成模型。
|
|
18
|
+
*/
|
|
9
19
|
x2_fast_1080p = "x2-fast-1080p"
|
|
10
20
|
}
|
|
11
21
|
interface ModelSize {
|
|
12
22
|
width: number;
|
|
13
23
|
height: number;
|
|
14
24
|
}
|
|
15
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* 未指定视频规格时,各媒体来源使用的默认帧率。
|
|
27
|
+
*/
|
|
16
28
|
declare function defaultFrameRate(_model: RealtimeModel): number;
|
|
17
|
-
/**
|
|
18
|
-
|
|
29
|
+
/**
|
|
30
|
+
* 摄像头采集使用的默认视频规格。
|
|
31
|
+
*/
|
|
32
|
+
declare function defaultCameraVideoFormat(model: RealtimeModel): RealtimeVideoFormat;
|
|
19
33
|
|
|
20
34
|
/**
|
|
21
35
|
* 定义媒体输入规则与平台媒体能力查询能力。
|
|
22
36
|
*/
|
|
23
37
|
interface MediaServicing {
|
|
24
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* 校验并保留原始尺寸;Web 插帧不降低回传分辨率。
|
|
40
|
+
*/
|
|
25
41
|
resolveFrameInterpolationSize(size: ModelSize): ModelSize;
|
|
42
|
+
/**
|
|
43
|
+
* 异步判断平台是否支持指定尺寸的插帧;不代表运行期性能保证。
|
|
44
|
+
*/
|
|
26
45
|
supportsFrameInterpolation(size: ModelSize): Promise<boolean>;
|
|
27
46
|
/**
|
|
28
47
|
* 按模型输入规则解析目标尺寸。
|
|
@@ -39,11 +58,20 @@ interface MediaServicing {
|
|
|
39
58
|
* 上传完成后返回的已存储文件信息。
|
|
40
59
|
*/
|
|
41
60
|
declare class StoredFile {
|
|
42
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* 存储结果
|
|
63
|
+
*/
|
|
64
|
+
/**
|
|
65
|
+
* 文件的访问地址。
|
|
66
|
+
*/
|
|
43
67
|
readonly url: string;
|
|
44
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* 对象存储中的对象键。
|
|
70
|
+
*/
|
|
45
71
|
readonly objectKey: string;
|
|
46
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* 对象存储返回的 ETag;未返回时为空。
|
|
74
|
+
*/
|
|
47
75
|
readonly etag?: string;
|
|
48
76
|
/**
|
|
49
77
|
* 创建已存储文件信息。
|
|
@@ -59,15 +87,25 @@ declare class StoredFile {
|
|
|
59
87
|
});
|
|
60
88
|
}
|
|
61
89
|
|
|
62
|
-
/**
|
|
90
|
+
/**
|
|
91
|
+
* 上传图片的参数。
|
|
92
|
+
*/
|
|
63
93
|
interface StorageUploadOptions {
|
|
64
|
-
/**
|
|
94
|
+
/**
|
|
95
|
+
* 图片数据。
|
|
96
|
+
*/
|
|
65
97
|
data: Blob | ArrayBuffer | Uint8Array;
|
|
66
|
-
/**
|
|
98
|
+
/**
|
|
99
|
+
* 文件名;用于对象键后缀和缺省内容类型推断。
|
|
100
|
+
*/
|
|
67
101
|
fileName: string;
|
|
68
|
-
/**
|
|
102
|
+
/**
|
|
103
|
+
* 图片 MIME 类型;缺省按文件名后缀推断。
|
|
104
|
+
*/
|
|
69
105
|
contentType?: string;
|
|
70
|
-
/**
|
|
106
|
+
/**
|
|
107
|
+
* 上传进度回调(已传字节数、总字节数)。
|
|
108
|
+
*/
|
|
71
109
|
onProgress?: (transferred: number, total: number) => void;
|
|
72
110
|
}
|
|
73
111
|
/**
|
|
@@ -86,70 +124,121 @@ interface StorageServicing {
|
|
|
86
124
|
uploadImage(options: StorageUploadOptions): Promise<StoredFile>;
|
|
87
125
|
}
|
|
88
126
|
|
|
127
|
+
/**
|
|
128
|
+
* 远端视频插帧的开关与显示帧率配置。
|
|
129
|
+
*/
|
|
89
130
|
interface FrameInterpolationConfiguration {
|
|
90
|
-
/**
|
|
131
|
+
/**
|
|
132
|
+
* 是否请求开启远端插帧,默认 false。不支持时自动播放原视频。
|
|
133
|
+
*/
|
|
91
134
|
enabled?: boolean;
|
|
92
|
-
/**
|
|
135
|
+
/**
|
|
136
|
+
* 显示帧率上限,默认 60;每对源帧最多插入一帧。取值 1–60。
|
|
137
|
+
*/
|
|
93
138
|
targetFrameRate?: number;
|
|
94
139
|
}
|
|
95
140
|
interface RealtimeConfigurationInit {
|
|
96
|
-
/**
|
|
141
|
+
/**
|
|
142
|
+
* 实时生成业务使用的模型。
|
|
143
|
+
*/
|
|
97
144
|
model: RealtimeModel;
|
|
98
145
|
/**
|
|
99
|
-
*
|
|
146
|
+
* 是否默认开启远端生成画面的插帧,默认 false。
|
|
100
147
|
* frameInterpolation.enabled 显式设置时优先。
|
|
101
148
|
*/
|
|
102
149
|
isFrameInterpolationEnabled?: boolean;
|
|
150
|
+
/**
|
|
151
|
+
* 插帧详细配置;enabled 显式设置时优先于简化开关。
|
|
152
|
+
*/
|
|
103
153
|
frameInterpolation?: FrameInterpolationConfiguration;
|
|
104
154
|
}
|
|
105
155
|
/**
|
|
106
156
|
* 创建实时 Manager 所需的业务配置。
|
|
107
157
|
*/
|
|
108
158
|
declare class RealtimeConfiguration {
|
|
109
|
-
/**
|
|
159
|
+
/**
|
|
160
|
+
* 模型配置
|
|
161
|
+
*/
|
|
162
|
+
/**
|
|
163
|
+
* 实时生成业务使用的模型。
|
|
164
|
+
*/
|
|
110
165
|
readonly model: RealtimeModel;
|
|
111
|
-
/**
|
|
166
|
+
/**
|
|
167
|
+
* 远端插帧配置
|
|
168
|
+
*/
|
|
169
|
+
/**
|
|
170
|
+
* 是否默认请求开启远端生成画面的插帧。
|
|
171
|
+
*/
|
|
112
172
|
readonly isFrameInterpolationEnabled: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* 已补全默认值的只读插帧配置。
|
|
175
|
+
*/
|
|
113
176
|
readonly frameInterpolation: Readonly<Required<FrameInterpolationConfiguration>>;
|
|
114
177
|
/**
|
|
115
178
|
* 创建实时业务配置。
|
|
116
179
|
*
|
|
117
180
|
* @param init.model 实时生成业务使用的模型。
|
|
118
181
|
* @param init.isFrameInterpolationEnabled 是否默认开启远端生成画面的插帧。
|
|
182
|
+
* @param init.frameInterpolation 插帧开关和显示帧率上限的详细配置。
|
|
119
183
|
*/
|
|
120
184
|
constructor(init: RealtimeConfigurationInit);
|
|
121
185
|
}
|
|
122
186
|
|
|
123
|
-
/**
|
|
187
|
+
/**
|
|
188
|
+
* TRTC 网络质量等级:未知、极好、良好、一般、差、极差、断网。
|
|
189
|
+
*/
|
|
124
190
|
type NetworkQualityLevel = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
125
|
-
/**
|
|
191
|
+
/**
|
|
192
|
+
* 本端 RTC 连接的网络统计,不依赖远端生成流是否已经到达。
|
|
193
|
+
*/
|
|
126
194
|
interface NetworkStatistics {
|
|
127
195
|
readonly uplinkQuality?: NetworkQualityLevel;
|
|
128
|
-
/**
|
|
196
|
+
/**
|
|
197
|
+
* 所有下行连接的平均网络质量。
|
|
198
|
+
*/
|
|
129
199
|
readonly downlinkQuality?: NetworkQualityLevel;
|
|
130
|
-
/**
|
|
200
|
+
/**
|
|
201
|
+
* 上行连接到 TRTC 云端的往返延迟,单位 ms,不是单程延迟。
|
|
202
|
+
*/
|
|
131
203
|
readonly uplinkRttMs?: number;
|
|
132
|
-
/**
|
|
204
|
+
/**
|
|
205
|
+
* 所有下行连接到 TRTC 云端的平均往返延迟,单位 ms。
|
|
206
|
+
*/
|
|
133
207
|
readonly downlinkRttMs?: number;
|
|
134
208
|
}
|
|
135
|
-
/**
|
|
209
|
+
/**
|
|
210
|
+
* undefined 表示尚无采样或连接已清理。
|
|
211
|
+
*/
|
|
136
212
|
type NetworkStatisticsListener = (statistics: NetworkStatistics | undefined) => void;
|
|
137
213
|
|
|
138
214
|
interface RealtimeContextInit {
|
|
139
|
-
/**
|
|
215
|
+
/**
|
|
216
|
+
* 实时生成使用的文本条件。
|
|
217
|
+
*/
|
|
140
218
|
prompt: string;
|
|
141
|
-
/**
|
|
219
|
+
/**
|
|
220
|
+
* 已上传参考图片的可选远端路径。
|
|
221
|
+
*/
|
|
142
222
|
referencePath?: string;
|
|
143
223
|
}
|
|
144
224
|
/**
|
|
145
225
|
* 单次实时生成任务的文本和参考资源上下文。
|
|
146
226
|
*/
|
|
147
227
|
declare class RealtimeContext {
|
|
148
|
-
/**
|
|
228
|
+
/**
|
|
229
|
+
* 生成条件
|
|
230
|
+
*/
|
|
231
|
+
/**
|
|
232
|
+
* 实时生成使用的文本条件。
|
|
233
|
+
*/
|
|
149
234
|
readonly prompt: string;
|
|
150
|
-
/**
|
|
235
|
+
/**
|
|
236
|
+
* 已上传参考图片的可选远端路径。
|
|
237
|
+
*/
|
|
151
238
|
readonly referencePath?: string;
|
|
152
|
-
/**
|
|
239
|
+
/**
|
|
240
|
+
* 创建实时生成条件并规范化文本和参考路径。
|
|
241
|
+
*/
|
|
153
242
|
constructor(init: RealtimeContextInit);
|
|
154
243
|
}
|
|
155
244
|
|
|
@@ -157,9 +246,16 @@ declare class RealtimeContext {
|
|
|
157
246
|
* 实时生成输入/输出的媒体流。
|
|
158
247
|
*/
|
|
159
248
|
declare class RealtimeMediaStream {
|
|
160
|
-
/**
|
|
249
|
+
/**
|
|
250
|
+
* 流标识与轨道
|
|
251
|
+
*/
|
|
252
|
+
/**
|
|
253
|
+
* 媒体流标识。
|
|
254
|
+
*/
|
|
161
255
|
readonly id: string;
|
|
162
|
-
/**
|
|
256
|
+
/**
|
|
257
|
+
* 媒体流包含的视频轨道。
|
|
258
|
+
*/
|
|
163
259
|
readonly videoTrack?: RealtimeVideoTrack;
|
|
164
260
|
/**
|
|
165
261
|
* 创建实时媒体流。
|
|
@@ -177,52 +273,97 @@ declare class RealtimeMediaStream {
|
|
|
177
273
|
* SDK 向接入方暴露的统一错误码。
|
|
178
274
|
*/
|
|
179
275
|
declare enum XmaxErrorCode {
|
|
180
|
-
/**
|
|
276
|
+
/**
|
|
277
|
+
* API Key 未配置或为空。
|
|
278
|
+
*/
|
|
181
279
|
invalidAPIKey = "INVALID_API_KEY",
|
|
182
|
-
/**
|
|
280
|
+
/**
|
|
281
|
+
* 调用参数、配置或当前生命周期状态不符合操作要求。
|
|
282
|
+
*/
|
|
183
283
|
invalidConfiguration = "INVALID_CONFIGURATION",
|
|
184
|
-
/**
|
|
284
|
+
/**
|
|
285
|
+
* SDK 内部发生无法归类的非预期错误。
|
|
286
|
+
*/
|
|
185
287
|
internalError = "INTERNAL_ERROR",
|
|
186
|
-
/**
|
|
288
|
+
/**
|
|
289
|
+
* 网络不可用、连接失败或 HTTP 请求无法完成。
|
|
290
|
+
*/
|
|
187
291
|
networkError = "NETWORK_ERROR",
|
|
188
|
-
/**
|
|
292
|
+
/**
|
|
293
|
+
* Xmax API 返回业务失败,或者响应数据无法正确解析。
|
|
294
|
+
*/
|
|
189
295
|
apiError = "API_ERROR",
|
|
190
|
-
/**
|
|
296
|
+
/**
|
|
297
|
+
* 实时生成会话数据缺失、会话关闭或心跳状态异常。
|
|
298
|
+
*/
|
|
191
299
|
sessionError = "SESSION_ERROR",
|
|
192
|
-
/**
|
|
300
|
+
/**
|
|
301
|
+
* RTC Engine、房间、媒体传输或渲染绑定发生错误。
|
|
302
|
+
*/
|
|
193
303
|
rtcError = "RTC_ERROR",
|
|
194
|
-
/**
|
|
304
|
+
/**
|
|
305
|
+
* 本地媒体读取、解码、同步或帧处理发生错误。
|
|
306
|
+
*/
|
|
195
307
|
mediaError = "MEDIA_ERROR",
|
|
196
|
-
/**
|
|
308
|
+
/**
|
|
309
|
+
* 当前系统、设备或视频规格不支持远端视频插帧。
|
|
310
|
+
*/
|
|
197
311
|
frameInterpolationUnsupported = "FRAME_INTERPOLATION_UNSUPPORTED",
|
|
198
|
-
/**
|
|
312
|
+
/**
|
|
313
|
+
* 接入方未授予相机权限。
|
|
314
|
+
*/
|
|
199
315
|
cameraPermissionDenied = "CAMERA_PERMISSION_DENIED",
|
|
200
|
-
/**
|
|
316
|
+
/**
|
|
317
|
+
* @deprecated 为兼容保留;相机亮度检查超时现仅记录警告并继续流程,不再抛出此错误。
|
|
318
|
+
*/
|
|
201
319
|
cameraExposureTimeout = "CAMERA_EXPOSURE_TIMEOUT",
|
|
202
|
-
/**
|
|
320
|
+
/**
|
|
321
|
+
* 接入方未授予麦克风权限。
|
|
322
|
+
*/
|
|
203
323
|
microphonePermissionDenied = "MICROPHONE_PERMISSION_DENIED",
|
|
204
|
-
/**
|
|
324
|
+
/**
|
|
325
|
+
* 文件或二进制数据上传失败。
|
|
326
|
+
*/
|
|
205
327
|
uploadError = "UPLOAD_ERROR",
|
|
206
|
-
/**
|
|
328
|
+
/**
|
|
329
|
+
* 远端文件下载失败。
|
|
330
|
+
*/
|
|
207
331
|
downloadError = "DOWNLOAD_ERROR",
|
|
208
|
-
/**
|
|
332
|
+
/**
|
|
333
|
+
* 图片未通过内容安全检查。
|
|
334
|
+
*/
|
|
209
335
|
unsafeImage = "UNSAFE_IMAGE",
|
|
210
|
-
/**
|
|
336
|
+
/**
|
|
337
|
+
* 操作因生命周期切换或接入方主动终止而正常取消。
|
|
338
|
+
*/
|
|
211
339
|
cancelled = "CANCELLED",
|
|
212
|
-
/**
|
|
340
|
+
/**
|
|
341
|
+
* 等待连接、房间事件或生成结果超过规定时间。
|
|
342
|
+
*/
|
|
213
343
|
timeout = "TIMEOUT"
|
|
214
344
|
}
|
|
215
|
-
/**
|
|
345
|
+
/**
|
|
346
|
+
* SDK 内部组件上报统一错误时使用的监听器。
|
|
347
|
+
*/
|
|
216
348
|
type XmaxErrorListener = (error: XmaxError) => void;
|
|
217
349
|
/**
|
|
218
350
|
* 表示 SDK 抛出或回调给接入方的统一错误。
|
|
219
351
|
*/
|
|
220
352
|
declare class XmaxError extends Error {
|
|
221
|
-
/**
|
|
353
|
+
/**
|
|
354
|
+
* 错误信息
|
|
355
|
+
*/
|
|
356
|
+
/**
|
|
357
|
+
* SDK 统一错误码。
|
|
358
|
+
*/
|
|
222
359
|
readonly code: XmaxErrorCode;
|
|
223
|
-
/**
|
|
360
|
+
/**
|
|
361
|
+
* Xmax API 返回的业务错误码;非 API 业务错误时为空。
|
|
362
|
+
*/
|
|
224
363
|
readonly apiCode?: number;
|
|
225
|
-
/**
|
|
364
|
+
/**
|
|
365
|
+
* HTTP 响应状态码;请求未获得响应时为空。
|
|
366
|
+
*/
|
|
226
367
|
readonly httpStatus?: number;
|
|
227
368
|
/**
|
|
228
369
|
* 创建 SDK 错误。
|
|
@@ -248,19 +389,33 @@ declare class XmaxError extends Error {
|
|
|
248
389
|
* 实时业务连接状态。
|
|
249
390
|
*/
|
|
250
391
|
declare enum RealtimeConnectionState {
|
|
251
|
-
/**
|
|
392
|
+
/**
|
|
393
|
+
* 没有可用的本地媒体流。
|
|
394
|
+
*/
|
|
252
395
|
idle = "Idle",
|
|
253
|
-
/**
|
|
396
|
+
/**
|
|
397
|
+
* 正在准备本地媒体流;摄像头还需等待有效帧和预览视图绑定。
|
|
398
|
+
*/
|
|
254
399
|
preparing = "Preparing",
|
|
255
|
-
/**
|
|
400
|
+
/**
|
|
401
|
+
* 本地媒体流已就绪,可以预览、连接和生成。
|
|
402
|
+
*/
|
|
256
403
|
ready = "Ready",
|
|
257
|
-
/**
|
|
404
|
+
/**
|
|
405
|
+
* 正在创建 Session、加入 Room 并发布本地流。
|
|
406
|
+
*/
|
|
258
407
|
connecting = "Connecting",
|
|
259
|
-
/**
|
|
408
|
+
/**
|
|
409
|
+
* 实时连接已建立,当前没有生成任务。
|
|
410
|
+
*/
|
|
260
411
|
connected = "Connected",
|
|
261
|
-
/**
|
|
412
|
+
/**
|
|
413
|
+
* 实时连接已建立且生成任务正在运行。
|
|
414
|
+
*/
|
|
262
415
|
generating = "Generating",
|
|
263
|
-
/**
|
|
416
|
+
/**
|
|
417
|
+
* 正在清理生成、Room 和 Session 资源。
|
|
418
|
+
*/
|
|
264
419
|
disconnecting = "Disconnecting"
|
|
265
420
|
}
|
|
266
421
|
/**
|
|
@@ -277,6 +432,9 @@ type RealtimeReason = {
|
|
|
277
432
|
declare const RealtimeReason: {
|
|
278
433
|
normal: RealtimeReason;
|
|
279
434
|
orientationChanged: RealtimeReason;
|
|
435
|
+
/**
|
|
436
|
+
* 将 SDK 错误包装为状态切换原因,保留错误码和原始说明。
|
|
437
|
+
*/
|
|
280
438
|
failure(error: XmaxError): RealtimeReason;
|
|
281
439
|
};
|
|
282
440
|
interface RealtimeStateInit {
|
|
@@ -289,13 +447,30 @@ interface RealtimeStateInit {
|
|
|
289
447
|
* 实时业务当前状态快照。
|
|
290
448
|
*/
|
|
291
449
|
declare class RealtimeState {
|
|
292
|
-
/**
|
|
450
|
+
/**
|
|
451
|
+
* 连接生命周期
|
|
452
|
+
*/
|
|
453
|
+
/**
|
|
454
|
+
* 当前连接生命周期状态。
|
|
455
|
+
*/
|
|
293
456
|
readonly connectionState: RealtimeConnectionState;
|
|
294
|
-
/**
|
|
457
|
+
/**
|
|
458
|
+
* 业务标识
|
|
459
|
+
*/
|
|
460
|
+
/**
|
|
461
|
+
* 当前或最近一次实时 Session 标识。
|
|
462
|
+
*/
|
|
295
463
|
readonly sessionID?: string;
|
|
296
|
-
/**
|
|
464
|
+
/**
|
|
465
|
+
* 当前生成任务标识。
|
|
466
|
+
*/
|
|
297
467
|
readonly taskID?: string;
|
|
298
|
-
/**
|
|
468
|
+
/**
|
|
469
|
+
* 状态变化原因
|
|
470
|
+
*/
|
|
471
|
+
/**
|
|
472
|
+
* 进入当前状态的原因;正常开始新的操作时清空。
|
|
473
|
+
*/
|
|
299
474
|
readonly reason?: RealtimeReason;
|
|
300
475
|
/**
|
|
301
476
|
* 创建实时状态快照。
|
|
@@ -313,70 +488,120 @@ declare class RealtimeState {
|
|
|
313
488
|
*/
|
|
314
489
|
equals(other: RealtimeState): boolean;
|
|
315
490
|
}
|
|
316
|
-
/**
|
|
491
|
+
/**
|
|
492
|
+
* 实时状态监听器。
|
|
493
|
+
*/
|
|
317
494
|
type RealtimeStateListener = (state: RealtimeState) => void;
|
|
318
495
|
|
|
319
496
|
/**
|
|
320
|
-
* 一次相机启动的耗时快照,单位为毫秒;undefined
|
|
497
|
+
* 一次相机启动的耗时快照,单位为毫秒;undefined 表示该阶段尚未完成或未启用。
|
|
321
498
|
* 新一轮打开摄像头时重置;失败、关闭或断开后保留已完成的值。
|
|
322
499
|
* 仅预览时不产生首帧和总耗时;预览后手动启动生成的等待计入总耗时。
|
|
323
500
|
*/
|
|
324
501
|
interface RealtimeLaunchTiming {
|
|
325
|
-
/**
|
|
502
|
+
/**
|
|
503
|
+
* 开始打开摄像头到相机流创建完成(包含权限等待)。
|
|
504
|
+
*/
|
|
326
505
|
readonly cameraMs?: number;
|
|
327
|
-
/**
|
|
506
|
+
/**
|
|
507
|
+
* 开始创建会话到 RTC 进房配置完成;不含等待亮度检测及发布本地流。
|
|
508
|
+
*/
|
|
328
509
|
readonly connectionMs?: number;
|
|
329
|
-
/**
|
|
510
|
+
/**
|
|
511
|
+
* 相机亮度检测开始到首张合格帧或超时放行;与建立连接并行,不可直接相加。禁用检测时为 undefined。
|
|
512
|
+
*/
|
|
513
|
+
readonly frameValidationMs?: number;
|
|
514
|
+
/**
|
|
515
|
+
* 开始发送生成信令到 SDK 远端视图首次呈现视频帧。
|
|
516
|
+
*/
|
|
330
517
|
readonly firstFrameMs?: number;
|
|
331
|
-
/**
|
|
518
|
+
/**
|
|
519
|
+
* 开始打开摄像头到 SDK 远端视图首次呈现视频帧的实际总耗时,并非各项之和。
|
|
520
|
+
*/
|
|
332
521
|
readonly totalMs?: number;
|
|
333
522
|
}
|
|
334
|
-
/**
|
|
523
|
+
/**
|
|
524
|
+
* 阶段完成时提供完整快照;不支持帧回调的浏览器以 playing 近似首帧。
|
|
525
|
+
*/
|
|
335
526
|
type RealtimeLaunchTimingListener = (timing: RealtimeLaunchTiming) => void;
|
|
336
527
|
|
|
337
|
-
/**
|
|
528
|
+
/**
|
|
529
|
+
* 视频流实际运行统计;缺失或无效指标为 undefined。
|
|
530
|
+
*/
|
|
338
531
|
interface VideoStatistics {
|
|
339
532
|
readonly width?: number;
|
|
340
533
|
readonly height?: number;
|
|
341
|
-
/**
|
|
534
|
+
/**
|
|
535
|
+
* 实际帧率,单位 fps。
|
|
536
|
+
*/
|
|
342
537
|
readonly frameRate?: number;
|
|
343
|
-
/**
|
|
538
|
+
/**
|
|
539
|
+
* 实际码率,单位 kbps。
|
|
540
|
+
*/
|
|
344
541
|
readonly bitrateKbps?: number;
|
|
345
542
|
}
|
|
346
|
-
/**
|
|
543
|
+
/**
|
|
544
|
+
* undefined 表示当前没有可用统计(尚未发布、断开或停止)。
|
|
545
|
+
*/
|
|
347
546
|
type VideoStatisticsListener = (statistics: VideoStatistics | undefined) => void;
|
|
348
|
-
/**
|
|
547
|
+
/**
|
|
548
|
+
* 一路远端主视频流的接收统计。
|
|
549
|
+
*/
|
|
349
550
|
interface RemoteVideoStatistics extends VideoStatistics {
|
|
350
551
|
readonly userID: string;
|
|
351
|
-
/**
|
|
552
|
+
/**
|
|
553
|
+
* 本端 SDK 到 TRTC 云端的往返延迟,单位 ms;不是与远端用户之间的 RTT。
|
|
554
|
+
*/
|
|
352
555
|
readonly rttMs?: number;
|
|
353
|
-
/**
|
|
556
|
+
/**
|
|
557
|
+
* 本端 SDK 到 TRTC 云端的上行丢包率,单位 %,不是结果流的发送端丢包率。
|
|
558
|
+
*/
|
|
354
559
|
readonly uplinkLossPercent?: number;
|
|
355
|
-
/**
|
|
560
|
+
/**
|
|
561
|
+
* TRTC 云端到本端 SDK 的下行丢包率,单位 %。
|
|
562
|
+
*/
|
|
356
563
|
readonly downlinkLossPercent?: number;
|
|
357
|
-
/**
|
|
564
|
+
/**
|
|
565
|
+
* 当前远端视频流的播放缓冲延迟,单位 ms。
|
|
566
|
+
*/
|
|
358
567
|
readonly jitterBufferDelayMs?: number;
|
|
359
|
-
/**
|
|
568
|
+
/**
|
|
569
|
+
* TRTC 媒体端到端延迟估算值,单位 ms;不代表完整 AI 处理链路耗时。
|
|
570
|
+
*/
|
|
360
571
|
readonly endToEndDelayMs?: number;
|
|
361
572
|
}
|
|
362
|
-
/**
|
|
573
|
+
/**
|
|
574
|
+
* undefined 表示当前结果流没有统计或已被清理。
|
|
575
|
+
*/
|
|
363
576
|
type RemoteVideoStatisticsListener = (statistics: RemoteVideoStatistics | undefined) => void;
|
|
364
577
|
|
|
365
578
|
/**
|
|
366
579
|
* 定义 SDK 对接入方提供的实时媒体与生成控制能力。
|
|
367
580
|
*/
|
|
368
581
|
interface XmaxRealtimeManaging {
|
|
369
|
-
/**
|
|
582
|
+
/**
|
|
583
|
+
* 实时能力配置。
|
|
584
|
+
*/
|
|
370
585
|
readonly options: RealtimeConfiguration;
|
|
371
|
-
/**
|
|
586
|
+
/**
|
|
587
|
+
* 当前实时连接与生成状态。
|
|
588
|
+
*/
|
|
372
589
|
readonly currentState: RealtimeState;
|
|
373
|
-
/**
|
|
590
|
+
/**
|
|
591
|
+
* 插帧功能开关;不随首帧等待、跳帧或视图挂载变化,不支持或故障降级时关闭。
|
|
592
|
+
*/
|
|
374
593
|
readonly isFrameInterpolationEnabled: boolean;
|
|
375
|
-
/**
|
|
594
|
+
/**
|
|
595
|
+
* 切换客户端插帧,不改变回传分辨率或重启任务。不支持时抛错且保留配置。
|
|
596
|
+
*/
|
|
376
597
|
setFrameInterpolationEnabled(enabled: boolean): Promise<void>;
|
|
377
|
-
/**
|
|
598
|
+
/**
|
|
599
|
+
* 当前本地媒体预览音量,取值范围为 `0...1`。
|
|
600
|
+
*/
|
|
378
601
|
readonly localAudioVolume: number;
|
|
379
|
-
/**
|
|
602
|
+
/**
|
|
603
|
+
* 当前远端生成音频播放音量,取值范围为 `0...1`。
|
|
604
|
+
*/
|
|
380
605
|
readonly remoteAudioVolume: number;
|
|
381
606
|
/**
|
|
382
607
|
* 设置实时状态监听器。
|
|
@@ -430,8 +655,14 @@ interface XmaxRealtimeManaging {
|
|
|
430
655
|
videoFormat: RealtimeVideoFormat;
|
|
431
656
|
position: CameraPosition;
|
|
432
657
|
useMicrophone: boolean;
|
|
658
|
+
/**
|
|
659
|
+
* 是否在发布前检测相机帧亮度,默认 true;false 跳过检测及其等待,不产生检测耗时。
|
|
660
|
+
*/
|
|
661
|
+
enableFrameValidation?: boolean;
|
|
433
662
|
}): Promise<RealtimeMediaStream>;
|
|
434
|
-
/**
|
|
663
|
+
/**
|
|
664
|
+
* 停止本地相机流并释放本地预览与 RTC 资源。
|
|
665
|
+
*/
|
|
435
666
|
stopLocalCameraStream(): Promise<void>;
|
|
436
667
|
/**
|
|
437
668
|
* 切换前后置摄像头。
|
|
@@ -446,8 +677,8 @@ interface XmaxRealtimeManaging {
|
|
|
446
677
|
* 使用当前 Manager 创建的本地流建立实时连接。
|
|
447
678
|
*
|
|
448
679
|
* 创建实时会话、加入 RTC 房间并发布本地流,成功后启动会话心跳。
|
|
449
|
-
*
|
|
450
|
-
*
|
|
680
|
+
* 启用帧检测时,发布前并行检查相机亮度,首张合格帧即放行;2 秒内未通过检查则
|
|
681
|
+
* 记录警告并按当前画面继续发布,不因环境较暗而阻断连接。
|
|
451
682
|
* 返回的远端媒体流在生成开始后承载远端生成画面。
|
|
452
683
|
*
|
|
453
684
|
* @param localStream 由 `createLocalCameraStream` 创建的本地媒体流。
|
|
@@ -456,7 +687,9 @@ interface XmaxRealtimeManaging {
|
|
|
456
687
|
* 发布失败时抛出错误;失败时自动释放连接资源并恢复本地预览。
|
|
457
688
|
*/
|
|
458
689
|
connect(localStream: RealtimeMediaStream): Promise<RealtimeMediaStream>;
|
|
459
|
-
/**
|
|
690
|
+
/**
|
|
691
|
+
* 断开实时连接并保留当前本地媒体预览。
|
|
692
|
+
*/
|
|
460
693
|
disconnect(): Promise<void>;
|
|
461
694
|
/**
|
|
462
695
|
* 关闭当前实时生命周期并释放连接、本地媒体和 RTC Engine。
|
|
@@ -485,12 +718,18 @@ interface XmaxRealtimeManaging {
|
|
|
485
718
|
* Xmax 服务环境。
|
|
486
719
|
*/
|
|
487
720
|
declare enum XmaxEnvironment {
|
|
488
|
-
/**
|
|
721
|
+
/**
|
|
722
|
+
* 国内环境。
|
|
723
|
+
*/
|
|
489
724
|
china = "china",
|
|
490
|
-
/**
|
|
725
|
+
/**
|
|
726
|
+
* 海外环境。
|
|
727
|
+
*/
|
|
491
728
|
global = "global"
|
|
492
729
|
}
|
|
493
|
-
/**
|
|
730
|
+
/**
|
|
731
|
+
* 环境对应的 Xmax API Base URL。
|
|
732
|
+
*/
|
|
494
733
|
declare function apiBaseURL(environment: XmaxEnvironment): string;
|
|
495
734
|
|
|
496
735
|
/**
|
|
@@ -498,11 +737,17 @@ declare function apiBaseURL(environment: XmaxEnvironment): string;
|
|
|
498
737
|
*/
|
|
499
738
|
declare enum XmaxLoggerOption {
|
|
500
739
|
none = 0,
|
|
501
|
-
/**
|
|
740
|
+
/**
|
|
741
|
+
* Room、API、Realtime、Storage 等业务运行日志。
|
|
742
|
+
*/
|
|
502
743
|
business = 1,
|
|
503
|
-
/**
|
|
744
|
+
/**
|
|
745
|
+
* RTC 网络质量和音视频运行统计,输出到 console.info。
|
|
746
|
+
*/
|
|
504
747
|
performance = 2,
|
|
505
|
-
/**
|
|
748
|
+
/**
|
|
749
|
+
* 输出全部 XmaxSDK 日志。
|
|
750
|
+
*/
|
|
506
751
|
all = 3
|
|
507
752
|
}
|
|
508
753
|
/**
|
|
@@ -511,6 +756,9 @@ declare enum XmaxLoggerOption {
|
|
|
511
756
|
* 调用方不得传入 API Key、Token、Secret、Authorization 或完整敏感响应。
|
|
512
757
|
*/
|
|
513
758
|
declare class XmaxLogger {
|
|
759
|
+
/**
|
|
760
|
+
* 分类日志
|
|
761
|
+
*/
|
|
514
762
|
static readonly realtime: XmaxLogger;
|
|
515
763
|
static readonly rtc: XmaxLogger;
|
|
516
764
|
static readonly media: XmaxLogger;
|
|
@@ -521,7 +769,13 @@ declare class XmaxLogger {
|
|
|
521
769
|
static readonly render: XmaxLogger;
|
|
522
770
|
static readonly interaction: XmaxLogger;
|
|
523
771
|
static readonly permission: XmaxLogger;
|
|
772
|
+
/**
|
|
773
|
+
* 日志类别
|
|
774
|
+
*/
|
|
524
775
|
private readonly category;
|
|
776
|
+
/**
|
|
777
|
+
* 创建固定业务分类的日志入口,共享全局日志选项和语言配置。
|
|
778
|
+
*/
|
|
525
779
|
private constructor();
|
|
526
780
|
/**
|
|
527
781
|
* 更新 SDK 全局日志选项和细项语言,后一次配置覆盖前一次。
|
|
@@ -530,39 +784,71 @@ declare class XmaxLogger {
|
|
|
530
784
|
* @param environment 服务环境,决定日志细项语言(国内中文,海外英文)。
|
|
531
785
|
*/
|
|
532
786
|
static configure(options: XmaxLoggerOption, environment?: XmaxEnvironment): void;
|
|
533
|
-
/**
|
|
787
|
+
/**
|
|
788
|
+
* 选择日志细项文案;日志标题保持原有中英双语。
|
|
789
|
+
*/
|
|
534
790
|
static localized(chinese: string, english: string): string;
|
|
535
|
-
/**
|
|
791
|
+
/**
|
|
792
|
+
* 判断指定日志类型是否已开启。
|
|
793
|
+
*/
|
|
536
794
|
static isEnabled(option: XmaxLoggerOption): boolean;
|
|
537
|
-
/**
|
|
795
|
+
/**
|
|
796
|
+
* 输出调试日志。
|
|
797
|
+
*/
|
|
538
798
|
debug(message: () => string, option?: XmaxLoggerOption): void;
|
|
539
|
-
/**
|
|
799
|
+
/**
|
|
800
|
+
* 输出信息日志。
|
|
801
|
+
*/
|
|
540
802
|
info(message: () => string, option?: XmaxLoggerOption): void;
|
|
541
|
-
/**
|
|
803
|
+
/**
|
|
804
|
+
* 输出警告日志。
|
|
805
|
+
*/
|
|
542
806
|
warning(message: () => string, option?: XmaxLoggerOption): void;
|
|
543
|
-
/**
|
|
807
|
+
/**
|
|
808
|
+
* 输出错误日志。
|
|
809
|
+
*/
|
|
544
810
|
error(message: () => string, option?: XmaxLoggerOption): void;
|
|
545
|
-
/**
|
|
811
|
+
/**
|
|
812
|
+
* 按日志类型开关输出到控制台;未开启时不求值日志内容。
|
|
813
|
+
*/
|
|
546
814
|
private log;
|
|
547
815
|
}
|
|
548
816
|
|
|
549
817
|
interface XmaxConfigurationInit {
|
|
550
|
-
/**
|
|
818
|
+
/**
|
|
819
|
+
* 调用 Xmax 服务使用的 API Key。
|
|
820
|
+
*/
|
|
551
821
|
apiKey: string;
|
|
552
|
-
/**
|
|
822
|
+
/**
|
|
823
|
+
* SDK 连接的服务环境;默认为国内环境。
|
|
824
|
+
*/
|
|
553
825
|
environment?: XmaxEnvironment;
|
|
554
|
-
/**
|
|
826
|
+
/**
|
|
827
|
+
* SDK 输出的日志类型;默认为不输出日志。
|
|
828
|
+
*/
|
|
555
829
|
loggerOptions?: XmaxLoggerOption;
|
|
556
830
|
}
|
|
557
831
|
/**
|
|
558
832
|
* SDK 全局配置。
|
|
559
833
|
*/
|
|
560
834
|
declare class XmaxConfiguration {
|
|
561
|
-
/**
|
|
835
|
+
/**
|
|
836
|
+
* 服务身份与环境
|
|
837
|
+
*/
|
|
838
|
+
/**
|
|
839
|
+
* 调用 Xmax 服务使用的 API Key。
|
|
840
|
+
*/
|
|
562
841
|
readonly apiKey: string;
|
|
563
|
-
/**
|
|
842
|
+
/**
|
|
843
|
+
* SDK 连接的服务环境,同时决定日志细项语言:国内为中文,海外为英文。
|
|
844
|
+
*/
|
|
564
845
|
readonly environment: XmaxEnvironment;
|
|
565
|
-
/**
|
|
846
|
+
/**
|
|
847
|
+
* 日志配置
|
|
848
|
+
*/
|
|
849
|
+
/**
|
|
850
|
+
* SDK 输出的日志类型;默认为不输出日志。
|
|
851
|
+
*/
|
|
566
852
|
readonly loggerOptions: XmaxLoggerOption;
|
|
567
853
|
/**
|
|
568
854
|
* 创建 SDK 全局配置。
|
|
@@ -583,8 +869,16 @@ declare class XmaxConfiguration {
|
|
|
583
869
|
* SDK 的统一入口,负责创建实时和媒体服务组件。
|
|
584
870
|
*/
|
|
585
871
|
declare class XmaxClient {
|
|
586
|
-
/**
|
|
872
|
+
/**
|
|
873
|
+
* 客户端配置
|
|
874
|
+
*/
|
|
875
|
+
/**
|
|
876
|
+
* 客户端使用的全局配置。
|
|
877
|
+
*/
|
|
587
878
|
readonly configuration: XmaxConfiguration;
|
|
879
|
+
/**
|
|
880
|
+
* 服务层组件
|
|
881
|
+
*/
|
|
588
882
|
private readonly apiService;
|
|
589
883
|
/**
|
|
590
884
|
* 创建 SDK 客户端。
|
|
@@ -619,6 +913,9 @@ declare class XmaxClient {
|
|
|
619
913
|
* 模型输入尺寸与远端插帧能力。
|
|
620
914
|
*/
|
|
621
915
|
declare class MediaService implements MediaServicing {
|
|
916
|
+
/**
|
|
917
|
+
* 模型约束
|
|
918
|
+
*/
|
|
622
919
|
readonly model: RealtimeModel;
|
|
623
920
|
/**
|
|
624
921
|
* 创建媒体服务。
|
|
@@ -626,14 +923,25 @@ declare class MediaService implements MediaServicing {
|
|
|
626
923
|
* @param model 媒体输入规则使用的模型,默认为 `x2-fast-1080p`。
|
|
627
924
|
*/
|
|
628
925
|
constructor(model?: RealtimeModel);
|
|
629
|
-
/**
|
|
926
|
+
/**
|
|
927
|
+
* Web 插帧保留原始尺寸;/16 对齐由 GPU 内部补边处理,不缩小回传视频。
|
|
928
|
+
*/
|
|
630
929
|
resolveFrameInterpolationSize(size: ModelSize): ModelSize;
|
|
631
|
-
/**
|
|
930
|
+
/**
|
|
931
|
+
* WebGPU 适配器探测是异步的;实际性能和运行状态由渲染管线判断。
|
|
932
|
+
*/
|
|
632
933
|
supportsFrameInterpolation(size: ModelSize): Promise<boolean>;
|
|
934
|
+
/**
|
|
935
|
+
* 按模型分辨率档位或像素预算解析输入尺寸,保持宽高比例并对齐;不支持的规格抛错。
|
|
936
|
+
*/
|
|
633
937
|
resolveModelInputSize(size: ModelSize): ModelSize;
|
|
634
|
-
/**
|
|
938
|
+
/**
|
|
939
|
+
* 在对齐网格上选择满足面积限制且最接近目标的尺寸。
|
|
940
|
+
*/
|
|
635
941
|
private boundedAlignedSize;
|
|
636
|
-
/**
|
|
942
|
+
/**
|
|
943
|
+
* 校验尺寸为有限正数,并归一化为不小于 1 的整数。
|
|
944
|
+
*/
|
|
637
945
|
private validatedSize;
|
|
638
946
|
}
|
|
639
947
|
|
|
@@ -663,17 +971,27 @@ interface ApiServicing {
|
|
|
663
971
|
* @throws 配置无效、网络失败、业务失败或响应无法解析时抛出错误。
|
|
664
972
|
*/
|
|
665
973
|
request<T>(method: ApiMethod, path: string, body?: unknown): Promise<T>;
|
|
666
|
-
/**
|
|
974
|
+
/**
|
|
975
|
+
* 发送 GET 请求。
|
|
976
|
+
*/
|
|
667
977
|
get<T>(path: string): Promise<T>;
|
|
668
|
-
/**
|
|
978
|
+
/**
|
|
979
|
+
* 发送 POST 请求。
|
|
980
|
+
*/
|
|
669
981
|
post<T>(path: string, body?: unknown): Promise<T>;
|
|
670
|
-
/**
|
|
982
|
+
/**
|
|
983
|
+
* 发送 PUT 请求。
|
|
984
|
+
*/
|
|
671
985
|
put<T>(path: string, body?: unknown): Promise<T>;
|
|
672
|
-
/**
|
|
986
|
+
/**
|
|
987
|
+
* 发送 DELETE 请求。
|
|
988
|
+
*/
|
|
673
989
|
delete<T>(path: string): Promise<T>;
|
|
674
990
|
}
|
|
675
991
|
|
|
676
|
-
/**
|
|
992
|
+
/**
|
|
993
|
+
* 解析后的临时存储配置。
|
|
994
|
+
*/
|
|
677
995
|
interface TemporaryStorageConfiguration {
|
|
678
996
|
bucket: string;
|
|
679
997
|
region: string;
|
|
@@ -685,8 +1003,13 @@ interface TemporaryStorageConfiguration {
|
|
|
685
1003
|
sessionToken: string;
|
|
686
1004
|
};
|
|
687
1005
|
}
|
|
688
|
-
/**
|
|
1006
|
+
/**
|
|
1007
|
+
* 对象存储直传客户端需要的最小接口。
|
|
1008
|
+
*/
|
|
689
1009
|
interface StorageObjectClient {
|
|
1010
|
+
/**
|
|
1011
|
+
* 将文件直传到指定桶和对象键,通过回调报告错误或访问地址,并可上报上传进度。
|
|
1012
|
+
*/
|
|
690
1013
|
putObject(params: {
|
|
691
1014
|
Bucket: string;
|
|
692
1015
|
Region: string;
|
|
@@ -704,16 +1027,26 @@ interface StorageObjectClient {
|
|
|
704
1027
|
ETag?: string;
|
|
705
1028
|
}) => void): void;
|
|
706
1029
|
}
|
|
707
|
-
/**
|
|
1030
|
+
/**
|
|
1031
|
+
* 对象存储客户端工厂;生产实现按临时凭证创建 COS 客户端。
|
|
1032
|
+
*/
|
|
708
1033
|
type StorageObjectClientFactory = (configuration: TemporaryStorageConfiguration) => Promise<StorageObjectClient>;
|
|
709
1034
|
interface StorageServiceOptions {
|
|
710
|
-
/**
|
|
1035
|
+
/**
|
|
1036
|
+
* Xmax API 请求组件。
|
|
1037
|
+
*/
|
|
711
1038
|
apiService: ApiServicing;
|
|
712
|
-
/**
|
|
1039
|
+
/**
|
|
1040
|
+
* 对象存储客户端工厂(可替换,测试用)。
|
|
1041
|
+
*/
|
|
713
1042
|
clientFactory?: StorageObjectClientFactory;
|
|
714
|
-
/**
|
|
1043
|
+
/**
|
|
1044
|
+
* 时间来源(可替换,测试用)。
|
|
1045
|
+
*/
|
|
715
1046
|
dateGenerator?: () => Date;
|
|
716
|
-
/**
|
|
1047
|
+
/**
|
|
1048
|
+
* 标识来源(可替换,测试用)。
|
|
1049
|
+
*/
|
|
717
1050
|
identifierGenerator?: () => string;
|
|
718
1051
|
}
|
|
719
1052
|
/**
|
|
@@ -724,8 +1057,17 @@ interface StorageServiceOptions {
|
|
|
724
1057
|
* endpoint 或默认 COS 域名依次解析。
|
|
725
1058
|
*/
|
|
726
1059
|
declare class StorageService implements StorageServicing {
|
|
1060
|
+
/**
|
|
1061
|
+
* 服务层组件
|
|
1062
|
+
*/
|
|
727
1063
|
private readonly apiService;
|
|
1064
|
+
/**
|
|
1065
|
+
* 平台资源
|
|
1066
|
+
*/
|
|
728
1067
|
private readonly clientFactory;
|
|
1068
|
+
/**
|
|
1069
|
+
* 标识生成
|
|
1070
|
+
*/
|
|
729
1071
|
private readonly dateGenerator;
|
|
730
1072
|
private readonly identifierGenerator;
|
|
731
1073
|
/**
|
|
@@ -737,30 +1079,50 @@ declare class StorageService implements StorageServicing {
|
|
|
737
1079
|
* @param options.identifierGenerator 标识来源(可替换,测试用)。
|
|
738
1080
|
*/
|
|
739
1081
|
constructor(options: StorageServiceOptions);
|
|
740
|
-
/**
|
|
1082
|
+
/**
|
|
1083
|
+
* 上传图片并返回访问地址。
|
|
1084
|
+
*/
|
|
741
1085
|
uploadImage(options: StorageUploadOptions): Promise<StoredFile>;
|
|
742
|
-
/**
|
|
1086
|
+
/**
|
|
1087
|
+
* 获取临时存储配置;字段不完整时抛出 API 错误。
|
|
1088
|
+
*/
|
|
743
1089
|
private fetchStorageConfiguration;
|
|
744
|
-
/**
|
|
1090
|
+
/**
|
|
1091
|
+
* 生成对象键:`${prefix}${毫秒时间戳}_${标识}_${文件名}`。
|
|
1092
|
+
*/
|
|
745
1093
|
private makeObjectKey;
|
|
746
|
-
/**
|
|
1094
|
+
/**
|
|
1095
|
+
* 生产环境 COS 客户端工厂:动态加载 cos-js-sdk-v5 并按临时凭证创建客户端。
|
|
1096
|
+
*/
|
|
747
1097
|
private static cosClientFactory;
|
|
748
|
-
/**
|
|
1098
|
+
/**
|
|
1099
|
+
* 调用对象存储上传并包装为 Promise。
|
|
1100
|
+
*/
|
|
749
1101
|
private static putObject;
|
|
750
1102
|
/**
|
|
751
1103
|
* 解析对象访问地址:优先使用上传返回的 `Location`(补全协议),
|
|
752
1104
|
* 其次拼接自定义 endpoint,最后回退到默认 COS 域名。
|
|
753
1105
|
*/
|
|
754
1106
|
private static resolveObjectURL;
|
|
755
|
-
/**
|
|
1107
|
+
/**
|
|
1108
|
+
* 统一构造上传体。
|
|
1109
|
+
*/
|
|
756
1110
|
private static makeBody;
|
|
757
|
-
/**
|
|
1111
|
+
/**
|
|
1112
|
+
* 校验文件名非空且不包含路径分隔符。
|
|
1113
|
+
*/
|
|
758
1114
|
private static validateFileName;
|
|
759
|
-
/**
|
|
1115
|
+
/**
|
|
1116
|
+
* 按文件名后缀推断内容类型。
|
|
1117
|
+
*/
|
|
760
1118
|
private static inferContentType;
|
|
761
|
-
/**
|
|
1119
|
+
/**
|
|
1120
|
+
* 格式化字节数用于日志输出。
|
|
1121
|
+
*/
|
|
762
1122
|
private static formatByteCount;
|
|
763
|
-
/**
|
|
1123
|
+
/**
|
|
1124
|
+
* 归一化可选字符串:去除首尾空白后为空时返回 `undefined`。
|
|
1125
|
+
*/
|
|
764
1126
|
private static nonEmpty;
|
|
765
1127
|
}
|
|
766
1128
|
|
|
@@ -778,22 +1140,46 @@ interface RemoteFrameInterpolationOptions {
|
|
|
778
1140
|
* 轨道注册了渲染绑定时走绑定管线,否则按 `mediaStreamTrack` 直接渲染。
|
|
779
1141
|
*/
|
|
780
1142
|
declare class XmaxVideoView {
|
|
781
|
-
/**
|
|
1143
|
+
/**
|
|
1144
|
+
* 视图元素
|
|
1145
|
+
*/
|
|
1146
|
+
/**
|
|
1147
|
+
* 视图根元素(div,内含一个 video 元素)。
|
|
1148
|
+
*/
|
|
782
1149
|
readonly element: HTMLDivElement;
|
|
783
|
-
/**
|
|
1150
|
+
/**
|
|
1151
|
+
* @internal 渲染视频帧的元素,供绑定管线使用。
|
|
1152
|
+
*/
|
|
784
1153
|
readonly videoElement: HTMLVideoElement;
|
|
785
|
-
/**
|
|
1154
|
+
/**
|
|
1155
|
+
* 公共配置
|
|
1156
|
+
*/
|
|
1157
|
+
/**
|
|
1158
|
+
* 首帧实际提交显示时调用(一次性;换轨后重新武装)。
|
|
1159
|
+
*/
|
|
786
1160
|
frameDisplayHandler?: () => void;
|
|
1161
|
+
/**
|
|
1162
|
+
* 渲染状态
|
|
1163
|
+
*/
|
|
787
1164
|
private currentTrack?;
|
|
788
1165
|
private contentMode;
|
|
789
1166
|
private mirrored;
|
|
1167
|
+
/**
|
|
1168
|
+
* 首帧显示通知与异步回调版本
|
|
1169
|
+
*/
|
|
790
1170
|
private hasNotifiedFrameDisplay;
|
|
791
1171
|
private onPlaying?;
|
|
792
1172
|
private videoFrameCallbackID?;
|
|
793
1173
|
private frameNotificationSequence;
|
|
1174
|
+
/**
|
|
1175
|
+
* 远端插帧配置与渲染资源
|
|
1176
|
+
*/
|
|
794
1177
|
private interpolationOptions?;
|
|
795
1178
|
private interpolationPipeline?;
|
|
796
1179
|
private interpolationCanvas?;
|
|
1180
|
+
/**
|
|
1181
|
+
* DOM 挂载状态
|
|
1182
|
+
*/
|
|
797
1183
|
private detached;
|
|
798
1184
|
/**
|
|
799
1185
|
* 创建单轨视频视图。
|
|
@@ -803,34 +1189,73 @@ declare class XmaxVideoView {
|
|
|
803
1189
|
constructor(options?: {
|
|
804
1190
|
videoContentMode?: VideoContentMode;
|
|
805
1191
|
});
|
|
806
|
-
/**
|
|
1192
|
+
/**
|
|
1193
|
+
* 当前显示的视频轨道;切换时自动解绑旧轨道。
|
|
1194
|
+
*/
|
|
807
1195
|
get track(): RealtimeVideoTrack | undefined;
|
|
1196
|
+
/**
|
|
1197
|
+
* 解绑旧轨道后接入新轨道,并为新内容重新启用一次性首帧通知。
|
|
1198
|
+
*/
|
|
808
1199
|
set track(track: RealtimeVideoTrack | undefined);
|
|
809
|
-
/**
|
|
1200
|
+
/**
|
|
1201
|
+
* 视频内容在容器中的显示模式。
|
|
1202
|
+
*/
|
|
810
1203
|
get videoContentMode(): VideoContentMode;
|
|
1204
|
+
/**
|
|
1205
|
+
* 更新视频及插帧画布的内容缩放方式;相同配置不重复应用。
|
|
1206
|
+
*/
|
|
811
1207
|
set videoContentMode(mode: VideoContentMode);
|
|
812
|
-
/**
|
|
1208
|
+
/**
|
|
1209
|
+
* 本地预览是否镜像显示(仅影响显示,不影响发布流)。
|
|
1210
|
+
*/
|
|
813
1211
|
get isMirrored(): boolean;
|
|
1212
|
+
/**
|
|
1213
|
+
* 更新视图镜像变换,仅改变呈现方式,不改动媒体流。
|
|
1214
|
+
*/
|
|
814
1215
|
set isMirrored(mirrored: boolean);
|
|
815
|
-
/**
|
|
1216
|
+
/**
|
|
1217
|
+
* 挂载到容器元素。
|
|
1218
|
+
*/
|
|
816
1219
|
attach(to: HTMLElement): void;
|
|
817
|
-
/**
|
|
1220
|
+
/**
|
|
1221
|
+
* 从容器元素移除。
|
|
1222
|
+
*/
|
|
818
1223
|
detach(): void;
|
|
819
|
-
/**
|
|
1224
|
+
/**
|
|
1225
|
+
* 直接设置渲染用的媒体流(绑定管线和直接渲染共用)。 @internal
|
|
1226
|
+
*/
|
|
820
1227
|
setMediaStream(stream: MediaStream | null): void;
|
|
821
|
-
/**
|
|
1228
|
+
/**
|
|
1229
|
+
* 由远端绑定注入配置;本地预览不走此管线。 @internal
|
|
1230
|
+
*/
|
|
822
1231
|
setFrameInterpolation(options?: RemoteFrameInterpolationOptions): void;
|
|
1232
|
+
/**
|
|
1233
|
+
* 视图已挂载且媒体与配置就绪时创建插帧画布和管线,避免重复启动。
|
|
1234
|
+
*/
|
|
823
1235
|
private startInterpolation;
|
|
1236
|
+
/**
|
|
1237
|
+
* 停止并释放插帧管线,移除辅助画布,保留原始视频元素。
|
|
1238
|
+
*/
|
|
824
1239
|
private stopInterpolation;
|
|
825
|
-
/**
|
|
1240
|
+
/**
|
|
1241
|
+
* 接入轨道画面:优先走注册的渲染绑定,否则按媒体轨直接渲染。
|
|
1242
|
+
*/
|
|
826
1243
|
private attachTrack;
|
|
827
|
-
/**
|
|
1244
|
+
/**
|
|
1245
|
+
* 解绑当前轨道并清空渲染内容。
|
|
1246
|
+
*/
|
|
828
1247
|
private detachCurrentTrack;
|
|
829
|
-
/**
|
|
1248
|
+
/**
|
|
1249
|
+
* 首帧提交合成器时通知;旧浏览器回退到 playing 近似判断。
|
|
1250
|
+
*/
|
|
830
1251
|
private armFrameDisplayNotification;
|
|
831
|
-
/**
|
|
1252
|
+
/**
|
|
1253
|
+
* 换流、解绑或卸载时取消观察,防止迟到的首帧归入下一条流。
|
|
1254
|
+
*/
|
|
832
1255
|
private cancelFrameDisplayNotification;
|
|
833
|
-
/**
|
|
1256
|
+
/**
|
|
1257
|
+
* 应用显示模式与镜像样式。
|
|
1258
|
+
*/
|
|
834
1259
|
private applyContentMode;
|
|
835
1260
|
}
|
|
836
1261
|
|
|
@@ -841,10 +1266,21 @@ declare class XmaxVideoView {
|
|
|
841
1266
|
* 远端轨道置空时立即恢复本地预览。
|
|
842
1267
|
*/
|
|
843
1268
|
declare class XmaxRealtimeVideoView {
|
|
844
|
-
/**
|
|
1269
|
+
/**
|
|
1270
|
+
* 视图元素
|
|
1271
|
+
*/
|
|
1272
|
+
/**
|
|
1273
|
+
* 视图根元素。
|
|
1274
|
+
*/
|
|
845
1275
|
readonly element: HTMLDivElement;
|
|
1276
|
+
/**
|
|
1277
|
+
* 视频视图
|
|
1278
|
+
*/
|
|
846
1279
|
private readonly localVideoView;
|
|
847
1280
|
private readonly remoteVideoView;
|
|
1281
|
+
/**
|
|
1282
|
+
* 公共配置
|
|
1283
|
+
*/
|
|
848
1284
|
private currentLocalTrack?;
|
|
849
1285
|
private currentRemoteTrack?;
|
|
850
1286
|
private contentMode;
|
|
@@ -860,28 +1296,54 @@ declare class XmaxRealtimeVideoView {
|
|
|
860
1296
|
remoteTrack?: RealtimeVideoTrack;
|
|
861
1297
|
videoContentMode?: VideoContentMode;
|
|
862
1298
|
});
|
|
863
|
-
/**
|
|
1299
|
+
/**
|
|
1300
|
+
* 当前显示的本地视频轨道。
|
|
1301
|
+
*/
|
|
864
1302
|
get localTrack(): RealtimeVideoTrack | undefined;
|
|
1303
|
+
/**
|
|
1304
|
+
* 替换本地预览轨道;轨道未变化时保留当前绑定。
|
|
1305
|
+
*/
|
|
865
1306
|
set localTrack(track: RealtimeVideoTrack | undefined);
|
|
866
1307
|
/**
|
|
867
1308
|
* 当前显示的远端生成视频轨道。
|
|
868
1309
|
* 设置新轨道后等待首帧提交显示再渐入;置空时立即恢复本地预览。
|
|
869
1310
|
*/
|
|
870
1311
|
get remoteTrack(): RealtimeVideoTrack | undefined;
|
|
1312
|
+
/**
|
|
1313
|
+
* 替换远端轨道并重新等待首帧渐入;清空轨道时恢复本地预览。
|
|
1314
|
+
*/
|
|
871
1315
|
set remoteTrack(track: RealtimeVideoTrack | undefined);
|
|
872
|
-
/**
|
|
1316
|
+
/**
|
|
1317
|
+
* 视频内容在容器中的显示模式。
|
|
1318
|
+
*/
|
|
873
1319
|
get videoContentMode(): VideoContentMode;
|
|
1320
|
+
/**
|
|
1321
|
+
* 同步调整本地与远端视频在容器中的缩放和裁剪方式。
|
|
1322
|
+
*/
|
|
874
1323
|
set videoContentMode(mode: VideoContentMode);
|
|
875
|
-
/**
|
|
1324
|
+
/**
|
|
1325
|
+
* 本地预览是否镜像显示(前置摄像头)。
|
|
1326
|
+
*/
|
|
876
1327
|
get isLocalMirrored(): boolean;
|
|
1328
|
+
/**
|
|
1329
|
+
* 更新本地预览镜像;不修改采集帧或远端画面。
|
|
1330
|
+
*/
|
|
877
1331
|
set isLocalMirrored(mirrored: boolean);
|
|
878
|
-
/**
|
|
1332
|
+
/**
|
|
1333
|
+
* 挂载到容器元素。
|
|
1334
|
+
*/
|
|
879
1335
|
attach(to: HTMLElement): void;
|
|
880
|
-
/**
|
|
1336
|
+
/**
|
|
1337
|
+
* 从容器元素移除。
|
|
1338
|
+
*/
|
|
881
1339
|
detach(): void;
|
|
882
|
-
/**
|
|
1340
|
+
/**
|
|
1341
|
+
* 更新远端轨道绑定:重置渐入状态,等待首帧提交后再显示远端画面。
|
|
1342
|
+
*/
|
|
883
1343
|
private updateRemoteTrack;
|
|
884
|
-
/**
|
|
1344
|
+
/**
|
|
1345
|
+
* 远端首帧已提交:渐入远端画面。
|
|
1346
|
+
*/
|
|
885
1347
|
private showRemoteVideo;
|
|
886
1348
|
}
|
|
887
1349
|
|