@xmaxai/web-sdk 1.0.7 → 1.0.8
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/{chunk-EKOYOFES.cjs → chunk-24VPU65T.cjs} +263 -134
- package/dist/chunk-24VPU65T.cjs.map +1 -0
- package/dist/{chunk-4O5BSMUX.js → chunk-JGDZ3RD3.js} +162 -33
- package/dist/chunk-JGDZ3RD3.js.map +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -11
- package/dist/index.d.ts +27 -11
- 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.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-4O5BSMUX.js.map +0 -1
- package/dist/chunk-EKOYOFES.cjs.map +0 -1
|
@@ -205,7 +205,7 @@ var XmaxError = class _XmaxError extends Error {
|
|
|
205
205
|
};
|
|
206
206
|
|
|
207
207
|
// src/Foundation/Runtime/RuntimeInfo.ts
|
|
208
|
-
var XMAX_SDK_VERSION = "1.0.
|
|
208
|
+
var XMAX_SDK_VERSION = "1.0.8";
|
|
209
209
|
var _RuntimeInfo = class _RuntimeInfo {
|
|
210
210
|
/**
|
|
211
211
|
* 序列化为接口传输使用的 snake_case 字段。
|
|
@@ -601,6 +601,7 @@ var RealtimeModel = /* @__PURE__ */ ((RealtimeModel2) => {
|
|
|
601
601
|
RealtimeModel2["x2_0"] = "x2.0";
|
|
602
602
|
RealtimeModel2["x2_0_trtc"] = "x2.0-trtc";
|
|
603
603
|
RealtimeModel2["x2_1_preview"] = "x2.1-preview";
|
|
604
|
+
RealtimeModel2["x2_1_preview_1014"] = "x2.1-preview-1014";
|
|
604
605
|
return RealtimeModel2;
|
|
605
606
|
})(RealtimeModel || {});
|
|
606
607
|
function isKnownModel(model) {
|
|
@@ -615,10 +616,12 @@ function modelDefaults(model) {
|
|
|
615
616
|
var MODEL_DISPLAY_NAMES = {
|
|
616
617
|
["x2.0" /* x2_0 */]: "X2.0",
|
|
617
618
|
["x2.0-trtc" /* x2_0_trtc */]: "X2.1-preview-trtc",
|
|
618
|
-
["x2.1-preview" /* x2_1_preview */]: "X2.1-preview-agora"
|
|
619
|
+
["x2.1-preview" /* x2_1_preview */]: "X2.1-preview-agora",
|
|
620
|
+
["x2.1-preview-1014" /* x2_1_preview_1014 */]: "X2.1-preview-1014"
|
|
619
621
|
};
|
|
620
622
|
var MODEL_BASE_URLS = {
|
|
621
|
-
["x2.1-preview" /* x2_1_preview */]: "https://cloud.xmax.22duck.cn/open/api/v1"
|
|
623
|
+
["x2.1-preview" /* x2_1_preview */]: "https://cloud.xmax.22duck.cn/open/api/v1",
|
|
624
|
+
["x2.1-preview-1014" /* x2_1_preview_1014 */]: "https://dev.xmaxai.com/open/api/v1"
|
|
622
625
|
};
|
|
623
626
|
var RESOLUTION_BUCKETS = {
|
|
624
627
|
["x2.0" /* x2_0 */]: [],
|
|
@@ -629,12 +632,17 @@ var RESOLUTION_BUCKETS = {
|
|
|
629
632
|
["x2.1-preview" /* x2_1_preview */]: [
|
|
630
633
|
{ width: 1024, height: 1920 },
|
|
631
634
|
{ width: 1920, height: 1024 }
|
|
635
|
+
],
|
|
636
|
+
["x2.1-preview-1014" /* x2_1_preview_1014 */]: [
|
|
637
|
+
{ width: 1024, height: 1920 },
|
|
638
|
+
{ width: 1920, height: 1024 }
|
|
632
639
|
]
|
|
633
640
|
};
|
|
634
641
|
var MAXIMUM_INPUT_PIXELS = {
|
|
635
642
|
["x2.0" /* x2_0 */]: 128e4,
|
|
636
643
|
["x2.0-trtc" /* x2_0_trtc */]: 21e5,
|
|
637
|
-
["x2.1-preview" /* x2_1_preview */]: 21e5
|
|
644
|
+
["x2.1-preview" /* x2_1_preview */]: 21e5,
|
|
645
|
+
["x2.1-preview-1014" /* x2_1_preview_1014 */]: 21e5
|
|
638
646
|
};
|
|
639
647
|
function modelDisplayName(model) {
|
|
640
648
|
return isKnownModel(model) ? MODEL_DISPLAY_NAMES[model] : model;
|
|
@@ -666,7 +674,8 @@ function defaultCameraVideoFormat(model) {
|
|
|
666
674
|
var MODEL_RTC_PROVIDERS = {
|
|
667
675
|
["x2.0" /* x2_0 */]: Object.freeze(["vertc" /* vertc */]),
|
|
668
676
|
["x2.0-trtc" /* x2_0_trtc */]: Object.freeze(["trtc" /* trtc */]),
|
|
669
|
-
["x2.1-preview" /* x2_1_preview */]: Object.freeze(["agora" /* agora */])
|
|
677
|
+
["x2.1-preview" /* x2_1_preview */]: Object.freeze(["agora" /* agora */]),
|
|
678
|
+
["x2.1-preview-1014" /* x2_1_preview_1014 */]: Object.freeze(["agora" /* agora */])
|
|
670
679
|
};
|
|
671
680
|
function supportedRtcProviders(model) {
|
|
672
681
|
return isKnownModel(model) ? MODEL_RTC_PROVIDERS[model] : CUSTOM_MODEL_RTC_PROVIDERS;
|
|
@@ -1353,15 +1362,6 @@ var AgoraVideoSender = class {
|
|
|
1353
1362
|
}
|
|
1354
1363
|
throw new XmaxError("RTC_ERROR" /* rtcError */, "Browser did not retain WebRTC video sender parameters");
|
|
1355
1364
|
}
|
|
1356
|
-
XmaxLogger.rtc.info(() => `Agora \u53D1\u9001\u53C2\u6570\u5B9E\u9A8C (Agora Sender Parameters)
|
|
1357
|
-
${JSON.stringify({
|
|
1358
|
-
capture: { width: capture.width, height: capture.height, frameRate: capture.frameRate },
|
|
1359
|
-
target: { width: config.width, height: config.height, frameRate: config.frameRate },
|
|
1360
|
-
scaleResolutionDownBy: actual.scaleResolutionDownBy,
|
|
1361
|
-
maxFramerate: actual.maxFramerate,
|
|
1362
|
-
maxBitrateKbps: actual.maxBitrate / 1e3,
|
|
1363
|
-
minimumBitrateApplied: false
|
|
1364
|
-
}, null, 2)}`, 2 /* performance */);
|
|
1365
1365
|
}
|
|
1366
1366
|
};
|
|
1367
1367
|
|
|
@@ -4842,6 +4842,46 @@ var LocalVideoController = class {
|
|
|
4842
4842
|
}
|
|
4843
4843
|
};
|
|
4844
4844
|
|
|
4845
|
+
// src/Media/Video/ExternalVideoController.ts
|
|
4846
|
+
var ExternalVideoController = class {
|
|
4847
|
+
constructor(onError) {
|
|
4848
|
+
__publicField(this, "onError", onError);
|
|
4849
|
+
__publicField(this, "track");
|
|
4850
|
+
__publicField(this, "onEnded", () => {
|
|
4851
|
+
this.onError(new XmaxError("MEDIA_ERROR" /* mediaError */, "External video source ended"));
|
|
4852
|
+
});
|
|
4853
|
+
}
|
|
4854
|
+
get currentTrack() {
|
|
4855
|
+
return this.track;
|
|
4856
|
+
}
|
|
4857
|
+
create(options, mediaService) {
|
|
4858
|
+
if (this.track) throw new XmaxError("INVALID_CONFIGURATION" /* invalidConfiguration */, "Close the current external video first");
|
|
4859
|
+
const { videoTrack, videoFormat } = options;
|
|
4860
|
+
if (!videoTrack || videoTrack.kind !== "video" || videoTrack.readyState !== "live" || typeof videoTrack.clone !== "function") {
|
|
4861
|
+
throw new XmaxError("INVALID_CONFIGURATION" /* invalidConfiguration */, "External video requires a live video MediaStreamTrack");
|
|
4862
|
+
}
|
|
4863
|
+
videoFormat.validate();
|
|
4864
|
+
const size = mediaService.resolveModelInputSize(videoFormat);
|
|
4865
|
+
const format = videoFormat.resized(size.width, size.height);
|
|
4866
|
+
const nativeTrack = videoTrack.clone();
|
|
4867
|
+
if (nativeTrack.readyState !== "live") {
|
|
4868
|
+
nativeTrack.stop();
|
|
4869
|
+
throw new XmaxError("MEDIA_ERROR" /* mediaError */, "External video source ended during setup");
|
|
4870
|
+
}
|
|
4871
|
+
const track = new RealtimeVideoTrack({ id: "external-video", videoFormat: format });
|
|
4872
|
+
track.mediaStreamTrack = nativeTrack;
|
|
4873
|
+
nativeTrack.addEventListener("ended", this.onEnded);
|
|
4874
|
+
this.track = track;
|
|
4875
|
+
return new RealtimeMediaStream({ id: "stream0" /* local */, videoTrack: track });
|
|
4876
|
+
}
|
|
4877
|
+
stop() {
|
|
4878
|
+
const nativeTrack = _optionalChain([this, 'access', _449 => _449.track, 'optionalAccess', _450 => _450.mediaStreamTrack]);
|
|
4879
|
+
this.track = void 0;
|
|
4880
|
+
_optionalChain([nativeTrack, 'optionalAccess', _451 => _451.removeEventListener, 'call', _452 => _452("ended", this.onEnded)]);
|
|
4881
|
+
_optionalChain([nativeTrack, 'optionalAccess', _453 => _453.stop, 'call', _454 => _454()]);
|
|
4882
|
+
}
|
|
4883
|
+
};
|
|
4884
|
+
|
|
4845
4885
|
// src/Service/Realtime/RealtimeContext.ts
|
|
4846
4886
|
var RealtimeContext = class {
|
|
4847
4887
|
/**
|
|
@@ -4865,7 +4905,7 @@ var RealtimeContext = class {
|
|
|
4865
4905
|
__publicField(this, "referencePath");
|
|
4866
4906
|
this.referenceVideo = init.referenceVideo && Object.freeze({ ...init.referenceVideo });
|
|
4867
4907
|
this.prompt = init.prompt.trim();
|
|
4868
|
-
const normalizedReferencePath = _optionalChain([init, 'access',
|
|
4908
|
+
const normalizedReferencePath = _optionalChain([init, 'access', _455 => _455.referencePath, 'optionalAccess', _456 => _456.trim, 'call', _457 => _457()]);
|
|
4869
4909
|
this.referencePath = normalizedReferencePath || void 0;
|
|
4870
4910
|
}
|
|
4871
4911
|
};
|
|
@@ -5133,7 +5173,7 @@ var RealtimeSessionService = class _RealtimeSessionService {
|
|
|
5133
5173
|
return;
|
|
5134
5174
|
}
|
|
5135
5175
|
_RealtimeSessionService.ensureSessionActive(session);
|
|
5136
|
-
await _optionalChain([handlers, 'access',
|
|
5176
|
+
await _optionalChain([handlers, 'access', _458 => _458.onRefresh, 'optionalCall', _459 => _459(session)]);
|
|
5137
5177
|
} catch (error) {
|
|
5138
5178
|
if (this.heartbeatVersion !== version) {
|
|
5139
5179
|
return;
|
|
@@ -5346,7 +5386,7 @@ var RealtimeState = class {
|
|
|
5346
5386
|
* @param other 待比较的状态。
|
|
5347
5387
|
*/
|
|
5348
5388
|
equals(other) {
|
|
5349
|
-
return this.connectionState === other.connectionState && this.sessionID === other.sessionID && this.taskID === other.taskID && _optionalChain([this, 'access',
|
|
5389
|
+
return this.connectionState === other.connectionState && this.sessionID === other.sessionID && this.taskID === other.taskID && _optionalChain([this, 'access', _460 => _460.reason, 'optionalAccess', _461 => _461.kind]) === _optionalChain([other, 'access', _462 => _462.reason, 'optionalAccess', _463 => _463.kind]);
|
|
5350
5390
|
}
|
|
5351
5391
|
};
|
|
5352
5392
|
|
|
@@ -5396,8 +5436,8 @@ var RoomEvent = class _RoomEvent {
|
|
|
5396
5436
|
ref_video_path: options.context.referenceVideo.path,
|
|
5397
5437
|
sample_method: options.context.referenceVideo.sampleMethod,
|
|
5398
5438
|
target_size: [
|
|
5399
|
-
_nullishCoalesce(_optionalChain([options, 'access',
|
|
5400
|
-
_nullishCoalesce(_optionalChain([options, 'access',
|
|
5439
|
+
_nullishCoalesce(_optionalChain([options, 'access', _464 => _464.targetSize, 'optionalAccess', _465 => _465.width]), () => ( options.videoFormat.width)),
|
|
5440
|
+
_nullishCoalesce(_optionalChain([options, 'access', _466 => _466.targetSize, 'optionalAccess', _467 => _467.height]), () => ( options.videoFormat.height))
|
|
5401
5441
|
]
|
|
5402
5442
|
}
|
|
5403
5443
|
},
|
|
@@ -5469,6 +5509,7 @@ var RoomEvent = class _RoomEvent {
|
|
|
5469
5509
|
static generationParameters(options) {
|
|
5470
5510
|
return {
|
|
5471
5511
|
model: "default",
|
|
5512
|
+
face_replace: _nullishCoalesce(options.faceRestoration, () => ( false)),
|
|
5472
5513
|
size: [options.videoFormat.width, options.videoFormat.height],
|
|
5473
5514
|
target_size: options.targetSize ? [
|
|
5474
5515
|
Math.round(options.targetSize.width),
|
|
@@ -5839,12 +5880,19 @@ var RoomController = class {
|
|
|
5839
5880
|
/**
|
|
5840
5881
|
* 发送生成开始信令。
|
|
5841
5882
|
*
|
|
5883
|
+
* @param options.faceRestoration 是否回贴原始人脸,默认 false。
|
|
5884
|
+
* @param options.mirror 是否由后端镜像输入画面,默认 false。
|
|
5885
|
+
* @param options.taskID 当前生成任务标识。
|
|
5886
|
+
* @param options.videoFormat 模型生成使用的视频规格。
|
|
5887
|
+
* @param options.targetSize 服务端生成后的回传尺寸,缺省使用生成尺寸。
|
|
5888
|
+
* @param options.context 本次生成条件。
|
|
5842
5889
|
* @throws 房间未就绪或信令发送失败时抛出错误。
|
|
5843
5890
|
*/
|
|
5844
5891
|
startGeneration(options) {
|
|
5845
5892
|
return this.send(
|
|
5846
5893
|
RoomEvent.start({
|
|
5847
5894
|
mirror: _nullishCoalesce(options.mirror, () => ( false)),
|
|
5895
|
+
faceRestoration: _nullishCoalesce(options.faceRestoration, () => ( false)),
|
|
5848
5896
|
userID: this.requireUserID(),
|
|
5849
5897
|
taskID: options.taskID,
|
|
5850
5898
|
videoFormat: options.videoFormat,
|
|
@@ -5856,11 +5904,17 @@ var RoomController = class {
|
|
|
5856
5904
|
/**
|
|
5857
5905
|
* 发送生成条件变更信令。
|
|
5858
5906
|
*
|
|
5907
|
+
* @param options.faceRestoration 是否回贴原始人脸,默认 false。
|
|
5908
|
+
* @param options.taskID 当前生成任务标识。
|
|
5909
|
+
* @param options.videoFormat 模型生成使用的视频规格。
|
|
5910
|
+
* @param options.targetSize 服务端生成后的回传尺寸。
|
|
5911
|
+
* @param options.context 本次生成条件。
|
|
5859
5912
|
* @throws 房间未就绪或信令发送失败时抛出错误。
|
|
5860
5913
|
*/
|
|
5861
5914
|
changeGenerationCondition(options) {
|
|
5862
5915
|
return this.send(
|
|
5863
5916
|
RoomEvent.changeCondition({
|
|
5917
|
+
faceRestoration: _nullishCoalesce(options.faceRestoration, () => ( false)),
|
|
5864
5918
|
userID: this.requireUserID(),
|
|
5865
5919
|
taskID: options.taskID,
|
|
5866
5920
|
videoFormat: options.videoFormat,
|
|
@@ -5942,7 +5996,7 @@ var RoomController = class {
|
|
|
5942
5996
|
if (targetUserID && ownUserID && targetUserID !== ownUserID) {
|
|
5943
5997
|
return;
|
|
5944
5998
|
}
|
|
5945
|
-
_optionalChain([this, 'access',
|
|
5999
|
+
_optionalChain([this, 'access', _468 => _468.listener, 'optionalAccess', _469 => _469.onRoomMessage, 'call', _470 => _470(senderUserID, message)]);
|
|
5946
6000
|
}
|
|
5947
6001
|
/**
|
|
5948
6002
|
* 发送房间信令并输出日志。
|
|
@@ -6224,7 +6278,7 @@ var StreamController = class {
|
|
|
6224
6278
|
this.roomController.setListener({
|
|
6225
6279
|
onRoomMessage: (sender, message) => {
|
|
6226
6280
|
this.handleNetworkVideoCompletion(sender, message);
|
|
6227
|
-
_optionalChain([this, 'access',
|
|
6281
|
+
_optionalChain([this, 'access', _471 => _471.roomListener, 'optionalAccess', _472 => _472.onRoomMessage, 'call', _473 => _473(sender, message)]);
|
|
6228
6282
|
}
|
|
6229
6283
|
});
|
|
6230
6284
|
this.rtcManager.setEventListener({
|
|
@@ -6234,18 +6288,18 @@ var StreamController = class {
|
|
|
6234
6288
|
onError: (error) => this.errorListener(error),
|
|
6235
6289
|
onNetworkStatistics: (statistics) => {
|
|
6236
6290
|
if (this.state.roomID) {
|
|
6237
|
-
_optionalChain([this, 'access',
|
|
6291
|
+
_optionalChain([this, 'access', _474 => _474.networkStatisticsListener, 'optionalCall', _475 => _475(statistics)]);
|
|
6238
6292
|
}
|
|
6239
6293
|
},
|
|
6240
6294
|
onRemoteVideoStatistics: (statistics) => {
|
|
6241
|
-
const userID = _optionalChain([this, 'access',
|
|
6242
|
-
_optionalChain([this, 'access',
|
|
6295
|
+
const userID = _optionalChain([this, 'access', _476 => _476.state, 'access', _477 => _477.activeRemoteStream, 'optionalAccess', _478 => _478.userID]);
|
|
6296
|
+
_optionalChain([this, 'access', _479 => _479.remoteVideoStatisticsListener, 'optionalCall', _480 => _480(
|
|
6243
6297
|
userID ? statistics.find((item) => item.userID === userID) : void 0
|
|
6244
6298
|
)]);
|
|
6245
6299
|
},
|
|
6246
6300
|
onLocalVideoStatistics: (statistics) => {
|
|
6247
6301
|
if (this.state.localVideoPublished) {
|
|
6248
|
-
_optionalChain([this, 'access',
|
|
6302
|
+
_optionalChain([this, 'access', _481 => _481.localVideoStatisticsListener, 'optionalCall', _482 => _482(statistics)]);
|
|
6249
6303
|
}
|
|
6250
6304
|
},
|
|
6251
6305
|
onCustomMessageReceived: (senderUserID, message) => {
|
|
@@ -6322,7 +6376,7 @@ var StreamController = class {
|
|
|
6322
6376
|
\u2514\u2500 roomID: ${connection.roomID}, botID: ${_nullishCoalesce(connection.botID, () => ( "(\u672A\u8BBE\u7F6E)"))}`
|
|
6323
6377
|
);
|
|
6324
6378
|
if (publishLocalMedia) {
|
|
6325
|
-
await _optionalChain([beforePublish, 'optionalCall',
|
|
6379
|
+
await _optionalChain([beforePublish, 'optionalCall', _483 => _483()]);
|
|
6326
6380
|
ensureActive2();
|
|
6327
6381
|
await this.publishLocalStream(includeLocalAudio);
|
|
6328
6382
|
}
|
|
@@ -6394,6 +6448,7 @@ var StreamController = class {
|
|
|
6394
6448
|
const sending = this.roomController.startGeneration({
|
|
6395
6449
|
taskID,
|
|
6396
6450
|
mirror: _nullishCoalesce(options.mirror, () => ( false)),
|
|
6451
|
+
faceRestoration: _nullishCoalesce(options.faceRestoration, () => ( false)),
|
|
6397
6452
|
videoFormat: options.videoFormat,
|
|
6398
6453
|
targetSize: options.targetSize,
|
|
6399
6454
|
context: options.context
|
|
@@ -6401,7 +6456,7 @@ var StreamController = class {
|
|
|
6401
6456
|
const state2 = this.state;
|
|
6402
6457
|
const sent = Promise.resolve(sending).then(async () => {
|
|
6403
6458
|
if (this.state !== state2 || state2.generationTaskID !== taskID) return;
|
|
6404
|
-
await _optionalChain([options, 'access',
|
|
6459
|
+
await _optionalChain([options, 'access', _484 => _484.onStartSent, 'optionalCall', _485 => _485()]);
|
|
6405
6460
|
if (this.state !== state2 || state2.generationTaskID !== taskID) return;
|
|
6406
6461
|
for (const userID of state2.publishedRemoteUserIDs) {
|
|
6407
6462
|
void this.handleRemoteVideoPublished(userID, true);
|
|
@@ -6454,6 +6509,7 @@ var StreamController = class {
|
|
|
6454
6509
|
try {
|
|
6455
6510
|
await this.roomController.changeGenerationCondition({
|
|
6456
6511
|
taskID: options.taskID,
|
|
6512
|
+
faceRestoration: _nullishCoalesce(options.faceRestoration, () => ( false)),
|
|
6457
6513
|
videoFormat: options.videoFormat,
|
|
6458
6514
|
targetSize: options.targetSize,
|
|
6459
6515
|
context: options.context
|
|
@@ -6536,7 +6592,7 @@ var StreamController = class {
|
|
|
6536
6592
|
deliverNetworkVideoCompletion() {
|
|
6537
6593
|
const state2 = this.state;
|
|
6538
6594
|
const completion = state2.networkVideoCompletion;
|
|
6539
|
-
if (!_optionalChain([completion, 'optionalAccess',
|
|
6595
|
+
if (!_optionalChain([completion, 'optionalAccess', _486 => _486.finished]) || !completion.onFinish || completion.scheduled) {
|
|
6540
6596
|
return;
|
|
6541
6597
|
}
|
|
6542
6598
|
completion.scheduled = true;
|
|
@@ -6545,7 +6601,7 @@ var StreamController = class {
|
|
|
6545
6601
|
return;
|
|
6546
6602
|
}
|
|
6547
6603
|
try {
|
|
6548
|
-
void Promise.resolve(_optionalChain([completion, 'access',
|
|
6604
|
+
void Promise.resolve(_optionalChain([completion, 'access', _487 => _487.onFinish, 'optionalCall', _488 => _488()])).catch(() => {
|
|
6549
6605
|
});
|
|
6550
6606
|
} catch (e23) {
|
|
6551
6607
|
}
|
|
@@ -6556,7 +6612,7 @@ var StreamController = class {
|
|
|
6556
6612
|
*/
|
|
6557
6613
|
configureRoom(options) {
|
|
6558
6614
|
const roomID = options.roomID.trim();
|
|
6559
|
-
const botID = _nullishCoalesce(_optionalChain([options, 'access',
|
|
6615
|
+
const botID = _nullishCoalesce(_optionalChain([options, 'access', _489 => _489.botID, 'optionalAccess', _490 => _490.trim, 'call', _491 => _491()]), () => ( ""));
|
|
6560
6616
|
if (!roomID) {
|
|
6561
6617
|
throw new XmaxError(
|
|
6562
6618
|
"INVALID_CONFIGURATION" /* invalidConfiguration */,
|
|
@@ -6639,7 +6695,7 @@ var StreamController = class {
|
|
|
6639
6695
|
return;
|
|
6640
6696
|
}
|
|
6641
6697
|
this.state.subscribedRemoteUserIDs.delete(trimmedUserID);
|
|
6642
|
-
if (_optionalChain([this, 'access',
|
|
6698
|
+
if (_optionalChain([this, 'access', _492 => _492.state, 'access', _493 => _493.activeRemoteStream, 'optionalAccess', _494 => _494.userID]) === trimmedUserID) {
|
|
6643
6699
|
await this.unsubscribeRemoteAudio(trimmedUserID);
|
|
6644
6700
|
this.state.activeRemoteStream = void 0;
|
|
6645
6701
|
this.clearRemoteStream();
|
|
@@ -6829,7 +6885,7 @@ var StreamController = class {
|
|
|
6829
6885
|
*/
|
|
6830
6886
|
resolveGenerationStart(taskID) {
|
|
6831
6887
|
const waiter = this.state.generationWaiter;
|
|
6832
|
-
if (this.state.generationTaskID !== taskID || _optionalChain([waiter, 'optionalAccess',
|
|
6888
|
+
if (this.state.generationTaskID !== taskID || _optionalChain([waiter, 'optionalAccess', _495 => _495.taskID]) !== taskID) {
|
|
6833
6889
|
return;
|
|
6834
6890
|
}
|
|
6835
6891
|
this.state.generationWaiter = void 0;
|
|
@@ -6841,7 +6897,7 @@ var StreamController = class {
|
|
|
6841
6897
|
*/
|
|
6842
6898
|
rejectGenerationStart(taskID, error) {
|
|
6843
6899
|
const waiter = this.state.generationWaiter;
|
|
6844
|
-
if (this.state.generationTaskID !== taskID || _optionalChain([waiter, 'optionalAccess',
|
|
6900
|
+
if (this.state.generationTaskID !== taskID || _optionalChain([waiter, 'optionalAccess', _496 => _496.taskID]) !== taskID) {
|
|
6845
6901
|
return;
|
|
6846
6902
|
}
|
|
6847
6903
|
this.state.generationWaiter = void 0;
|
|
@@ -6852,7 +6908,7 @@ var StreamController = class {
|
|
|
6852
6908
|
* 通知渲染层清理远端生成流;失败仅记录日志。
|
|
6853
6909
|
*/
|
|
6854
6910
|
clearRemoteStream() {
|
|
6855
|
-
_optionalChain([this, 'access',
|
|
6911
|
+
_optionalChain([this, 'access', _497 => _497.remoteVideoStatisticsListener, 'optionalCall', _498 => _498(void 0)]);
|
|
6856
6912
|
try {
|
|
6857
6913
|
this.remoteStreamListener(null);
|
|
6858
6914
|
} catch (error) {
|
|
@@ -7316,7 +7372,7 @@ var RealtimeCoordinator = class _RealtimeCoordinator {
|
|
|
7316
7372
|
}
|
|
7317
7373
|
throw _RealtimeCoordinator.cancelledError();
|
|
7318
7374
|
}
|
|
7319
|
-
const terminationTask = await _asyncNullishCoalesce(await _asyncNullishCoalesce(operation.terminationTask, async () => ( _optionalChain([this, 'access',
|
|
7375
|
+
const terminationTask = await _asyncNullishCoalesce(await _asyncNullishCoalesce(operation.terminationTask, async () => ( _optionalChain([this, 'access', _499 => _499.termination, 'optionalAccess', _500 => _500.task]))), async () => ( await this.requestTermination(
|
|
7320
7376
|
_nullishCoalesce(operation.lease.failureScope, () => ( 0)) /* connection */,
|
|
7321
7377
|
void 0,
|
|
7322
7378
|
RealtimeReason.normal,
|
|
@@ -7445,7 +7501,7 @@ var RealtimeCoordinator = class _RealtimeCoordinator {
|
|
|
7445
7501
|
* 结束指定操作,释放操作准入场。
|
|
7446
7502
|
*/
|
|
7447
7503
|
finish(operation) {
|
|
7448
|
-
if (_optionalChain([this, 'access',
|
|
7504
|
+
if (_optionalChain([this, 'access', _501 => _501.activeOperation, 'optionalAccess', _502 => _502.id]) === operation.id) {
|
|
7449
7505
|
this.activeOperation = void 0;
|
|
7450
7506
|
}
|
|
7451
7507
|
}
|
|
@@ -7457,7 +7513,7 @@ var RealtimeCoordinator = class _RealtimeCoordinator {
|
|
|
7457
7513
|
return;
|
|
7458
7514
|
}
|
|
7459
7515
|
this.state = nextState;
|
|
7460
|
-
_optionalChain([this, 'access',
|
|
7516
|
+
_optionalChain([this, 'access', _503 => _503.stateListener, 'optionalCall', _504 => _504(nextState)]);
|
|
7461
7517
|
}
|
|
7462
7518
|
/**
|
|
7463
7519
|
* 构造统一的操作取消错误。
|
|
@@ -7594,7 +7650,7 @@ var RealtimeLaunchTimer = class {
|
|
|
7594
7650
|
*/
|
|
7595
7651
|
notify() {
|
|
7596
7652
|
try {
|
|
7597
|
-
void Promise.resolve(_optionalChain([this, 'access',
|
|
7653
|
+
void Promise.resolve(_optionalChain([this, 'access', _505 => _505.listener, 'optionalCall', _506 => _506(this.snapshot)])).catch(() => {
|
|
7598
7654
|
});
|
|
7599
7655
|
} catch (e26) {
|
|
7600
7656
|
}
|
|
@@ -7626,7 +7682,7 @@ var XmaxRealtimeConnectionManager = class {
|
|
|
7626
7682
|
* 当前活动会话标识;尚未连接或清理完成后为空。
|
|
7627
7683
|
*/
|
|
7628
7684
|
get currentSessionID() {
|
|
7629
|
-
return _optionalChain([this, 'access',
|
|
7685
|
+
return _optionalChain([this, 'access', _507 => _507.activeSession, 'optionalAccess', _508 => _508.id]);
|
|
7630
7686
|
}
|
|
7631
7687
|
/**
|
|
7632
7688
|
* 未配置 API 服务时在连接操作开始前报错,不影响本地预览。
|
|
@@ -7638,6 +7694,16 @@ var XmaxRealtimeConnectionManager = class {
|
|
|
7638
7694
|
* 创建会话、配置编码、进房并发布本地媒体,启动心跳后返回远端占位流。
|
|
7639
7695
|
* 进房结束即记录连接耗时;可选 beforePublish 检查阻塞发布,计入连接耗时;
|
|
7640
7696
|
* 发布本地流单独计时。
|
|
7697
|
+
* @param options.localTrack 当前本地媒体轨道。
|
|
7698
|
+
* @param options.remoteVideoFormat 原始生成及远端画面规格,缺省使用本地轨道规格。
|
|
7699
|
+
* @param options.localVideoFormat 发布前实际应用的上行编码格式;与原始生成及远端格式分开。
|
|
7700
|
+
* @param options.onVideoEncoderConfigured 上行编码配置成功后的回调。
|
|
7701
|
+
* @param options.model 创建业务会话使用的模型名称。
|
|
7702
|
+
* @param options.includeLocalAudio 是否发布本地音频。
|
|
7703
|
+
* @param options.ensureCurrent 校验当前操作仍有效。
|
|
7704
|
+
* @param options.onPublished 本地发布完成后的回调。
|
|
7705
|
+
* @param options.beforePublish 发布前的可选异步检查。
|
|
7706
|
+
* @param options.publishLocalMedia 是否发布本地媒体,默认 true;网络视频源传 false。
|
|
7641
7707
|
* @throws 会话、进房、发布失败或操作租约已失效时抛出错误,由上层统一清理。
|
|
7642
7708
|
*/
|
|
7643
7709
|
async connect(options) {
|
|
@@ -7671,7 +7737,7 @@ var XmaxRealtimeConnectionManager = class {
|
|
|
7671
7737
|
if (publishLocalMedia) {
|
|
7672
7738
|
await streamController.updateUplinkVideoFormat(videoFormat);
|
|
7673
7739
|
options.ensureCurrent();
|
|
7674
|
-
_optionalChain([options, 'access',
|
|
7740
|
+
_optionalChain([options, 'access', _509 => _509.onVideoEncoderConfigured, 'optionalCall', _510 => _510()]);
|
|
7675
7741
|
}
|
|
7676
7742
|
options.ensureCurrent();
|
|
7677
7743
|
let completePublish;
|
|
@@ -7679,13 +7745,13 @@ var XmaxRealtimeConnectionManager = class {
|
|
|
7679
7745
|
options.ensureCurrent();
|
|
7680
7746
|
}, async () => {
|
|
7681
7747
|
options.ensureCurrent();
|
|
7682
|
-
await _optionalChain([options, 'access',
|
|
7748
|
+
await _optionalChain([options, 'access', _511 => _511.beforePublish, 'optionalCall', _512 => _512()]);
|
|
7683
7749
|
completeConnection();
|
|
7684
7750
|
completePublish = this.dependencies.timing.startPublish();
|
|
7685
7751
|
}, publishLocalMedia);
|
|
7686
7752
|
options.ensureCurrent();
|
|
7687
7753
|
completeConnection();
|
|
7688
|
-
_optionalChain([completePublish, 'optionalCall',
|
|
7754
|
+
_optionalChain([completePublish, 'optionalCall', _513 => _513()]);
|
|
7689
7755
|
options.onPublished();
|
|
7690
7756
|
sessionService.startHeartbeat(session.id, {
|
|
7691
7757
|
onFailure: (sessionID, error) => {
|
|
@@ -7708,24 +7774,24 @@ var XmaxRealtimeConnectionManager = class {
|
|
|
7708
7774
|
* 更新已绑定远端视图的插帧配置;传 undefined 停用插帧。
|
|
7709
7775
|
*/
|
|
7710
7776
|
setFrameInterpolation(options) {
|
|
7711
|
-
_optionalChain([this, 'access',
|
|
7777
|
+
_optionalChain([this, 'access', _514 => _514.remoteTarget, 'optionalAccess', _515 => _515.setFrameInterpolation, 'optionalCall', _516 => _516(options)]);
|
|
7712
7778
|
}
|
|
7713
7779
|
/**
|
|
7714
7780
|
* 清空远端视图的媒体流,保留轨道与视图绑定以供统一清理。
|
|
7715
7781
|
*/
|
|
7716
7782
|
clearRemoteMedia() {
|
|
7717
|
-
_optionalChain([this, 'access',
|
|
7783
|
+
_optionalChain([this, 'access', _517 => _517.remoteTarget, 'optionalAccess', _518 => _518.setMediaStream, 'call', _519 => _519(null)]);
|
|
7718
7784
|
}
|
|
7719
7785
|
/**
|
|
7720
7786
|
* 停止会话心跳;未配置会话服务时不执行操作。
|
|
7721
7787
|
*/
|
|
7722
7788
|
stopHeartbeat() {
|
|
7723
7789
|
this.refreshVersion++;
|
|
7724
|
-
_optionalChain([this, 'access',
|
|
7790
|
+
_optionalChain([this, 'access', _520 => _520.credentialController, 'optionalAccess', _521 => _521.abort, 'call', _522 => _522()]);
|
|
7725
7791
|
this.credentialController = void 0;
|
|
7726
7792
|
this.credentialRefresh = void 0;
|
|
7727
7793
|
this.credentialApplication = Promise.resolve();
|
|
7728
|
-
_optionalChain([this, 'access',
|
|
7794
|
+
_optionalChain([this, 'access', _523 => _523.dependencies, 'access', _524 => _524.sessionService, 'optionalAccess', _525 => _525.stopHeartbeat, 'call', _526 => _526()]);
|
|
7729
7795
|
}
|
|
7730
7796
|
/**
|
|
7731
7797
|
* RTC Token 过期时复用会话心跳获取新凭据,并合并同一实例的并发请求。
|
|
@@ -7733,14 +7799,14 @@ var XmaxRealtimeConnectionManager = class {
|
|
|
7733
7799
|
async refreshCredentials() {
|
|
7734
7800
|
if (this.credentialRefresh) return this.credentialRefresh;
|
|
7735
7801
|
const current = this.activeSession;
|
|
7736
|
-
if (!_optionalChain([current, 'optionalAccess',
|
|
7802
|
+
if (!_optionalChain([current, 'optionalAccess', _527 => _527.connection]) || current.connection.provider === "trtc" /* trtc */) return;
|
|
7737
7803
|
const version = this.refreshVersion;
|
|
7738
7804
|
const operation = (async () => {
|
|
7739
7805
|
try {
|
|
7740
7806
|
const session = await this.requireSessionService().heartbeatSession(current.id);
|
|
7741
7807
|
await this.handleSessionRefresh(session, version, true);
|
|
7742
7808
|
} catch (error) {
|
|
7743
|
-
if (version === this.refreshVersion && _optionalChain([this, 'access',
|
|
7809
|
+
if (version === this.refreshVersion && _optionalChain([this, 'access', _528 => _528.activeSession, 'optionalAccess', _529 => _529.id]) === current.id) {
|
|
7744
7810
|
this.dependencies.onHeartbeatFailure(current.id, XmaxError.from(error));
|
|
7745
7811
|
}
|
|
7746
7812
|
}
|
|
@@ -7757,7 +7823,7 @@ var XmaxRealtimeConnectionManager = class {
|
|
|
7757
7823
|
*/
|
|
7758
7824
|
async waitUntilRemoteTrackReady(timeoutMs, signal) {
|
|
7759
7825
|
if (signal.aborted) throw RealtimeCoordinator.cancelledError();
|
|
7760
|
-
const mediaTrack = _optionalChain([this, 'access',
|
|
7826
|
+
const mediaTrack = _optionalChain([this, 'access', _530 => _530.activeRemoteTrack, 'optionalAccess', _531 => _531.mediaStreamTrack]);
|
|
7761
7827
|
if (!mediaTrack || !mediaTrack.muted) return;
|
|
7762
7828
|
await new Promise((resolve, reject) => {
|
|
7763
7829
|
const cleanup = () => {
|
|
@@ -7794,7 +7860,7 @@ var XmaxRealtimeConnectionManager = class {
|
|
|
7794
7860
|
if (track) {
|
|
7795
7861
|
track.mediaStreamTrack = void 0;
|
|
7796
7862
|
}
|
|
7797
|
-
_optionalChain([this, 'access',
|
|
7863
|
+
_optionalChain([this, 'access', _532 => _532.remoteTarget, 'optionalAccess', _533 => _533.setMediaStream, 'call', _534 => _534(null)]);
|
|
7798
7864
|
return;
|
|
7799
7865
|
}
|
|
7800
7866
|
if (!track) {
|
|
@@ -7804,7 +7870,7 @@ var XmaxRealtimeConnectionManager = class {
|
|
|
7804
7870
|
);
|
|
7805
7871
|
}
|
|
7806
7872
|
track.mediaStreamTrack = binding.videoTrack;
|
|
7807
|
-
_optionalChain([this, 'access',
|
|
7873
|
+
_optionalChain([this, 'access', _535 => _535.remoteTarget, 'optionalAccess', _536 => _536.setMediaStream, 'call', _537 => _537(new MediaStream([binding.videoTrack]))]);
|
|
7808
7874
|
}
|
|
7809
7875
|
/**
|
|
7810
7876
|
* 为远端轨道注册渲染绑定:attach 时挂流占位,媒体轨到达后送入画面。
|
|
@@ -7817,7 +7883,7 @@ var XmaxRealtimeConnectionManager = class {
|
|
|
7817
7883
|
}
|
|
7818
7884
|
},
|
|
7819
7885
|
attachHandler: (view) => {
|
|
7820
|
-
_optionalChain([this, 'access',
|
|
7886
|
+
_optionalChain([this, 'access', _538 => _538.remoteTarget, 'optionalAccess', _539 => _539.setFrameInterpolation, 'optionalCall', _540 => _540(void 0)]);
|
|
7821
7887
|
view.isMirrored = false;
|
|
7822
7888
|
this.remoteTarget = view;
|
|
7823
7889
|
this.dependencies.onRenderAttached();
|
|
@@ -7829,7 +7895,7 @@ var XmaxRealtimeConnectionManager = class {
|
|
|
7829
7895
|
this.dependencies.onRenderDetached();
|
|
7830
7896
|
this.remoteTarget = void 0;
|
|
7831
7897
|
}
|
|
7832
|
-
_optionalChain([view, 'access',
|
|
7898
|
+
_optionalChain([view, 'access', _541 => _541.setFrameInterpolation, 'optionalCall', _542 => _542(void 0)]);
|
|
7833
7899
|
view.setMediaStream(null);
|
|
7834
7900
|
}
|
|
7835
7901
|
});
|
|
@@ -7879,7 +7945,7 @@ var XmaxRealtimeConnectionManager = class {
|
|
|
7879
7945
|
return;
|
|
7880
7946
|
}
|
|
7881
7947
|
if (next.provider !== "trtc" /* trtc */ && (force || !previous || previous.provider === "trtc" /* trtc */ || next.roomToken !== previous.roomToken)) {
|
|
7882
|
-
await this.dependencies.streamController.updateCredentials(next, _optionalChain([this, 'access',
|
|
7948
|
+
await this.dependencies.streamController.updateCredentials(next, _optionalChain([this, 'access', _543 => _543.credentialController, 'optionalAccess', _544 => _544.signal]));
|
|
7883
7949
|
if (version !== this.refreshVersion || this.activeSession !== current) return;
|
|
7884
7950
|
}
|
|
7885
7951
|
this.activeSession = new RealtimeSession({
|
|
@@ -7894,7 +7960,7 @@ var XmaxRealtimeConnectionManager = class {
|
|
|
7894
7960
|
* 尽力清理全部连接资源,即使退房失败也关闭服务端会话。
|
|
7895
7961
|
*/
|
|
7896
7962
|
async disconnect() {
|
|
7897
|
-
const sessionID = _optionalChain([this, 'access',
|
|
7963
|
+
const sessionID = _optionalChain([this, 'access', _545 => _545.activeSession, 'optionalAccess', _546 => _546.id]);
|
|
7898
7964
|
this.stopHeartbeat();
|
|
7899
7965
|
this.clearRemoteMedia();
|
|
7900
7966
|
try {
|
|
@@ -7966,6 +8032,15 @@ var XmaxRealtimeGenerationManager = class _XmaxRealtimeGenerationManager {
|
|
|
7966
8032
|
/**
|
|
7967
8033
|
* 发送生成指令并等待确认、远端就绪和音频激活,成功后返回任务标识。
|
|
7968
8034
|
* 条件上下文在生成确认后缓存;启动失败时尽力停止本次任务并保留原始错误。
|
|
8035
|
+
* @param options.videoFormat 模型生成使用的视频规格。
|
|
8036
|
+
* @param options.targetSize 服务端生成后的回传尺寸,缺省使用生成尺寸。
|
|
8037
|
+
* @param options.context 生成条件,缺省复用最近缓存的上下文。
|
|
8038
|
+
* @param options.faceRestoration 是否回贴原始人脸,默认 false。
|
|
8039
|
+
* @param options.mirror 是否由后端水平翻转输入,默认 false;仅用于 start 信令。
|
|
8040
|
+
* @param options.signal 取消本次生成启动的信号。
|
|
8041
|
+
* @param options.ensureCurrent 校验当前操作仍有效。
|
|
8042
|
+
* @param options.waitUntilRemoteReady 等待远端生成流就绪。
|
|
8043
|
+
* @param options.onStartSent start 信令发送成功后的可选异步回调。
|
|
7969
8044
|
*/
|
|
7970
8045
|
async start(options) {
|
|
7971
8046
|
const context = this.validateContext(options.context);
|
|
@@ -7979,6 +8054,7 @@ var XmaxRealtimeGenerationManager = class _XmaxRealtimeGenerationManager {
|
|
|
7979
8054
|
context,
|
|
7980
8055
|
...options.targetSize && { targetSize: options.targetSize },
|
|
7981
8056
|
mirror: _nullishCoalesce(options.mirror, () => ( false)),
|
|
8057
|
+
faceRestoration: _nullishCoalesce(options.faceRestoration, () => ( false)),
|
|
7982
8058
|
...options.onStartSent && { onStartSent: options.onStartSent }
|
|
7983
8059
|
});
|
|
7984
8060
|
await this.awaitConfirmation(confirmation, options.signal);
|
|
@@ -7996,6 +8072,11 @@ var XmaxRealtimeGenerationManager = class _XmaxRealtimeGenerationManager {
|
|
|
7996
8072
|
}
|
|
7997
8073
|
/**
|
|
7998
8074
|
* 更新活动任务的生成条件;信令发送成功后才覆盖缓存,无任务或上下文时抛错。
|
|
8075
|
+
* @param taskID 当前活动任务标识。
|
|
8076
|
+
* @param options.videoFormat 模型生成使用的视频规格。
|
|
8077
|
+
* @param options.targetSize 服务端生成后的回传尺寸。
|
|
8078
|
+
* @param options.context 生成条件,缺省复用最近缓存的上下文。
|
|
8079
|
+
* @param options.faceRestoration 是否回贴原始人脸,默认 false。
|
|
7999
8080
|
*/
|
|
8000
8081
|
async update(taskID, options) {
|
|
8001
8082
|
const context = _nullishCoalesce(options.context, () => ( this.currentContext));
|
|
@@ -8006,6 +8087,7 @@ var XmaxRealtimeGenerationManager = class _XmaxRealtimeGenerationManager {
|
|
|
8006
8087
|
taskID,
|
|
8007
8088
|
videoFormat: options.videoFormat,
|
|
8008
8089
|
context,
|
|
8090
|
+
faceRestoration: _nullishCoalesce(options.faceRestoration, () => ( false)),
|
|
8009
8091
|
...options.targetSize && { targetSize: options.targetSize }
|
|
8010
8092
|
});
|
|
8011
8093
|
if (this.activeTaskID !== taskID) throw RealtimeCoordinator.cancelledError();
|
|
@@ -8032,7 +8114,7 @@ var XmaxRealtimeGenerationManager = class _XmaxRealtimeGenerationManager {
|
|
|
8032
8114
|
try {
|
|
8033
8115
|
await completion;
|
|
8034
8116
|
} finally {
|
|
8035
|
-
if (_optionalChain([this, 'access',
|
|
8117
|
+
if (_optionalChain([this, 'access', _547 => _547.pendingStop, 'optionalAccess', _548 => _548.completion]) === completion) this.pendingStop = void 0;
|
|
8036
8118
|
}
|
|
8037
8119
|
}
|
|
8038
8120
|
/**
|
|
@@ -8117,6 +8199,9 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8117
8199
|
__publicField(this, "localVideoController", new LocalVideoController((error) => {
|
|
8118
8200
|
void this.coordinator.terminateWithError(error, 0 /* connection */);
|
|
8119
8201
|
}));
|
|
8202
|
+
__publicField(this, "externalVideoController", new ExternalVideoController((error) => {
|
|
8203
|
+
void this.coordinator.terminateWithError(error, 1 /* all */);
|
|
8204
|
+
}));
|
|
8120
8205
|
__publicField(this, "rtcManager");
|
|
8121
8206
|
/**
|
|
8122
8207
|
* 启动计时与首帧通知
|
|
@@ -8159,19 +8244,19 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8159
8244
|
this.options = options;
|
|
8160
8245
|
this.mediaService = new MediaService(options.model);
|
|
8161
8246
|
this.interpolationRequested = options.isFrameInterpolationEnabled;
|
|
8162
|
-
this.supportsInterpolation = _nullishCoalesce(_optionalChain([dependencies, 'optionalAccess',
|
|
8247
|
+
this.supportsInterpolation = _nullishCoalesce(_optionalChain([dependencies, 'optionalAccess', _549 => _549.supportsFrameInterpolation]), () => ( (async (size) => await frameInterpolationAdapter(size) !== null)));
|
|
8163
8248
|
this.errorHandler = new RealtimeErrorHandler();
|
|
8164
|
-
const rtcManager = _nullishCoalesce(_optionalChain([dependencies, 'optionalAccess',
|
|
8249
|
+
const rtcManager = _nullishCoalesce(_optionalChain([dependencies, 'optionalAccess', _550 => _550.rtcManager]), () => ( createRtcManager(options.provider, _nullishCoalesce(_optionalChain([dependencies, 'optionalAccess', _551 => _551.environment]), () => ( "china")) /* china */)));
|
|
8165
8250
|
this.rtcManager = rtcManager;
|
|
8166
|
-
this.cameraController = _nullishCoalesce(_optionalChain([dependencies, 'optionalAccess',
|
|
8251
|
+
this.cameraController = _nullishCoalesce(_optionalChain([dependencies, 'optionalAccess', _552 => _552.cameraController]), () => ( new CameraController({
|
|
8167
8252
|
rtcManager,
|
|
8168
8253
|
mediaService: this.mediaService,
|
|
8169
8254
|
errorListener: (error) => {
|
|
8170
8255
|
void this.errorHandler.report(error);
|
|
8171
8256
|
}
|
|
8172
8257
|
})));
|
|
8173
|
-
const sessionService = _nullishCoalesce(_optionalChain([dependencies, 'optionalAccess',
|
|
8174
|
-
this.streamController = _nullishCoalesce(_optionalChain([dependencies, 'optionalAccess',
|
|
8258
|
+
const sessionService = _nullishCoalesce(_optionalChain([dependencies, 'optionalAccess', _553 => _553.sessionService]), () => ( (_optionalChain([dependencies, 'optionalAccess', _554 => _554.apiService]) ? new RealtimeSessionService({ apiService: dependencies.apiService, provider: options.provider }) : void 0)));
|
|
8259
|
+
this.streamController = _nullishCoalesce(_optionalChain([dependencies, 'optionalAccess', _555 => _555.streamController]), () => ( new StreamController({
|
|
8175
8260
|
rtcManager,
|
|
8176
8261
|
onCredentialsRequired: () => {
|
|
8177
8262
|
void this.connectionManager.refreshCredentials();
|
|
@@ -8193,7 +8278,7 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8193
8278
|
onHeartbeatFailure: (sessionID, error) => {
|
|
8194
8279
|
void this.handleHeartbeatFailure(sessionID, error);
|
|
8195
8280
|
},
|
|
8196
|
-
onFrameDisplayed: () => _optionalChain([this, 'access',
|
|
8281
|
+
onFrameDisplayed: () => _optionalChain([this, 'access', _556 => _556.remoteFrameDisplayHandler, 'optionalCall', _557 => _557()]),
|
|
8197
8282
|
onRenderAttached: () => this.applyRemoteInterpolation(),
|
|
8198
8283
|
onRenderDetached: () => {
|
|
8199
8284
|
this.interpolationRevision++;
|
|
@@ -8211,7 +8296,7 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8211
8296
|
throw new XmaxError("CANCELLED" /* cancelled */, "Adaptive video format update was cancelled");
|
|
8212
8297
|
}
|
|
8213
8298
|
await this.coordinator.run("configuration" /* configuration */, void 0, async (token) => {
|
|
8214
|
-
const track =
|
|
8299
|
+
const track = this.currentUplinkTrack;
|
|
8215
8300
|
const state2 = track && this.qualityStates.get(track);
|
|
8216
8301
|
if (!track || !state2) throw new XmaxError("INVALID_CONFIGURATION" /* invalidConfiguration */, "Adaptive video baseline is unavailable");
|
|
8217
8302
|
const format = qualityVideoFormat(state2.baseline, change.to);
|
|
@@ -8220,7 +8305,7 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8220
8305
|
_nullishCoalesce(this.generationVideoFormat, () => ( (this.generationVideoFormat = state2.baseline)));
|
|
8221
8306
|
track.updateVideoFormat(format);
|
|
8222
8307
|
state2.level = change.to;
|
|
8223
|
-
_optionalChain([this, 'access',
|
|
8308
|
+
_optionalChain([this, 'access', _558 => _558.qualityHistory, 'optionalAccess', _559 => _559.write, 'call', _560 => _560("uplink", change.to)]);
|
|
8224
8309
|
});
|
|
8225
8310
|
});
|
|
8226
8311
|
this.downlinkQualityController = new QualityController(async (change, signal) => {
|
|
@@ -8266,7 +8351,7 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8266
8351
|
*/
|
|
8267
8352
|
async setFrameInterpolationEnabled(enabled) {
|
|
8268
8353
|
await this.coordinator.run("configuration" /* configuration */, void 0, async (token) => {
|
|
8269
|
-
const format = _nullishCoalesce(_nullishCoalesce(_optionalChain([this, 'access',
|
|
8354
|
+
const format = _nullishCoalesce(_nullishCoalesce(_optionalChain([this, 'access', _561 => _561.downlinkQualityState, 'optionalAccess', _562 => _562.size]), () => ( this.generationVideoFormat)), () => ( _optionalChain([this, 'access', _563 => _563.currentLocalTrack, 'optionalAccess', _564 => _564.videoFormat])));
|
|
8270
8355
|
const size = format && enabled ? this.mediaService.resolveFrameInterpolationSize(format) : void 0;
|
|
8271
8356
|
if (enabled && !await this.checkInterpolationSupport(size, token)) {
|
|
8272
8357
|
token.ensureCurrent();
|
|
@@ -8298,7 +8383,7 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8298
8383
|
const state2 = this.downlinkQualityState;
|
|
8299
8384
|
const ensureActive2 = () => {
|
|
8300
8385
|
token.ensureCurrent();
|
|
8301
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
8386
|
+
if (_optionalChain([signal, 'optionalAccess', _565 => _565.aborted]) || !state2 || state2 !== this.downlinkQualityState || this.currentState.connectionState !== "Generating" /* generating */ || this.currentState.taskID !== state2.taskID) {
|
|
8302
8387
|
throw new XmaxError("CANCELLED" /* cancelled */, "Target size update was cancelled");
|
|
8303
8388
|
}
|
|
8304
8389
|
};
|
|
@@ -8309,7 +8394,7 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8309
8394
|
ensureActive2();
|
|
8310
8395
|
state2.level = level;
|
|
8311
8396
|
state2.size = size;
|
|
8312
|
-
_optionalChain([this, 'access',
|
|
8397
|
+
_optionalChain([this, 'access', _566 => _566.qualityHistory, 'optionalAccess', _567 => _567.write, 'call', _568 => _568("downlink", level)]);
|
|
8313
8398
|
if (this.interpolationRequested) {
|
|
8314
8399
|
this.interpolationSize = size;
|
|
8315
8400
|
this.applyRemoteInterpolation();
|
|
@@ -8428,7 +8513,7 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8428
8513
|
*/
|
|
8429
8514
|
notifyRemoteVideoStatistics() {
|
|
8430
8515
|
try {
|
|
8431
|
-
void Promise.resolve(_optionalChain([this, 'access',
|
|
8516
|
+
void Promise.resolve(_optionalChain([this, 'access', _569 => _569.remoteVideoStatisticsListener, 'optionalCall', _570 => _570(this.remoteVideoStatistics)])).catch(() => {
|
|
8432
8517
|
});
|
|
8433
8518
|
} catch (e27) {
|
|
8434
8519
|
}
|
|
@@ -8445,7 +8530,7 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8445
8530
|
*/
|
|
8446
8531
|
notifyNetworkStatistics() {
|
|
8447
8532
|
try {
|
|
8448
|
-
void Promise.resolve(_optionalChain([this, 'access',
|
|
8533
|
+
void Promise.resolve(_optionalChain([this, 'access', _571 => _571.networkStatisticsListener, 'optionalCall', _572 => _572(this.networkStatistics)])).catch(() => {
|
|
8449
8534
|
});
|
|
8450
8535
|
} catch (e28) {
|
|
8451
8536
|
}
|
|
@@ -8465,7 +8550,7 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8465
8550
|
*/
|
|
8466
8551
|
notifyLocalVideoStatistics() {
|
|
8467
8552
|
try {
|
|
8468
|
-
void Promise.resolve(_optionalChain([this, 'access',
|
|
8553
|
+
void Promise.resolve(_optionalChain([this, 'access', _573 => _573.localVideoStatisticsListener, 'optionalCall', _574 => _574(this.localVideoStatistics)])).catch(() => {
|
|
8469
8554
|
});
|
|
8470
8555
|
} catch (e29) {
|
|
8471
8556
|
}
|
|
@@ -8474,8 +8559,8 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8474
8559
|
* 停止接收媒体统计并清空各类快照,仅对曾有数据的统计发出清空通知。
|
|
8475
8560
|
*/
|
|
8476
8561
|
clearVideoStatistics() {
|
|
8477
|
-
_optionalChain([this, 'access',
|
|
8478
|
-
_optionalChain([this, 'access',
|
|
8562
|
+
_optionalChain([this, 'access', _575 => _575.qualityController, 'optionalAccess', _576 => _576.stop, 'call', _577 => _577()]);
|
|
8563
|
+
_optionalChain([this, 'access', _578 => _578.downlinkQualityController, 'optionalAccess', _579 => _579.stop, 'call', _580 => _580()]);
|
|
8479
8564
|
this.downlinkQualityState = void 0;
|
|
8480
8565
|
this.adaptiveQualityRevision++;
|
|
8481
8566
|
this.acceptsVideoStatistics = false;
|
|
@@ -8523,6 +8608,9 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8523
8608
|
*
|
|
8524
8609
|
* 将返回的轨道绑定到预览视图;收到有效帧且视图已绑定后进入 `ready`。
|
|
8525
8610
|
*
|
|
8611
|
+
* @param options.videoFormat 旋转后的目标规格,尺寸按模型规则解析。
|
|
8612
|
+
* @param options.position 前置或后置摄像头。
|
|
8613
|
+
* @param options.useMicrophone 是否采集并发布麦克风音频。
|
|
8526
8614
|
* @param options.enableFrameValidation 是否在发布前等待相机预热(固定 200ms),默认 true;false 跳过等待。
|
|
8527
8615
|
* @param options.rotation 输入帧顺时针旋转角度,默认 0;videoFormat 为旋转后的规格,目前仅 Agora 支持非零角度。
|
|
8528
8616
|
* @returns 包含本地相机视频轨道的媒体流。
|
|
@@ -8544,7 +8632,7 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8544
8632
|
const completeCamera = this.launchTimer.startCamera();
|
|
8545
8633
|
this.clearVideoStatistics();
|
|
8546
8634
|
this.disposePermissionWatch();
|
|
8547
|
-
const permissionWatch = await watchMediaPermissionPrompt(_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
8635
|
+
const permissionWatch = await watchMediaPermissionPrompt(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _581 => _581.useMicrophone]), () => ( false)));
|
|
8548
8636
|
if (permissionWatch) {
|
|
8549
8637
|
const completePermission = this.launchTimer.startPermission();
|
|
8550
8638
|
void permissionWatch.decided.then(() => completePermission()).catch(() => {
|
|
@@ -8561,7 +8649,7 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8561
8649
|
throw error;
|
|
8562
8650
|
}
|
|
8563
8651
|
token.ensureCurrent();
|
|
8564
|
-
this.generationVideoFormat = _optionalChain([stream, 'access',
|
|
8652
|
+
this.generationVideoFormat = _optionalChain([stream, 'access', _582 => _582.videoTrack, 'optionalAccess', _583 => _583.videoFormat]);
|
|
8565
8653
|
completeCamera();
|
|
8566
8654
|
this.cameraController.setPreviewReadyHandler((isCurrent) => {
|
|
8567
8655
|
void this.coordinator.localPreviewDidBecomeReady(isCurrent);
|
|
@@ -8572,6 +8660,10 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8572
8660
|
}
|
|
8573
8661
|
/**
|
|
8574
8662
|
* 创建网络视频源并初始化接收端 RTC;预览是否加载成功不影响服务端读取视频。
|
|
8663
|
+
* @param options.url 服务端可直接访问的 HTTP/HTTPS 视频地址。
|
|
8664
|
+
* @param options.videoFormat 模型输入及生成画面规格,不是上行编码参数。
|
|
8665
|
+
* @param options.sampleMethod 服务端采样方式,默认 time。
|
|
8666
|
+
* @param options.onFinish 服务端完成当前任务后的回调,不代表尾帧已播放完。
|
|
8575
8667
|
*/
|
|
8576
8668
|
async createNetworkVideoStream(options) {
|
|
8577
8669
|
return this.coordinator.run("media" /* media */, void 0, async (token) => {
|
|
@@ -8582,13 +8674,17 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8582
8674
|
this.clearVideoStatistics();
|
|
8583
8675
|
await this.rtcManager.initialize();
|
|
8584
8676
|
token.ensureCurrent();
|
|
8585
|
-
this.generationVideoFormat = _optionalChain([stream, 'access',
|
|
8677
|
+
this.generationVideoFormat = _optionalChain([stream, 'access', _584 => _584.videoTrack, 'optionalAccess', _585 => _585.videoFormat]);
|
|
8586
8678
|
await this.coordinator.commit(new RealtimeState({ connectionState: "Ready" /* ready */ }), token);
|
|
8587
8679
|
return stream;
|
|
8588
8680
|
});
|
|
8589
8681
|
}
|
|
8590
8682
|
/**
|
|
8591
8683
|
* 创建文件音视频源并准备外部轨道;准备失败时统一释放本次媒体和 RTC 资源。
|
|
8684
|
+
* @param options.file 包含可解码视频的本地 File 或 Blob。
|
|
8685
|
+
* @param options.videoFormat 期望的视频规格;尺寸按宽高比匹配模型档位。
|
|
8686
|
+
* @param options.loop 是否循环播放,默认 true。
|
|
8687
|
+
* @param options.includeAudio 是否发送文件音频,默认 true。
|
|
8592
8688
|
*/
|
|
8593
8689
|
async createLocalVideoStream(options) {
|
|
8594
8690
|
return this.coordinator.run("media" /* media */, void 0, async (token) => {
|
|
@@ -8608,16 +8704,42 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8608
8704
|
audioTrack: this.localVideoController.audioTrack
|
|
8609
8705
|
});
|
|
8610
8706
|
token.ensureCurrent();
|
|
8611
|
-
this.generationVideoFormat = _optionalChain([stream, 'access',
|
|
8707
|
+
this.generationVideoFormat = _optionalChain([stream, 'access', _586 => _586.videoTrack, 'optionalAccess', _587 => _587.videoFormat]);
|
|
8612
8708
|
await this.coordinator.commit(new RealtimeState({ connectionState: "Ready" /* ready */ }), token);
|
|
8613
8709
|
return stream;
|
|
8614
8710
|
});
|
|
8615
8711
|
}
|
|
8616
8712
|
/**
|
|
8617
|
-
*
|
|
8713
|
+
* 接入外部视频轨;不创建采集设备或预览,所有异步失败统一释放 SDK 副本。
|
|
8714
|
+
* @param options.videoTrack 用户自行采集或处理的 live 视频轨,原始轨道归调用方所有。
|
|
8715
|
+
* @param options.videoFormat 期望的上传及生成规格,须符合模型规则;不代表修改输入像素。
|
|
8618
8716
|
*/
|
|
8717
|
+
async createExternalVideoStream(options) {
|
|
8718
|
+
return this.coordinator.run("media" /* media */, void 0, async (token) => {
|
|
8719
|
+
this.ensureNoLocalSource();
|
|
8720
|
+
if (!this.rtcManager.setExternalMediaTracks) {
|
|
8721
|
+
throw new XmaxError("INVALID_CONFIGURATION" /* invalidConfiguration */, "The RTC provider does not support external video streams");
|
|
8722
|
+
}
|
|
8723
|
+
const stream = this.externalVideoController.create(options, this.mediaService);
|
|
8724
|
+
token.setFailureScope(1 /* all */);
|
|
8725
|
+
this.launchTimer.start();
|
|
8726
|
+
this.clearVideoStatistics();
|
|
8727
|
+
await this.rtcManager.initialize();
|
|
8728
|
+
token.ensureCurrent();
|
|
8729
|
+
await this.rtcManager.setExternalMediaTracks({ videoTrack: stream.videoTrack.mediaStreamTrack });
|
|
8730
|
+
token.ensureCurrent();
|
|
8731
|
+
this.generationVideoFormat = _optionalChain([stream, 'access', _588 => _588.videoTrack, 'optionalAccess', _589 => _589.videoFormat]);
|
|
8732
|
+
await this.coordinator.commit(new RealtimeState({ connectionState: "Ready" /* ready */ }), token);
|
|
8733
|
+
return stream;
|
|
8734
|
+
});
|
|
8735
|
+
}
|
|
8736
|
+
/** 当前可发布的本地视频轨,不包含服务端直接读取的网络视频。 */
|
|
8737
|
+
get currentUplinkTrack() {
|
|
8738
|
+
return _nullishCoalesce(_nullishCoalesce(this.externalVideoController.currentTrack, () => ( this.localVideoController.currentTrack)), () => ( this.cameraController.currentTrack));
|
|
8739
|
+
}
|
|
8740
|
+
/** 当前 Manager 拥有的媒体源轨道。 */
|
|
8619
8741
|
get currentLocalTrack() {
|
|
8620
|
-
return _nullishCoalesce(
|
|
8742
|
+
return _nullishCoalesce(this.currentUplinkTrack, () => ( this.networkVideoController.currentTrack));
|
|
8621
8743
|
}
|
|
8622
8744
|
/**
|
|
8623
8745
|
* 创建前拒绝覆盖活动源,避免旧预览或连接资源被静默遗留。
|
|
@@ -8631,51 +8753,51 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8631
8753
|
* 移除媒体权限弹窗观察;授权决定已记录或不再需要观察时调用。
|
|
8632
8754
|
*/
|
|
8633
8755
|
disposePermissionWatch() {
|
|
8634
|
-
_optionalChain([this, 'access',
|
|
8756
|
+
_optionalChain([this, 'access', _590 => _590.permissionWatchDispose, 'optionalCall', _591 => _591()]);
|
|
8635
8757
|
this.permissionWatchDispose = void 0;
|
|
8636
8758
|
}
|
|
8637
8759
|
/**
|
|
8638
8760
|
* 应用完整的上行视频格式,成功后更新本地轨道元数据,不改变生成格式或生命周期。
|
|
8639
8761
|
* 复用配置操作准入,避免与建连、切换摄像头或其他配置更新并发。
|
|
8640
8762
|
*
|
|
8641
|
-
* @throws
|
|
8763
|
+
* @throws 无本地相机、外部或文件视频流、参数无效、操作冲突或底层编码更新失败时抛错。
|
|
8642
8764
|
*/
|
|
8643
8765
|
async updateUplinkVideoFormat(videoFormat) {
|
|
8644
8766
|
await this.coordinator.run("configuration" /* configuration */, void 0, async (token) => {
|
|
8645
|
-
const track =
|
|
8646
|
-
const previousFormat = _optionalChain([track, 'optionalAccess',
|
|
8767
|
+
const track = this.currentUplinkTrack;
|
|
8768
|
+
const previousFormat = _optionalChain([track, 'optionalAccess', _592 => _592.videoFormat]);
|
|
8647
8769
|
if (!track || !previousFormat) {
|
|
8648
|
-
throw new XmaxError("INVALID_CONFIGURATION" /* invalidConfiguration */, "Local camera or file video stream is not started");
|
|
8770
|
+
throw new XmaxError("INVALID_CONFIGURATION" /* invalidConfiguration */, "Local camera, external or file video stream is not started");
|
|
8649
8771
|
}
|
|
8650
8772
|
videoFormat.validate();
|
|
8651
|
-
_optionalChain([this, 'access',
|
|
8773
|
+
_optionalChain([this, 'access', _593 => _593.qualityController, 'optionalAccess', _594 => _594.stop, 'call', _595 => _595()]);
|
|
8652
8774
|
await this.streamController.updateUplinkVideoFormat(videoFormat);
|
|
8653
8775
|
token.ensureCurrent();
|
|
8654
8776
|
_nullishCoalesce(this.generationVideoFormat, () => ( (this.generationVideoFormat = previousFormat)));
|
|
8655
8777
|
track.updateVideoFormat(videoFormat);
|
|
8656
8778
|
this.qualityStates.set(track, { baseline: videoFormat, level: 1 });
|
|
8657
|
-
_optionalChain([this, 'access',
|
|
8779
|
+
_optionalChain([this, 'access', _596 => _596.qualityHistory, 'optionalAccess', _597 => _597.write, 'call', _598 => _598("uplink", 1)]);
|
|
8658
8780
|
});
|
|
8659
8781
|
}
|
|
8660
8782
|
/** 已连接时仅替换帧率;与其他配置及生命周期操作共享同一操作租约。 */
|
|
8661
8783
|
async updateUplinkFrameRate(fps) {
|
|
8662
8784
|
await this.coordinator.run("configuration" /* configuration */, void 0, async (token) => {
|
|
8663
|
-
_optionalChain([this, 'access',
|
|
8785
|
+
_optionalChain([this, 'access', _599 => _599.qualityController, 'optionalAccess', _600 => _600.stop, 'call', _601 => _601()]);
|
|
8664
8786
|
await this.applyUplinkFrameRate(fps, token);
|
|
8665
8787
|
const track = this.currentLocalTrack;
|
|
8666
|
-
if (_optionalChain([track, 'optionalAccess',
|
|
8788
|
+
if (_optionalChain([track, 'optionalAccess', _602 => _602.videoFormat])) {
|
|
8667
8789
|
this.qualityStates.set(track, { baseline: track.videoFormat, level: 1 });
|
|
8668
|
-
_optionalChain([this, 'access',
|
|
8790
|
+
_optionalChain([this, 'access', _603 => _603.qualityHistory, 'optionalAccess', _604 => _604.write, 'call', _605 => _605("uplink", 1)]);
|
|
8669
8791
|
}
|
|
8670
8792
|
});
|
|
8671
8793
|
}
|
|
8672
8794
|
/** 手动仅调帧接口,成功后的当前格式将成为新的自适应 L1 基准。 */
|
|
8673
8795
|
async applyUplinkFrameRate(fps, token) {
|
|
8674
|
-
const track =
|
|
8675
|
-
const previous = _optionalChain([track, 'optionalAccess',
|
|
8796
|
+
const track = this.currentUplinkTrack;
|
|
8797
|
+
const previous = _optionalChain([track, 'optionalAccess', _606 => _606.videoFormat]);
|
|
8676
8798
|
const state2 = this.currentState.connectionState;
|
|
8677
8799
|
if (!track || !previous || state2 !== "Connected" /* connected */ && state2 !== "Generating" /* generating */) {
|
|
8678
|
-
throw new XmaxError("INVALID_CONFIGURATION" /* invalidConfiguration */, "Frame rate updates require a connected local camera or file stream");
|
|
8800
|
+
throw new XmaxError("INVALID_CONFIGURATION" /* invalidConfiguration */, "Frame rate updates require a connected local camera, external or file stream");
|
|
8679
8801
|
}
|
|
8680
8802
|
if (!Number.isFinite(fps) || fps <= 0) {
|
|
8681
8803
|
throw new XmaxError("INVALID_CONFIGURATION" /* invalidConfiguration */, "Video frame rate must be greater than zero");
|
|
@@ -8702,7 +8824,7 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8702
8824
|
downlink.resetSamples();
|
|
8703
8825
|
return;
|
|
8704
8826
|
}
|
|
8705
|
-
const track =
|
|
8827
|
+
const track = this.currentUplinkTrack;
|
|
8706
8828
|
if (!track) {
|
|
8707
8829
|
controller.stop();
|
|
8708
8830
|
} else if (!controller.snapshot.active) {
|
|
@@ -8734,7 +8856,7 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8734
8856
|
* 停止本地相机流并释放本地预览与 RTC 资源。
|
|
8735
8857
|
*/
|
|
8736
8858
|
async stopLocalCameraStream() {
|
|
8737
|
-
if (this.networkVideoController.currentTrack || this.localVideoController.isActive) {
|
|
8859
|
+
if (this.networkVideoController.currentTrack || this.localVideoController.isActive || this.externalVideoController.currentTrack) {
|
|
8738
8860
|
return;
|
|
8739
8861
|
}
|
|
8740
8862
|
await this.coordinator.run(
|
|
@@ -8767,7 +8889,10 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8767
8889
|
"cameraSwitch" /* cameraSwitch */,
|
|
8768
8890
|
void 0,
|
|
8769
8891
|
async (token) => {
|
|
8770
|
-
|
|
8892
|
+
if (this.externalVideoController.currentTrack) {
|
|
8893
|
+
throw new XmaxError("INVALID_CONFIGURATION" /* invalidConfiguration */, "External video capture is managed by the caller");
|
|
8894
|
+
}
|
|
8895
|
+
_optionalChain([this, 'access', _607 => _607.qualityController, 'optionalAccess', _608 => _608.stop, 'call', _609 => _609()]);
|
|
8771
8896
|
const stream = await this.cameraController.switchCamera();
|
|
8772
8897
|
token.ensureCurrent();
|
|
8773
8898
|
return stream;
|
|
@@ -8781,7 +8906,7 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8781
8906
|
* 启用帧检测时,发布前并行等待相机预热(固定 200ms),避免把黑帧推给 RTC。
|
|
8782
8907
|
* 返回的远端媒体流在生成开始后承载远端生成画面。
|
|
8783
8908
|
*
|
|
8784
|
-
* @param localStream 由当前 Manager
|
|
8909
|
+
* @param localStream 由当前 Manager 创建的摄像头、外部视频轨、本地文件或网络视频源。
|
|
8785
8910
|
* @returns 远端生成结果占位的媒体流。
|
|
8786
8911
|
* @throws 本地流不属于当前 Manager、已有活动连接、会话创建或进房
|
|
8787
8912
|
* 发布失败时抛出错误;失败时自动释放连接资源并恢复本地预览。
|
|
@@ -8808,8 +8933,9 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8808
8933
|
* 尚未连接时先建立实时连接;已在生成时仅更新生成条件,不重启生成。
|
|
8809
8934
|
* 首次生成必须提供条件上下文,之后缺省时复用最近一次缓存的上下文。
|
|
8810
8935
|
*
|
|
8811
|
-
* @param options.localStream 由当前 Manager
|
|
8936
|
+
* @param options.localStream 由当前 Manager 创建的摄像头、外部视频轨、本地文件或网络视频源。
|
|
8812
8937
|
* @param options.context 本次生成使用的条件上下文;缺省时复用缓存。
|
|
8938
|
+
* @param options.faceRestoration 是否启用原始人脸回贴,默认 false;正在生成时通过 change_condition 更新。
|
|
8813
8939
|
* @returns 承载远端生成画面的媒体流。
|
|
8814
8940
|
* @throws 本地流不属于当前 Manager、缺少可用的条件上下文、信令发送
|
|
8815
8941
|
* 或生成确认失败时抛出错误;失败时自动停止生成任务并释放连接资源。
|
|
@@ -8837,7 +8963,8 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8837
8963
|
if (currentState.connectionState === "Generating" /* generating */) {
|
|
8838
8964
|
await this.generationManager.update(currentState.taskID, {
|
|
8839
8965
|
videoFormat,
|
|
8840
|
-
|
|
8966
|
+
faceRestoration: _nullishCoalesce(options.faceRestoration, () => ( false)),
|
|
8967
|
+
targetSize: this.downlinkQualityController ? _optionalChain([this, 'access', _610 => _610.downlinkQualityState, 'optionalAccess', _611 => _611.size]) : void 0,
|
|
8841
8968
|
context: options.context
|
|
8842
8969
|
});
|
|
8843
8970
|
token.ensureCurrent();
|
|
@@ -8852,7 +8979,7 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8852
8979
|
if (currentState.connectionState !== "Connected" /* connected */) {
|
|
8853
8980
|
await this.performConnect(options.localStream, token);
|
|
8854
8981
|
}
|
|
8855
|
-
return this.performStartGeneration(token, videoFormat, context);
|
|
8982
|
+
return this.performStartGeneration(token, videoFormat, context, _nullishCoalesce(options.faceRestoration, () => ( false)));
|
|
8856
8983
|
}
|
|
8857
8984
|
);
|
|
8858
8985
|
}
|
|
@@ -8911,7 +9038,7 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8911
9038
|
if (token.signal.aborted) abortWarmup();
|
|
8912
9039
|
try {
|
|
8913
9040
|
let beforePublish;
|
|
8914
|
-
if (
|
|
9041
|
+
if (localTrack === this.cameraController.currentTrack && this.cameraController.isFrameValidationEnabled) {
|
|
8915
9042
|
const cameraReady = this.cameraController.waitForValidCameraFrame(warmupController.signal).then(() => {
|
|
8916
9043
|
token.ensureCurrent();
|
|
8917
9044
|
});
|
|
@@ -8930,10 +9057,10 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8930
9057
|
_nullishCoalesce(this.generationVideoFormat, () => ( (this.generationVideoFormat = initialQuality.baseline)));
|
|
8931
9058
|
localTrack.updateVideoFormat(initialFormat);
|
|
8932
9059
|
this.qualityStates.set(localTrack, initialQuality);
|
|
8933
|
-
_optionalChain([this, 'access',
|
|
9060
|
+
_optionalChain([this, 'access', _612 => _612.qualityHistory, 'optionalAccess', _613 => _613.write, 'call', _614 => _614("uplink", initialQuality.level)]);
|
|
8934
9061
|
},
|
|
8935
9062
|
model: this.options.model,
|
|
8936
|
-
includeLocalAudio: this.localVideoController.isActive ? this.localVideoController.audioTrack !== void 0 :
|
|
9063
|
+
includeLocalAudio: this.localVideoController.isActive ? this.localVideoController.audioTrack !== void 0 : localTrack === this.cameraController.currentTrack && this.cameraController.useMicrophone,
|
|
8937
9064
|
publishLocalMedia: !this.networkVideoController.currentTrack,
|
|
8938
9065
|
ensureCurrent: () => token.ensureCurrent(),
|
|
8939
9066
|
onPublished: () => {
|
|
@@ -8957,9 +9084,9 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8957
9084
|
/**
|
|
8958
9085
|
* 编排插帧、首帧计时和生成状态,任务与确认由生成管理器负责。
|
|
8959
9086
|
*/
|
|
8960
|
-
async performStartGeneration(token, videoFormat, context) {
|
|
9087
|
+
async performStartGeneration(token, videoFormat, context, faceRestoration) {
|
|
8961
9088
|
token.setFailureScope(0 /* connection */);
|
|
8962
|
-
const initialLevel = _nullishCoalesce(_optionalChain([this, 'access',
|
|
9089
|
+
const initialLevel = _nullishCoalesce(_optionalChain([this, 'access', _615 => _615.qualityHistory, 'optionalAccess', _616 => _616.read, 'call', _617 => _617("downlink")]), () => ( 1));
|
|
8963
9090
|
const targetSize = this.downlinkQualityController ? qualityVideoSize(videoFormat, initialLevel) : void 0;
|
|
8964
9091
|
await this.prepareFrameInterpolation(_nullishCoalesce(targetSize, () => ( videoFormat)), token);
|
|
8965
9092
|
const completeFirstFrame = this.launchTimer.startFirstFrame();
|
|
@@ -8970,7 +9097,8 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8970
9097
|
videoFormat,
|
|
8971
9098
|
targetSize,
|
|
8972
9099
|
context,
|
|
8973
|
-
|
|
9100
|
+
faceRestoration,
|
|
9101
|
+
mirror: this.currentLocalTrack === this.cameraController.currentTrack && _optionalChain([this, 'access', _618 => _618.cameraController, 'access', _619 => _619.currentTrack, 'optionalAccess', _620 => _620.position]) === "front" /* front */,
|
|
8974
9102
|
signal: token.signal,
|
|
8975
9103
|
ensureCurrent: () => token.ensureCurrent(),
|
|
8976
9104
|
onStartSent: this.localVideoController.isActive ? async () => {
|
|
@@ -8987,7 +9115,7 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8987
9115
|
if (!sessionID) {
|
|
8988
9116
|
throw new XmaxError("SESSION_ERROR" /* sessionError */, "Realtime session is unavailable");
|
|
8989
9117
|
}
|
|
8990
|
-
_optionalChain([this, 'access',
|
|
9118
|
+
_optionalChain([this, 'access', _621 => _621.downlinkQualityController, 'optionalAccess', _622 => _622.stop, 'call', _623 => _623()]);
|
|
8991
9119
|
this.downlinkQualityState = {
|
|
8992
9120
|
taskID,
|
|
8993
9121
|
baseline: videoFormat,
|
|
@@ -8998,7 +9126,7 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
8998
9126
|
new RealtimeState({ connectionState: "Generating" /* generating */, sessionID, taskID }),
|
|
8999
9127
|
token
|
|
9000
9128
|
);
|
|
9001
|
-
_optionalChain([this, 'access',
|
|
9129
|
+
_optionalChain([this, 'access', _624 => _624.qualityHistory, 'optionalAccess', _625 => _625.write, 'call', _626 => _626("downlink", initialLevel)]);
|
|
9002
9130
|
const onFinish = this.networkVideoController.onFinish;
|
|
9003
9131
|
if (this.networkVideoController.currentTrack) {
|
|
9004
9132
|
this.streamController.activateNetworkVideoCompletion(onFinish && (() => {
|
|
@@ -9034,12 +9162,12 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
9034
9162
|
await this.generationManager.reset(taskID);
|
|
9035
9163
|
const sessionID = await this.connectionManager.disconnect();
|
|
9036
9164
|
if (scope === 1 /* all */) {
|
|
9037
|
-
const
|
|
9165
|
+
const hadExternalSource = this.networkVideoController.currentTrack !== void 0 || this.localVideoController.isActive || this.externalVideoController.currentTrack !== void 0;
|
|
9038
9166
|
this.networkVideoController.stop();
|
|
9039
9167
|
this.generationVideoFormat = void 0;
|
|
9040
9168
|
this.disposePermissionWatch();
|
|
9041
9169
|
try {
|
|
9042
|
-
if (
|
|
9170
|
+
if (hadExternalSource) {
|
|
9043
9171
|
await this.rtcManager.destroy();
|
|
9044
9172
|
} else {
|
|
9045
9173
|
await this.cameraController.stopLocalCameraStream();
|
|
@@ -9050,6 +9178,7 @@ var XmaxRealtimeManager = class _XmaxRealtimeManager {
|
|
|
9050
9178
|
\u2514\u2500 ${XmaxLogger.localized("\u539F\u56E0\uFF1A", "Reason: ")}${XmaxError.from(error).message}`
|
|
9051
9179
|
);
|
|
9052
9180
|
} finally {
|
|
9181
|
+
this.externalVideoController.stop();
|
|
9053
9182
|
if (this.localVideoController.isActive) {
|
|
9054
9183
|
await this.localVideoController.stop();
|
|
9055
9184
|
}
|
|
@@ -9150,7 +9279,7 @@ var NonRealtimeTaskService = class {
|
|
|
9150
9279
|
* 提交一次任务;请求结果不确定时也不自动重试,以免重复扣费。
|
|
9151
9280
|
*/
|
|
9152
9281
|
async submitTask(options) {
|
|
9153
|
-
const model = _optionalChain([options, 'access',
|
|
9282
|
+
const model = _optionalChain([options, 'access', _627 => _627.model, 'optionalAccess', _628 => _628.trim, 'call', _629 => _629()]);
|
|
9154
9283
|
if (!model) {
|
|
9155
9284
|
invalid("Model must not be empty");
|
|
9156
9285
|
}
|
|
@@ -9290,7 +9419,7 @@ function parseTask(value) {
|
|
|
9290
9419
|
const uid = field(data, "uid", "string");
|
|
9291
9420
|
const status = field(data, "status", "string");
|
|
9292
9421
|
const quality = field(data, "quality", "string");
|
|
9293
|
-
if (!_optionalChain([uid, 'optionalAccess',
|
|
9422
|
+
if (!_optionalChain([uid, 'optionalAccess', _630 => _630.trim, 'call', _631 => _631()]) || !Object.values(NonRealtimeTaskStatus).includes(status)) {
|
|
9294
9423
|
malformed("Missing task UID or invalid status");
|
|
9295
9424
|
}
|
|
9296
9425
|
if (quality !== void 0 && !Object.values(NonRealtimeQuality).includes(quality)) {
|
|
@@ -9372,7 +9501,7 @@ var XmaxNonRealtimeManager = class {
|
|
|
9372
9501
|
* 取得任务快照,不把服务端失败终态当成查询失败。
|
|
9373
9502
|
*/
|
|
9374
9503
|
getTask(taskUid, options) {
|
|
9375
|
-
return this.tasks.getTask(taskUid, _optionalChain([options, 'optionalAccess',
|
|
9504
|
+
return this.tasks.getTask(taskUid, _optionalChain([options, 'optionalAccess', _632 => _632.signal]));
|
|
9376
9505
|
}
|
|
9377
9506
|
/**
|
|
9378
9507
|
* 批量取得任务快照。
|
|
@@ -9406,8 +9535,8 @@ var XmaxNonRealtimeManager = class {
|
|
|
9406
9535
|
const controller = new AbortController();
|
|
9407
9536
|
let timedOut = false;
|
|
9408
9537
|
const abort = () => controller.abort();
|
|
9409
|
-
_optionalChain([options, 'access',
|
|
9410
|
-
if (_optionalChain([options, 'access',
|
|
9538
|
+
_optionalChain([options, 'access', _633 => _633.signal, 'optionalAccess', _634 => _634.addEventListener, 'call', _635 => _635("abort", abort, { once: true })]);
|
|
9539
|
+
if (_optionalChain([options, 'access', _636 => _636.signal, 'optionalAccess', _637 => _637.aborted])) {
|
|
9411
9540
|
abort();
|
|
9412
9541
|
}
|
|
9413
9542
|
const timer = options.timeoutMs === void 0 ? void 0 : setTimeout(() => {
|
|
@@ -9433,7 +9562,7 @@ var XmaxNonRealtimeManager = class {
|
|
|
9433
9562
|
ensureActive(controller.signal);
|
|
9434
9563
|
failures = 0;
|
|
9435
9564
|
try {
|
|
9436
|
-
void Promise.resolve(_optionalChain([options, 'access',
|
|
9565
|
+
void Promise.resolve(_optionalChain([options, 'access', _638 => _638.onTaskUpdated, 'optionalCall', _639 => _639(task)])).catch(() => {
|
|
9437
9566
|
});
|
|
9438
9567
|
} catch (e31) {
|
|
9439
9568
|
}
|
|
@@ -9463,7 +9592,7 @@ var XmaxNonRealtimeManager = class {
|
|
|
9463
9592
|
throw error;
|
|
9464
9593
|
} finally {
|
|
9465
9594
|
clearTimeout(timer);
|
|
9466
|
-
_optionalChain([options, 'access',
|
|
9595
|
+
_optionalChain([options, 'access', _640 => _640.signal, 'optionalAccess', _641 => _641.removeEventListener, 'call', _642 => _642("abort", abort)]);
|
|
9467
9596
|
}
|
|
9468
9597
|
}
|
|
9469
9598
|
};
|
|
@@ -9507,7 +9636,7 @@ function isTransient(error) {
|
|
|
9507
9636
|
}
|
|
9508
9637
|
function isResultAvailable(task) {
|
|
9509
9638
|
const result = task.result;
|
|
9510
|
-
if (!_optionalChain([result, 'optionalAccess',
|
|
9639
|
+
if (!_optionalChain([result, 'optionalAccess', _643 => _643.url, 'optionalAccess', _644 => _644.trim, 'call', _645 => _645()]) || _optionalChain([result, 'access', _646 => _646.uploadError, 'optionalAccess', _647 => _647.trim, 'call', _648 => _648()]) || result.uploadStatus !== void 0 && result.uploadStatus !== "success") {
|
|
9511
9640
|
return false;
|
|
9512
9641
|
}
|
|
9513
9642
|
try {
|
|
@@ -9771,7 +9900,7 @@ var RenderStatisticsController = class {
|
|
|
9771
9900
|
*/
|
|
9772
9901
|
notify(statistics) {
|
|
9773
9902
|
try {
|
|
9774
|
-
_optionalChain([this, 'access',
|
|
9903
|
+
_optionalChain([this, 'access', _649 => _649.handler, 'optionalCall', _650 => _650(statistics)]);
|
|
9775
9904
|
} catch (e33) {
|
|
9776
9905
|
}
|
|
9777
9906
|
}
|
|
@@ -11899,11 +12028,11 @@ var _FrameInterpolationManager = class _FrameInterpolationManager {
|
|
|
11899
12028
|
if (this.destroyed) return;
|
|
11900
12029
|
this.destroyed = true;
|
|
11901
12030
|
this.device.removeEventListener("uncapturederror", this.onGPUError);
|
|
11902
|
-
_optionalChain([this, 'access',
|
|
12031
|
+
_optionalChain([this, 'access', _651 => _651.runtime, 'optionalAccess', _652 => _652.destroy, 'call', _653 => _653()]);
|
|
11903
12032
|
this.runtime = void 0;
|
|
11904
12033
|
this.textures.forEach((texture) => texture.destroy());
|
|
11905
12034
|
this.textures = [];
|
|
11906
|
-
_optionalChain([this, 'access',
|
|
12035
|
+
_optionalChain([this, 'access', _654 => _654.context, 'optionalAccess', _655 => _655.unconfigure, 'call', _656 => _656()]);
|
|
11907
12036
|
this.device.destroy();
|
|
11908
12037
|
}
|
|
11909
12038
|
};
|
|
@@ -12080,7 +12209,7 @@ var RemoteVideoFramePipeline = class {
|
|
|
12080
12209
|
this.displayedTime = frame.time;
|
|
12081
12210
|
this.canvas.style.visibility = "visible";
|
|
12082
12211
|
this.setActive(true);
|
|
12083
|
-
_optionalChain([this, 'access',
|
|
12212
|
+
_optionalChain([this, 'access', _657 => _657.options, 'access', _658 => _658.onFramePresented, 'optionalCall', _659 => _659(_nullishCoalesce(frame.interpolated, () => ( false)))]);
|
|
12084
12213
|
}
|
|
12085
12214
|
async initialize() {
|
|
12086
12215
|
this.loading = true;
|
|
@@ -12108,7 +12237,7 @@ var RemoteVideoFramePipeline = class {
|
|
|
12108
12237
|
setActive(active) {
|
|
12109
12238
|
if (active === this.active) return;
|
|
12110
12239
|
this.active = active;
|
|
12111
|
-
_optionalChain([this, 'access',
|
|
12240
|
+
_optionalChain([this, 'access', _660 => _660.options, 'access', _661 => _661.onActiveChange, 'optionalCall', _662 => _662(active)]);
|
|
12112
12241
|
}
|
|
12113
12242
|
resetTimeline(preserveGpuTimeout = false) {
|
|
12114
12243
|
this.generation++;
|
|
@@ -12141,7 +12270,7 @@ var RemoteVideoFramePipeline = class {
|
|
|
12141
12270
|
this.callback = void 0;
|
|
12142
12271
|
clearTimeout(this.initializationTimer);
|
|
12143
12272
|
this.resetTimeline();
|
|
12144
|
-
_optionalChain([this, 'access',
|
|
12273
|
+
_optionalChain([this, 'access', _663 => _663.processor, 'optionalAccess', _664 => _664.destroy, 'call', _665 => _665()]);
|
|
12145
12274
|
this.processor = void 0;
|
|
12146
12275
|
}
|
|
12147
12276
|
};
|
|
@@ -12203,7 +12332,7 @@ var XmaxVideoView = class {
|
|
|
12203
12332
|
* DOM 挂载状态
|
|
12204
12333
|
*/
|
|
12205
12334
|
__publicField(this, "detached", false);
|
|
12206
|
-
this.contentMode = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
12335
|
+
this.contentMode = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _666 => _666.videoContentMode]), () => ( "fill")) /* fill */;
|
|
12207
12336
|
this.element = document.createElement("div");
|
|
12208
12337
|
this.element.style.position = "relative";
|
|
12209
12338
|
this.element.style.overflow = "hidden";
|
|
@@ -12388,11 +12517,11 @@ var XmaxVideoView = class {
|
|
|
12388
12517
|
...options,
|
|
12389
12518
|
onActiveChange: (active) => {
|
|
12390
12519
|
this.statisticsController.setInterpolationActive(active);
|
|
12391
|
-
_optionalChain([options, 'access',
|
|
12520
|
+
_optionalChain([options, 'access', _667 => _667.onActiveChange, 'optionalCall', _668 => _668(active)]);
|
|
12392
12521
|
},
|
|
12393
12522
|
onFramePresented: (interpolated) => {
|
|
12394
12523
|
this.statisticsController.recordCanvasFrame(interpolated);
|
|
12395
|
-
_optionalChain([options, 'access',
|
|
12524
|
+
_optionalChain([options, 'access', _669 => _669.onFramePresented, 'optionalCall', _670 => _670(interpolated)]);
|
|
12396
12525
|
}
|
|
12397
12526
|
});
|
|
12398
12527
|
this.interpolationPipeline = pipeline;
|
|
@@ -12404,8 +12533,8 @@ var XmaxVideoView = class {
|
|
|
12404
12533
|
stopInterpolation() {
|
|
12405
12534
|
const pipeline = this.interpolationPipeline;
|
|
12406
12535
|
this.interpolationPipeline = void 0;
|
|
12407
|
-
_optionalChain([pipeline, 'optionalAccess',
|
|
12408
|
-
_optionalChain([this, 'access',
|
|
12536
|
+
_optionalChain([pipeline, 'optionalAccess', _671 => _671.stop, 'call', _672 => _672()]);
|
|
12537
|
+
_optionalChain([this, 'access', _673 => _673.interpolationCanvas, 'optionalAccess', _674 => _674.remove, 'call', _675 => _675()]);
|
|
12409
12538
|
this.interpolationCanvas = void 0;
|
|
12410
12539
|
}
|
|
12411
12540
|
/**
|
|
@@ -12432,7 +12561,7 @@ var XmaxVideoView = class {
|
|
|
12432
12561
|
this.statisticsController.stop();
|
|
12433
12562
|
const track = this.currentTrack;
|
|
12434
12563
|
if (track) {
|
|
12435
|
-
_optionalChain([VideoRenderRegistry, 'access',
|
|
12564
|
+
_optionalChain([VideoRenderRegistry, 'access', _676 => _676.binding, 'call', _677 => _677(track), 'optionalAccess', _678 => _678.detachHandler, 'call', _679 => _679(this)]);
|
|
12436
12565
|
}
|
|
12437
12566
|
this.setFrameInterpolation(void 0);
|
|
12438
12567
|
this.cancelFrameDisplayNotification();
|
|
@@ -12455,8 +12584,8 @@ var XmaxVideoView = class {
|
|
|
12455
12584
|
}
|
|
12456
12585
|
this.hasNotifiedFrameDisplay = true;
|
|
12457
12586
|
this.cancelFrameDisplayNotification();
|
|
12458
|
-
_optionalChain([binding, 'optionalAccess',
|
|
12459
|
-
_optionalChain([this, 'access',
|
|
12587
|
+
_optionalChain([binding, 'optionalAccess', _680 => _680.frameDisplayHandler, 'optionalCall', _681 => _681()]);
|
|
12588
|
+
_optionalChain([this, 'access', _682 => _682.frameDisplayHandler, 'optionalCall', _683 => _683()]);
|
|
12460
12589
|
};
|
|
12461
12590
|
if (typeof this.videoElement.requestVideoFrameCallback === "function") {
|
|
12462
12591
|
this.videoFrameCallbackID = this.videoElement.requestVideoFrameCallback(notify);
|
|
@@ -12532,9 +12661,9 @@ var XmaxRealtimeVideoView = class {
|
|
|
12532
12661
|
__publicField(this, "currentLocalTrack");
|
|
12533
12662
|
__publicField(this, "currentRemoteTrack");
|
|
12534
12663
|
__publicField(this, "contentMode");
|
|
12535
|
-
this.contentMode = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
12536
|
-
this.currentLocalTrack = _optionalChain([options, 'optionalAccess',
|
|
12537
|
-
this.currentRemoteTrack = _optionalChain([options, 'optionalAccess',
|
|
12664
|
+
this.contentMode = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _684 => _684.videoContentMode]), () => ( "fill")) /* fill */;
|
|
12665
|
+
this.currentLocalTrack = _optionalChain([options, 'optionalAccess', _685 => _685.localTrack]);
|
|
12666
|
+
this.currentRemoteTrack = _optionalChain([options, 'optionalAccess', _686 => _686.remoteTrack]);
|
|
12538
12667
|
this.element = document.createElement("div");
|
|
12539
12668
|
this.element.style.position = "relative";
|
|
12540
12669
|
this.element.style.overflow = "hidden";
|
|
@@ -12700,4 +12829,4 @@ var XmaxRealtimeVideoView = class {
|
|
|
12700
12829
|
|
|
12701
12830
|
|
|
12702
12831
|
exports.XmaxEnvironment = XmaxEnvironment; exports.apiBaseURL = apiBaseURL; exports.XmaxLoggerOption = XmaxLoggerOption; exports.XmaxLogger = XmaxLogger; exports.XmaxErrorCode = XmaxErrorCode; exports.XmaxError = XmaxError; exports.RealtimeVideoEncoderPreference = RealtimeVideoEncoderPreference; exports.RealtimeVideoFormat = RealtimeVideoFormat; exports.RtcProvider = RtcProvider; exports.RealtimeModel = RealtimeModel; exports.modelDisplayName = modelDisplayName; exports.defaultFrameRate = defaultFrameRate; exports.defaultCameraVideoFormat = defaultCameraVideoFormat; exports.supportedRtcProviders = supportedRtcProviders; exports.MediaService = MediaService; exports.StoredFile = StoredFile; exports.StorageService = StorageService; exports.CameraPosition = CameraPosition; exports.RealtimeVideoTrack = RealtimeVideoTrack; exports.RealtimeMediaStream = RealtimeMediaStream; exports.RealtimeVideoSampleMethod = RealtimeVideoSampleMethod; exports.RealtimeContext = RealtimeContext; exports.RealtimeConnectionState = RealtimeConnectionState; exports.RealtimeReason = RealtimeReason; exports.RealtimeState = RealtimeState; exports.XmaxConfiguration = XmaxConfiguration; exports.NonRealtimeQuality = NonRealtimeQuality; exports.NonRealtimeTaskStatus = NonRealtimeTaskStatus; exports.NonRealtimeTaskError = NonRealtimeTaskError; exports.XmaxClient = XmaxClient; exports.RealtimeConfiguration = RealtimeConfiguration; exports.VideoContentMode = VideoContentMode; exports.XmaxVideoView = XmaxVideoView; exports.XmaxRealtimeVideoView = XmaxRealtimeVideoView;
|
|
12703
|
-
//# sourceMappingURL=chunk-
|
|
12832
|
+
//# sourceMappingURL=chunk-24VPU65T.cjs.map
|