call-live-sdk1 0.0.3 → 0.0.5
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/call-live-sdk.es.js
CHANGED
|
@@ -25612,23 +25612,23 @@ var GlobalErrorType = /* @__PURE__ */ ((GlobalErrorType2) => {
|
|
|
25612
25612
|
})(GlobalErrorType || {});
|
|
25613
25613
|
const envConfig = {
|
|
25614
25614
|
callConfig: {
|
|
25615
|
-
el: envConfig$1.env === "
|
|
25616
|
-
sign: envConfig$1.env === "
|
|
25617
|
-
liveId: envConfig$1.env === "
|
|
25618
|
-
title: envConfig$1.env === "
|
|
25615
|
+
el: envConfig$1.env === "dev" ? "root" : "",
|
|
25616
|
+
sign: envConfig$1.env === "dev" ? "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlZGl0aW9uX2lkIjo0NywiZXhwIjoxNzY3NTgyODExLCJpYXQiOjE3NjY5NzgwMTEsIm5iZiI6MTc2Njk3ODAxMSwic3ViX3VzZXJpZCI6MCwidXNlcmlkIjoiMzg3MzU5ODkifQ.lB9hFdxAJUGt4eg9WugAlkyIWhPayqcOI15x1DToQFo" : "",
|
|
25617
|
+
liveId: envConfig$1.env === "dev" ? 60974 : null,
|
|
25618
|
+
title: envConfig$1.env === "dev" ? "test" : "菲耀直播",
|
|
25619
25619
|
components: {
|
|
25620
25620
|
chat: { enabled: true },
|
|
25621
25621
|
team: { enabled: true },
|
|
25622
25622
|
call: { enabled: true, inviteLink: "" }
|
|
25623
25623
|
},
|
|
25624
|
-
agentId: envConfig$1.env === "
|
|
25624
|
+
agentId: envConfig$1.env === "dev" ? 38735989 : null,
|
|
25625
25625
|
apiDomain: envConfig$1.liveProxyUrl
|
|
25626
25626
|
},
|
|
25627
25627
|
guestConfig: {
|
|
25628
25628
|
el: "",
|
|
25629
|
-
sign: envConfig$1.env === "
|
|
25630
|
-
liveId: envConfig$1.env === "
|
|
25631
|
-
agentId: envConfig$1.env === "
|
|
25629
|
+
sign: envConfig$1.env === "dev" ? "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlZGl0aW9uX2lkIjo0NywiZXhwIjoxNzY2OTg2NDY2LCJpYXQiOjE3NjYzODE2NjYsIm5iZiI6MTc2NjM4MTY2Niwic3ViX3VzZXJpZCI6MCwidXNlcmlkIjoiMzg3MzU5ODkifQ.PoX2zUuJycp_Qt8obbKNO1m6GcAWBYklaeIi2IgxnEI" : "",
|
|
25630
|
+
liveId: envConfig$1.env === "dev" ? null : 60974,
|
|
25631
|
+
agentId: envConfig$1.env === "dev" ? null : 38735989,
|
|
25632
25632
|
apiDomain: envConfig$1.liveProxyUrl
|
|
25633
25633
|
},
|
|
25634
25634
|
styleConfig: {
|
|
@@ -46581,7 +46581,7 @@ const errorConfig = {
|
|
|
46581
46581
|
}
|
|
46582
46582
|
};
|
|
46583
46583
|
const map$d = {
|
|
46584
|
-
production: useSdkStore.getState().getApiDomain(),
|
|
46584
|
+
production: useSdkStore.getState().getApiDomain() || envConfig$1.liveProxyUrl,
|
|
46585
46585
|
test: envConfig$1.liveProxyUrl,
|
|
46586
46586
|
dev: ""
|
|
46587
46587
|
};
|
|
@@ -82401,6 +82401,259 @@ const useGuestStore = create$c()((set3, get4) => ({
|
|
|
82401
82401
|
set3({ status });
|
|
82402
82402
|
}
|
|
82403
82403
|
}));
|
|
82404
|
+
const calculateAspectRatio = (area) => {
|
|
82405
|
+
const targetAspectRatio = 16 / 9;
|
|
82406
|
+
const currentAspectRatio = area.width / area.height;
|
|
82407
|
+
let drawWidth = area.width;
|
|
82408
|
+
let drawHeight = area.height;
|
|
82409
|
+
let drawX = area.x;
|
|
82410
|
+
let drawY = area.y;
|
|
82411
|
+
if (currentAspectRatio > targetAspectRatio) {
|
|
82412
|
+
drawWidth = area.height * targetAspectRatio;
|
|
82413
|
+
drawX = area.x + (area.width - drawWidth) / 2;
|
|
82414
|
+
} else {
|
|
82415
|
+
drawHeight = area.width / targetAspectRatio;
|
|
82416
|
+
drawY = area.y + (area.height - drawHeight) / 2;
|
|
82417
|
+
}
|
|
82418
|
+
return { drawX, drawY, drawWidth, drawHeight };
|
|
82419
|
+
};
|
|
82420
|
+
const prepareOffscreenCanvas = (targetCanvas, get4, set3) => {
|
|
82421
|
+
let offscreenCanvas = get4().offscreenCanvasRef;
|
|
82422
|
+
let offscreenContext = get4().offscreenContextRef;
|
|
82423
|
+
if (!offscreenCanvas || offscreenCanvas.width !== targetCanvas.width || offscreenCanvas.height !== targetCanvas.height) {
|
|
82424
|
+
offscreenCanvas = document.createElement("canvas");
|
|
82425
|
+
offscreenCanvas.width = targetCanvas.width;
|
|
82426
|
+
offscreenCanvas.height = targetCanvas.height;
|
|
82427
|
+
offscreenContext = offscreenCanvas.getContext("2d");
|
|
82428
|
+
set3({
|
|
82429
|
+
offscreenCanvasRef: offscreenCanvas,
|
|
82430
|
+
offscreenContextRef: offscreenContext
|
|
82431
|
+
});
|
|
82432
|
+
}
|
|
82433
|
+
return offscreenCanvas;
|
|
82434
|
+
};
|
|
82435
|
+
const renderGridLayout = (ctx2, canvas, layout, get4) => {
|
|
82436
|
+
if (layout.callAreas && layout.callAreas.length > 0) {
|
|
82437
|
+
layout.callAreas.forEach((area) => {
|
|
82438
|
+
const { drawX, drawY, drawWidth, drawHeight } = calculateAspectRatio(area);
|
|
82439
|
+
ctx2.fillStyle = "rgba(26, 26, 26, 0.8)";
|
|
82440
|
+
ctx2.fillRect(drawX, drawY, drawWidth, drawHeight);
|
|
82441
|
+
ctx2.strokeStyle = "rgba(51, 51, 51, 0.6)";
|
|
82442
|
+
ctx2.lineWidth = 2;
|
|
82443
|
+
ctx2.strokeRect(drawX, drawY, drawWidth, drawHeight);
|
|
82444
|
+
if (!area.isVideoEnabled && area.domId.includes("screen")) {
|
|
82445
|
+
get4().renderEmptyUserArea(ctx2, area, drawX, drawY, drawWidth, drawHeight);
|
|
82446
|
+
} else {
|
|
82447
|
+
const container = document.getElementById(area.domId);
|
|
82448
|
+
if (container) {
|
|
82449
|
+
const videoElement = container.querySelector("video");
|
|
82450
|
+
if (videoElement) {
|
|
82451
|
+
get4().drawUserVideoContent(
|
|
82452
|
+
ctx2,
|
|
82453
|
+
videoElement,
|
|
82454
|
+
area,
|
|
82455
|
+
drawX,
|
|
82456
|
+
drawY,
|
|
82457
|
+
drawWidth,
|
|
82458
|
+
drawHeight
|
|
82459
|
+
);
|
|
82460
|
+
}
|
|
82461
|
+
}
|
|
82462
|
+
get4().drawUserInfo(ctx2, area, drawX, drawY, drawWidth, drawHeight);
|
|
82463
|
+
get4().drawStatusIndicators(ctx2, area, drawX, drawY, drawWidth);
|
|
82464
|
+
}
|
|
82465
|
+
});
|
|
82466
|
+
} else {
|
|
82467
|
+
ctx2.fillStyle = "rgba(0, 0, 0, 0.3)";
|
|
82468
|
+
ctx2.fillRect(0, 0, canvas.width, canvas.height);
|
|
82469
|
+
ctx2.fillStyle = "#ffffff";
|
|
82470
|
+
ctx2.font = "24px Arial";
|
|
82471
|
+
ctx2.textAlign = "center";
|
|
82472
|
+
ctx2.textBaseline = "middle";
|
|
82473
|
+
ctx2.fillText("暂无连麦用户", canvas.width / 2, canvas.height / 2);
|
|
82474
|
+
}
|
|
82475
|
+
};
|
|
82476
|
+
const renderMainPlusListLayout = (ctx2, canvas, originalCanvas, layout, callConfig, callUsers, get4) => {
|
|
82477
|
+
if (layout.mainArea) {
|
|
82478
|
+
const mainCanvasId = get4().mainCanvasId;
|
|
82479
|
+
const shouldRenderTargetVideo = mainCanvasId && mainCanvasId !== callConfig.drawing_board_id;
|
|
82480
|
+
if (shouldRenderTargetVideo) {
|
|
82481
|
+
const targetUser = callUsers.find((user) => {
|
|
82482
|
+
return user.videoList && user.videoList.includes(mainCanvasId);
|
|
82483
|
+
});
|
|
82484
|
+
if (targetUser) {
|
|
82485
|
+
if (!targetUser.isVideoEnabled && mainCanvasId.includes("screen")) {
|
|
82486
|
+
get4().renderEmptyUserArea(
|
|
82487
|
+
ctx2,
|
|
82488
|
+
targetUser,
|
|
82489
|
+
layout.mainArea.x,
|
|
82490
|
+
layout.mainArea.y,
|
|
82491
|
+
layout.mainArea.width,
|
|
82492
|
+
layout.mainArea.height
|
|
82493
|
+
);
|
|
82494
|
+
} else {
|
|
82495
|
+
try {
|
|
82496
|
+
const videoWrap = document.getElementById(mainCanvasId);
|
|
82497
|
+
const videoElement = videoWrap == null ? void 0 : videoWrap.querySelector("video");
|
|
82498
|
+
if (videoElement && videoElement.tagName === "VIDEO") {
|
|
82499
|
+
const videoWidth = videoElement.videoWidth;
|
|
82500
|
+
const videoHeight = videoElement.videoHeight;
|
|
82501
|
+
if (videoWidth > 0 && videoHeight > 0) {
|
|
82502
|
+
const isUserMobile = targetUser.device === "mobile";
|
|
82503
|
+
const mainAreaWidth = layout.mainArea.width;
|
|
82504
|
+
const mainAreaHeight = layout.mainArea.height;
|
|
82505
|
+
const scaleX = mainAreaWidth / videoWidth;
|
|
82506
|
+
const scaleY = mainAreaHeight / videoHeight;
|
|
82507
|
+
const scale2 = Math.min(scaleX, scaleY);
|
|
82508
|
+
const drawWidth = videoWidth * scale2;
|
|
82509
|
+
const drawHeight = videoHeight * scale2;
|
|
82510
|
+
const drawX = layout.mainArea.x + (mainAreaWidth - drawWidth) / 2;
|
|
82511
|
+
const drawY = layout.mainArea.y + (mainAreaHeight - drawHeight) / 2;
|
|
82512
|
+
if (isUserMobile) {
|
|
82513
|
+
ctx2.fillStyle = "#000000";
|
|
82514
|
+
ctx2.fillRect(layout.mainArea.x, layout.mainArea.y, mainAreaWidth, mainAreaHeight);
|
|
82515
|
+
}
|
|
82516
|
+
ctx2.drawImage(videoElement, drawX, drawY, drawWidth, drawHeight);
|
|
82517
|
+
} else {
|
|
82518
|
+
get4().renderEmptyUserArea(
|
|
82519
|
+
ctx2,
|
|
82520
|
+
targetUser,
|
|
82521
|
+
layout.mainArea.x,
|
|
82522
|
+
layout.mainArea.y,
|
|
82523
|
+
layout.mainArea.width,
|
|
82524
|
+
layout.mainArea.height
|
|
82525
|
+
);
|
|
82526
|
+
}
|
|
82527
|
+
} else {
|
|
82528
|
+
get4().renderEmptyUserArea(
|
|
82529
|
+
ctx2,
|
|
82530
|
+
targetUser,
|
|
82531
|
+
layout.mainArea.x,
|
|
82532
|
+
layout.mainArea.y,
|
|
82533
|
+
layout.mainArea.width,
|
|
82534
|
+
layout.mainArea.height
|
|
82535
|
+
);
|
|
82536
|
+
}
|
|
82537
|
+
} catch (error2) {
|
|
82538
|
+
console.error("主画布区域-绘制外部视频元素失败:", error2);
|
|
82539
|
+
get4().renderEmptyUserArea(
|
|
82540
|
+
ctx2,
|
|
82541
|
+
targetUser,
|
|
82542
|
+
layout.mainArea.x,
|
|
82543
|
+
layout.mainArea.y,
|
|
82544
|
+
layout.mainArea.width,
|
|
82545
|
+
layout.mainArea.height
|
|
82546
|
+
);
|
|
82547
|
+
}
|
|
82548
|
+
}
|
|
82549
|
+
} else {
|
|
82550
|
+
ctx2.fillStyle = "rgba(31, 41, 55, 0.7)";
|
|
82551
|
+
ctx2.fillRect(
|
|
82552
|
+
layout.mainArea.x,
|
|
82553
|
+
layout.mainArea.y,
|
|
82554
|
+
layout.mainArea.width,
|
|
82555
|
+
layout.mainArea.height
|
|
82556
|
+
);
|
|
82557
|
+
}
|
|
82558
|
+
} else {
|
|
82559
|
+
ctx2.fillStyle = "rgb(0, 0, 0)";
|
|
82560
|
+
ctx2.fillRect(
|
|
82561
|
+
layout.mainArea.x,
|
|
82562
|
+
layout.mainArea.y,
|
|
82563
|
+
layout.mainArea.width,
|
|
82564
|
+
layout.mainArea.height
|
|
82565
|
+
);
|
|
82566
|
+
ctx2.drawImage(
|
|
82567
|
+
originalCanvas,
|
|
82568
|
+
0,
|
|
82569
|
+
0,
|
|
82570
|
+
originalCanvas.width,
|
|
82571
|
+
originalCanvas.height,
|
|
82572
|
+
layout.mainArea.x,
|
|
82573
|
+
layout.mainArea.y,
|
|
82574
|
+
layout.mainArea.width,
|
|
82575
|
+
layout.mainArea.height
|
|
82576
|
+
);
|
|
82577
|
+
}
|
|
82578
|
+
}
|
|
82579
|
+
};
|
|
82580
|
+
const renderUserVideoAreas = (context, callAreas, get4) => {
|
|
82581
|
+
callAreas.forEach((area) => {
|
|
82582
|
+
var _a2;
|
|
82583
|
+
const { drawX, drawY, drawWidth, drawHeight } = calculateAspectRatio(area);
|
|
82584
|
+
context.save();
|
|
82585
|
+
context.fillStyle = "rgba(17, 24, 39, 0.8)";
|
|
82586
|
+
context.fillRect(drawX, drawY, drawWidth, drawHeight);
|
|
82587
|
+
const container = document.getElementById(area.domId);
|
|
82588
|
+
if (!container || !area.isVideoEnabled && !((_a2 = area.domId) == null ? void 0 : _a2.includes("screen"))) {
|
|
82589
|
+
get4().renderEmptyUserArea(context, area, drawX, drawY, drawWidth, drawHeight);
|
|
82590
|
+
context.restore();
|
|
82591
|
+
return;
|
|
82592
|
+
}
|
|
82593
|
+
const videoElement = container.querySelector("video");
|
|
82594
|
+
get4().drawUserVideoContent(context, videoElement, area, drawX, drawY, drawWidth, drawHeight);
|
|
82595
|
+
get4().drawUserInfo(context, area, drawX, drawY, drawWidth, drawHeight);
|
|
82596
|
+
get4().drawStatusIndicators(context, area, drawX, drawY, drawWidth);
|
|
82597
|
+
context.restore();
|
|
82598
|
+
});
|
|
82599
|
+
};
|
|
82600
|
+
const drawBackgroundImage = (ctx2, canvas, backgroundImgUrl, get4, set3) => {
|
|
82601
|
+
const { backgroundImageRef, lastBackgroundImgUrlRef } = get4();
|
|
82602
|
+
if (!backgroundImageRef || lastBackgroundImgUrlRef !== backgroundImgUrl) {
|
|
82603
|
+
const img = new Image();
|
|
82604
|
+
img.src = backgroundImgUrl;
|
|
82605
|
+
img.crossOrigin = "anonymous";
|
|
82606
|
+
set3({
|
|
82607
|
+
backgroundImageRef: img,
|
|
82608
|
+
lastBackgroundImgUrlRef: backgroundImgUrl
|
|
82609
|
+
});
|
|
82610
|
+
img.onload = () => {
|
|
82611
|
+
get4().renderCompositeFrameSmooth();
|
|
82612
|
+
};
|
|
82613
|
+
img.onerror = () => {
|
|
82614
|
+
console.error("[CallStore] 背景图加载失败:", backgroundImgUrl);
|
|
82615
|
+
ctx2.fillStyle = "#000000";
|
|
82616
|
+
ctx2.fillRect(0, 0, canvas.width, canvas.height);
|
|
82617
|
+
};
|
|
82618
|
+
} else if (backgroundImageRef.complete && backgroundImageRef.naturalWidth > 0) {
|
|
82619
|
+
try {
|
|
82620
|
+
ctx2.globalAlpha = 0.9;
|
|
82621
|
+
const imgAspectRatio = backgroundImageRef.width / backgroundImageRef.height;
|
|
82622
|
+
const canvasAspectRatio = canvas.width / canvas.height;
|
|
82623
|
+
let drawWidth, drawHeight, drawX, drawY;
|
|
82624
|
+
if (imgAspectRatio > canvasAspectRatio) {
|
|
82625
|
+
drawHeight = canvas.height;
|
|
82626
|
+
drawWidth = canvas.height * imgAspectRatio;
|
|
82627
|
+
drawX = (canvas.width - drawWidth) / 2;
|
|
82628
|
+
drawY = 0;
|
|
82629
|
+
} else {
|
|
82630
|
+
drawWidth = canvas.width;
|
|
82631
|
+
drawHeight = canvas.width / imgAspectRatio;
|
|
82632
|
+
drawX = 0;
|
|
82633
|
+
drawY = (canvas.height - drawHeight) / 2;
|
|
82634
|
+
}
|
|
82635
|
+
ctx2.drawImage(
|
|
82636
|
+
backgroundImageRef,
|
|
82637
|
+
0,
|
|
82638
|
+
0,
|
|
82639
|
+
backgroundImageRef.width,
|
|
82640
|
+
backgroundImageRef.height,
|
|
82641
|
+
drawX,
|
|
82642
|
+
drawY,
|
|
82643
|
+
drawWidth,
|
|
82644
|
+
drawHeight
|
|
82645
|
+
);
|
|
82646
|
+
ctx2.globalAlpha = 1;
|
|
82647
|
+
} catch (error2) {
|
|
82648
|
+
console.error("[CallStore] 背景图绘制失败:", error2);
|
|
82649
|
+
ctx2.fillStyle = "rgba(0, 0, 0, 0.8)";
|
|
82650
|
+
ctx2.fillRect(0, 0, canvas.width, canvas.height);
|
|
82651
|
+
}
|
|
82652
|
+
} else {
|
|
82653
|
+
ctx2.fillStyle = "rgba(0, 0, 0, 0.8)";
|
|
82654
|
+
ctx2.fillRect(0, 0, canvas.width, canvas.height);
|
|
82655
|
+
}
|
|
82656
|
+
};
|
|
82404
82657
|
var VideoType = /* @__PURE__ */ ((VideoType2) => {
|
|
82405
82658
|
VideoType2["CAMERA"] = "video";
|
|
82406
82659
|
VideoType2["SCREEN"] = "screen";
|
|
@@ -83265,281 +83518,14 @@ const useCallStore = create$c()(
|
|
|
83265
83518
|
const originalCanvas = fabricInstance == null ? void 0 : fabricInstance.lowerCanvasEl;
|
|
83266
83519
|
if (!canvas || !context || !originalCanvas)
|
|
83267
83520
|
return;
|
|
83268
|
-
const
|
|
83269
|
-
let offscreenCanvas2 = get4().offscreenCanvasRef;
|
|
83270
|
-
let offscreenContext2 = get4().offscreenContextRef;
|
|
83271
|
-
if (!offscreenCanvas2 || offscreenCanvas2.width !== targetCanvas.width || offscreenCanvas2.height !== targetCanvas.height) {
|
|
83272
|
-
offscreenCanvas2 = document.createElement("canvas");
|
|
83273
|
-
offscreenCanvas2.width = targetCanvas.width;
|
|
83274
|
-
offscreenCanvas2.height = targetCanvas.height;
|
|
83275
|
-
offscreenContext2 = offscreenCanvas2.getContext("2d");
|
|
83276
|
-
set3({
|
|
83277
|
-
offscreenCanvasRef: offscreenCanvas2,
|
|
83278
|
-
offscreenContextRef: offscreenContext2
|
|
83279
|
-
});
|
|
83280
|
-
}
|
|
83281
|
-
return offscreenCanvas2;
|
|
83282
|
-
};
|
|
83283
|
-
const calculateAspectRatio = (area) => {
|
|
83284
|
-
const targetAspectRatio = 16 / 9;
|
|
83285
|
-
const currentAspectRatio = area.width / area.height;
|
|
83286
|
-
let drawWidth = area.width;
|
|
83287
|
-
let drawHeight = area.height;
|
|
83288
|
-
let drawX = area.x;
|
|
83289
|
-
let drawY = area.y;
|
|
83290
|
-
if (currentAspectRatio > targetAspectRatio) {
|
|
83291
|
-
drawWidth = area.height * targetAspectRatio;
|
|
83292
|
-
drawX = area.x + (area.width - drawWidth) / 2;
|
|
83293
|
-
} else {
|
|
83294
|
-
drawHeight = area.width / targetAspectRatio;
|
|
83295
|
-
drawY = area.y + (area.height - drawHeight) / 2;
|
|
83296
|
-
}
|
|
83297
|
-
return { drawX, drawY, drawWidth, drawHeight };
|
|
83298
|
-
};
|
|
83299
|
-
const renderGridLayout = (ctx2, canvas2, layout) => {
|
|
83300
|
-
if (layout.callAreas && layout.callAreas.length > 0) {
|
|
83301
|
-
layout.callAreas.forEach((area) => {
|
|
83302
|
-
const { drawX, drawY, drawWidth, drawHeight } = calculateAspectRatio(area);
|
|
83303
|
-
ctx2.fillStyle = "rgba(26, 26, 26, 0.8)";
|
|
83304
|
-
ctx2.fillRect(drawX, drawY, drawWidth, drawHeight);
|
|
83305
|
-
ctx2.strokeStyle = "rgba(51, 51, 51, 0.6)";
|
|
83306
|
-
ctx2.lineWidth = 2;
|
|
83307
|
-
ctx2.strokeRect(drawX, drawY, drawWidth, drawHeight);
|
|
83308
|
-
if (!area.isVideoEnabled && area.domId.includes("screen")) {
|
|
83309
|
-
get4().renderEmptyUserArea(ctx2, area, drawX, drawY, drawWidth, drawHeight);
|
|
83310
|
-
} else {
|
|
83311
|
-
const container = document.getElementById(area.domId);
|
|
83312
|
-
if (container) {
|
|
83313
|
-
const videoElement = container.querySelector("video");
|
|
83314
|
-
if (videoElement) {
|
|
83315
|
-
get4().drawUserVideoContent(
|
|
83316
|
-
ctx2,
|
|
83317
|
-
videoElement,
|
|
83318
|
-
area,
|
|
83319
|
-
drawX,
|
|
83320
|
-
drawY,
|
|
83321
|
-
drawWidth,
|
|
83322
|
-
drawHeight
|
|
83323
|
-
);
|
|
83324
|
-
}
|
|
83325
|
-
}
|
|
83326
|
-
get4().drawUserInfo(ctx2, area, drawX, drawY, drawWidth, drawHeight);
|
|
83327
|
-
get4().drawStatusIndicators(ctx2, area, drawX, drawY, drawWidth);
|
|
83328
|
-
}
|
|
83329
|
-
});
|
|
83330
|
-
} else {
|
|
83331
|
-
ctx2.fillStyle = "rgba(0, 0, 0, 0.3)";
|
|
83332
|
-
ctx2.fillRect(0, 0, canvas2.width, canvas2.height);
|
|
83333
|
-
ctx2.fillStyle = "#ffffff";
|
|
83334
|
-
ctx2.font = "24px Arial";
|
|
83335
|
-
ctx2.textAlign = "center";
|
|
83336
|
-
ctx2.textBaseline = "middle";
|
|
83337
|
-
ctx2.fillText("暂无连麦用户", canvas2.width / 2, canvas2.height / 2);
|
|
83338
|
-
}
|
|
83339
|
-
};
|
|
83340
|
-
const renderMainPlusListLayout = (ctx2, canvas2, originalCanvas2, layout) => {
|
|
83341
|
-
if (layout.mainArea) {
|
|
83342
|
-
const mainCanvasId = get4().mainCanvasId;
|
|
83343
|
-
const shouldRenderTargetVideo = mainCanvasId && mainCanvasId !== callConfig.drawing_board_id;
|
|
83344
|
-
if (shouldRenderTargetVideo) {
|
|
83345
|
-
const targetUser = callUsers.find((user) => {
|
|
83346
|
-
return user.videoList && user.videoList.includes(mainCanvasId);
|
|
83347
|
-
});
|
|
83348
|
-
if (targetUser) {
|
|
83349
|
-
if (!targetUser.isVideoEnabled && mainCanvasId.includes("screen")) {
|
|
83350
|
-
get4().renderEmptyUserArea(
|
|
83351
|
-
ctx2,
|
|
83352
|
-
targetUser,
|
|
83353
|
-
layout.mainArea.x,
|
|
83354
|
-
layout.mainArea.y,
|
|
83355
|
-
layout.mainArea.width,
|
|
83356
|
-
layout.mainArea.height
|
|
83357
|
-
);
|
|
83358
|
-
} else {
|
|
83359
|
-
try {
|
|
83360
|
-
const videoWrap = document.getElementById(mainCanvasId);
|
|
83361
|
-
const videoElement = videoWrap == null ? void 0 : videoWrap.querySelector("video");
|
|
83362
|
-
if (videoElement && videoElement.tagName === "VIDEO") {
|
|
83363
|
-
const videoWidth = videoElement.videoWidth;
|
|
83364
|
-
const videoHeight = videoElement.videoHeight;
|
|
83365
|
-
if (videoWidth > 0 && videoHeight > 0) {
|
|
83366
|
-
const isUserMobile = targetUser.device === "mobile";
|
|
83367
|
-
const mainAreaWidth = layout.mainArea.width;
|
|
83368
|
-
const mainAreaHeight = layout.mainArea.height;
|
|
83369
|
-
const scaleX = mainAreaWidth / videoWidth;
|
|
83370
|
-
const scaleY = mainAreaHeight / videoHeight;
|
|
83371
|
-
const scale2 = Math.min(scaleX, scaleY);
|
|
83372
|
-
const drawWidth = videoWidth * scale2;
|
|
83373
|
-
const drawHeight = videoHeight * scale2;
|
|
83374
|
-
const drawX = layout.mainArea.x + (mainAreaWidth - drawWidth) / 2;
|
|
83375
|
-
const drawY = layout.mainArea.y + (mainAreaHeight - drawHeight) / 2;
|
|
83376
|
-
if (isUserMobile) {
|
|
83377
|
-
ctx2.fillStyle = "#000000";
|
|
83378
|
-
ctx2.fillRect(
|
|
83379
|
-
layout.mainArea.x,
|
|
83380
|
-
layout.mainArea.y,
|
|
83381
|
-
mainAreaWidth,
|
|
83382
|
-
mainAreaHeight
|
|
83383
|
-
);
|
|
83384
|
-
}
|
|
83385
|
-
ctx2.drawImage(videoElement, drawX, drawY, drawWidth, drawHeight);
|
|
83386
|
-
} else {
|
|
83387
|
-
get4().renderEmptyUserArea(
|
|
83388
|
-
ctx2,
|
|
83389
|
-
targetUser,
|
|
83390
|
-
layout.mainArea.x,
|
|
83391
|
-
layout.mainArea.y,
|
|
83392
|
-
layout.mainArea.width,
|
|
83393
|
-
layout.mainArea.height
|
|
83394
|
-
);
|
|
83395
|
-
}
|
|
83396
|
-
} else {
|
|
83397
|
-
get4().renderEmptyUserArea(
|
|
83398
|
-
ctx2,
|
|
83399
|
-
targetUser,
|
|
83400
|
-
layout.mainArea.x,
|
|
83401
|
-
layout.mainArea.y,
|
|
83402
|
-
layout.mainArea.width,
|
|
83403
|
-
layout.mainArea.height
|
|
83404
|
-
);
|
|
83405
|
-
}
|
|
83406
|
-
} catch (error2) {
|
|
83407
|
-
console.error("主画布区域-绘制外部视频元素失败:", error2);
|
|
83408
|
-
get4().renderEmptyUserArea(
|
|
83409
|
-
ctx2,
|
|
83410
|
-
targetUser,
|
|
83411
|
-
layout.mainArea.x,
|
|
83412
|
-
layout.mainArea.y,
|
|
83413
|
-
layout.mainArea.width,
|
|
83414
|
-
layout.mainArea.height
|
|
83415
|
-
);
|
|
83416
|
-
}
|
|
83417
|
-
}
|
|
83418
|
-
} else {
|
|
83419
|
-
ctx2.fillStyle = "rgba(31, 41, 55, 0.7)";
|
|
83420
|
-
ctx2.fillRect(
|
|
83421
|
-
layout.mainArea.x,
|
|
83422
|
-
layout.mainArea.y,
|
|
83423
|
-
layout.mainArea.width,
|
|
83424
|
-
layout.mainArea.height
|
|
83425
|
-
);
|
|
83426
|
-
}
|
|
83427
|
-
} else {
|
|
83428
|
-
ctx2.fillStyle = "rgb(0, 0, 0)";
|
|
83429
|
-
ctx2.fillRect(
|
|
83430
|
-
layout.mainArea.x,
|
|
83431
|
-
layout.mainArea.y,
|
|
83432
|
-
layout.mainArea.width,
|
|
83433
|
-
layout.mainArea.height
|
|
83434
|
-
);
|
|
83435
|
-
ctx2.drawImage(
|
|
83436
|
-
originalCanvas2,
|
|
83437
|
-
0,
|
|
83438
|
-
0,
|
|
83439
|
-
originalCanvas2.width,
|
|
83440
|
-
originalCanvas2.height,
|
|
83441
|
-
layout.mainArea.x,
|
|
83442
|
-
layout.mainArea.y,
|
|
83443
|
-
layout.mainArea.width,
|
|
83444
|
-
layout.mainArea.height
|
|
83445
|
-
);
|
|
83446
|
-
}
|
|
83447
|
-
}
|
|
83448
|
-
};
|
|
83449
|
-
const renderUserVideoAreas = (context2, callAreas) => {
|
|
83450
|
-
callAreas.forEach((area) => {
|
|
83451
|
-
var _a2;
|
|
83452
|
-
const { drawX, drawY, drawWidth, drawHeight } = calculateAspectRatio(area);
|
|
83453
|
-
context2.save();
|
|
83454
|
-
context2.fillStyle = "rgba(17, 24, 39, 0.8)";
|
|
83455
|
-
context2.fillRect(drawX, drawY, drawWidth, drawHeight);
|
|
83456
|
-
const container = document.getElementById(area.domId);
|
|
83457
|
-
if (!container || !area.isVideoEnabled && !((_a2 = area.domId) == null ? void 0 : _a2.includes("screen"))) {
|
|
83458
|
-
get4().renderEmptyUserArea(context2, area, drawX, drawY, drawWidth, drawHeight);
|
|
83459
|
-
context2.restore();
|
|
83460
|
-
return;
|
|
83461
|
-
}
|
|
83462
|
-
const videoElement = container.querySelector("video");
|
|
83463
|
-
get4().drawUserVideoContent(
|
|
83464
|
-
context2,
|
|
83465
|
-
videoElement,
|
|
83466
|
-
area,
|
|
83467
|
-
drawX,
|
|
83468
|
-
drawY,
|
|
83469
|
-
drawWidth,
|
|
83470
|
-
drawHeight
|
|
83471
|
-
);
|
|
83472
|
-
get4().drawUserInfo(context2, area, drawX, drawY, drawWidth, drawHeight);
|
|
83473
|
-
get4().drawStatusIndicators(context2, area, drawX, drawY, drawWidth);
|
|
83474
|
-
context2.restore();
|
|
83475
|
-
});
|
|
83476
|
-
};
|
|
83477
|
-
const drawBackgroundImage = (ctx2, canvas2, backgroundImgUrl2) => {
|
|
83478
|
-
const { backgroundImageRef, lastBackgroundImgUrlRef } = get4();
|
|
83479
|
-
if (!backgroundImageRef || lastBackgroundImgUrlRef !== backgroundImgUrl2) {
|
|
83480
|
-
const img = new Image();
|
|
83481
|
-
img.src = backgroundImgUrl2;
|
|
83482
|
-
img.crossOrigin = "anonymous";
|
|
83483
|
-
set3({
|
|
83484
|
-
backgroundImageRef: img,
|
|
83485
|
-
lastBackgroundImgUrlRef: backgroundImgUrl2
|
|
83486
|
-
});
|
|
83487
|
-
img.onload = () => {
|
|
83488
|
-
const { renderCompositeFrameSmooth } = get4();
|
|
83489
|
-
renderCompositeFrameSmooth();
|
|
83490
|
-
};
|
|
83491
|
-
img.onerror = () => {
|
|
83492
|
-
console.error("[CallStore] 背景图加载失败:", backgroundImgUrl2);
|
|
83493
|
-
ctx2.fillStyle = "#000000";
|
|
83494
|
-
ctx2.fillRect(0, 0, canvas2.width, canvas2.height);
|
|
83495
|
-
};
|
|
83496
|
-
} else if (backgroundImageRef.complete && backgroundImageRef.naturalWidth > 0) {
|
|
83497
|
-
try {
|
|
83498
|
-
ctx2.globalAlpha = 0.9;
|
|
83499
|
-
const imgAspectRatio = backgroundImageRef.width / backgroundImageRef.height;
|
|
83500
|
-
const canvasAspectRatio = canvas2.width / canvas2.height;
|
|
83501
|
-
let drawWidth, drawHeight, drawX, drawY;
|
|
83502
|
-
if (imgAspectRatio > canvasAspectRatio) {
|
|
83503
|
-
drawHeight = canvas2.height;
|
|
83504
|
-
drawWidth = canvas2.height * imgAspectRatio;
|
|
83505
|
-
drawX = (canvas2.width - drawWidth) / 2;
|
|
83506
|
-
drawY = 0;
|
|
83507
|
-
} else {
|
|
83508
|
-
drawWidth = canvas2.width;
|
|
83509
|
-
drawHeight = canvas2.width / imgAspectRatio;
|
|
83510
|
-
drawX = 0;
|
|
83511
|
-
drawY = (canvas2.height - drawHeight) / 2;
|
|
83512
|
-
}
|
|
83513
|
-
ctx2.drawImage(
|
|
83514
|
-
backgroundImageRef,
|
|
83515
|
-
0,
|
|
83516
|
-
0,
|
|
83517
|
-
backgroundImageRef.width,
|
|
83518
|
-
backgroundImageRef.height,
|
|
83519
|
-
drawX,
|
|
83520
|
-
drawY,
|
|
83521
|
-
drawWidth,
|
|
83522
|
-
drawHeight
|
|
83523
|
-
);
|
|
83524
|
-
ctx2.globalAlpha = 1;
|
|
83525
|
-
} catch (error2) {
|
|
83526
|
-
console.error("[CallStore] 背景图绘制失败:", error2);
|
|
83527
|
-
ctx2.fillStyle = "rgba(0, 0, 0, 0.8)";
|
|
83528
|
-
ctx2.fillRect(0, 0, canvas2.width, canvas2.height);
|
|
83529
|
-
}
|
|
83530
|
-
} else {
|
|
83531
|
-
ctx2.fillStyle = "rgba(0, 0, 0, 0.8)";
|
|
83532
|
-
ctx2.fillRect(0, 0, canvas2.width, canvas2.height);
|
|
83533
|
-
}
|
|
83534
|
-
};
|
|
83535
|
-
const offscreenCanvas = prepareOffscreenCanvas(canvas);
|
|
83521
|
+
const offscreenCanvas = prepareOffscreenCanvas(canvas, get4, set3);
|
|
83536
83522
|
const offscreenContext = offscreenCanvas.getContext("2d");
|
|
83537
83523
|
if (!offscreenContext)
|
|
83538
83524
|
return;
|
|
83539
83525
|
offscreenContext.clearRect(0, 0, offscreenCanvas.width, offscreenCanvas.height);
|
|
83540
83526
|
const backgroundImgUrl = callConfig.backgroundImg;
|
|
83541
83527
|
if (callConfig.isCall && backgroundImgUrl && backgroundImgUrl.trim() !== "") {
|
|
83542
|
-
drawBackgroundImage(offscreenContext, offscreenCanvas, backgroundImgUrl);
|
|
83528
|
+
drawBackgroundImage(offscreenContext, offscreenCanvas, backgroundImgUrl, get4, set3);
|
|
83543
83529
|
} else {
|
|
83544
83530
|
offscreenContext.fillStyle = "#000000";
|
|
83545
83531
|
offscreenContext.fillRect(0, 0, offscreenCanvas.width, offscreenCanvas.height);
|
|
@@ -83548,14 +83534,22 @@ const useCallStore = create$c()(
|
|
|
83548
83534
|
const layout = calculateLayout();
|
|
83549
83535
|
switch (layoutMode) {
|
|
83550
83536
|
case "grid":
|
|
83551
|
-
renderGridLayout(offscreenContext, canvas, layout);
|
|
83537
|
+
renderGridLayout(offscreenContext, canvas, layout, get4);
|
|
83552
83538
|
break;
|
|
83553
83539
|
case "main_plus_list":
|
|
83554
|
-
renderMainPlusListLayout(
|
|
83540
|
+
renderMainPlusListLayout(
|
|
83541
|
+
offscreenContext,
|
|
83542
|
+
canvas,
|
|
83543
|
+
originalCanvas,
|
|
83544
|
+
layout,
|
|
83545
|
+
callConfig,
|
|
83546
|
+
callUsers,
|
|
83547
|
+
get4
|
|
83548
|
+
);
|
|
83555
83549
|
break;
|
|
83556
83550
|
}
|
|
83557
83551
|
if (layout.callAreas.length) {
|
|
83558
|
-
renderUserVideoAreas(offscreenContext, layout.callAreas);
|
|
83552
|
+
renderUserVideoAreas(offscreenContext, layout.callAreas, get4);
|
|
83559
83553
|
}
|
|
83560
83554
|
} else {
|
|
83561
83555
|
const mainArea = {
|
|
@@ -83754,6 +83748,7 @@ const useCallStore = create$c()(
|
|
|
83754
83748
|
}
|
|
83755
83749
|
return result;
|
|
83756
83750
|
}).filter(Boolean).map((track) => new MediaStream([track]));
|
|
83751
|
+
console.log("连麦音频混流", b2);
|
|
83757
83752
|
set3({ callAudioStreamsRef: b2 });
|
|
83758
83753
|
},
|
|
83759
83754
|
handleRemoteUserPublishScreen: async (userId, isPublishing) => {
|
|
@@ -85385,9 +85380,9 @@ function useLiveInfo() {
|
|
|
85385
85380
|
if (res.success === false) {
|
|
85386
85381
|
staticMethods.error(res.errorMessage);
|
|
85387
85382
|
requestResult.cancel();
|
|
85388
|
-
return
|
|
85383
|
+
return;
|
|
85389
85384
|
}
|
|
85390
|
-
return res;
|
|
85385
|
+
return res.data;
|
|
85391
85386
|
}).catch((error22) => {
|
|
85392
85387
|
console.error("直播信息请求失败,取消轮训:", error22);
|
|
85393
85388
|
requestResult.cancel();
|
|
@@ -85584,6 +85579,7 @@ const Head = ({
|
|
|
85584
85579
|
const {
|
|
85585
85580
|
livePushCode
|
|
85586
85581
|
} = useLivePushCodeStore();
|
|
85582
|
+
const title = useSdkStore((state) => state.callConfig.title);
|
|
85587
85583
|
const {
|
|
85588
85584
|
data: liveInfoData,
|
|
85589
85585
|
run: runLiveInfo
|
|
@@ -86044,10 +86040,10 @@ const Head = ({
|
|
|
86044
86040
|
}
|
|
86045
86041
|
}, [data2 == null ? void 0 : data2.status]);
|
|
86046
86042
|
reactExports.useEffect(() => {
|
|
86047
|
-
if (
|
|
86043
|
+
if (!isLive) {
|
|
86048
86044
|
checkPushingStatus();
|
|
86049
86045
|
}
|
|
86050
|
-
}, [data2 == null ? void 0 : data2.is_pushing, localPushingStatus, checkPushingStatus, isLive
|
|
86046
|
+
}, [data2 == null ? void 0 : data2.is_pushing, localPushingStatus, checkPushingStatus, isLive]);
|
|
86051
86047
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
|
|
86052
86048
|
className: "min-h-56px bg-#222933 px-26px flex items-center justify-between",
|
|
86053
86049
|
children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
|
|
@@ -86059,7 +86055,7 @@ const Head = ({
|
|
|
86059
86055
|
style: {
|
|
86060
86056
|
lineHeight: 1
|
|
86061
86057
|
},
|
|
86062
|
-
children:
|
|
86058
|
+
children: title
|
|
86063
86059
|
}), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
86064
86060
|
className: "w-1px h-18px bg-#fff mx-4"
|
|
86065
86061
|
}), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
@@ -196121,7 +196117,7 @@ const CallUserVideo = reactExports.memo(({
|
|
|
196121
196117
|
}
|
|
196122
196118
|
},
|
|
196123
196119
|
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
|
|
196124
|
-
className: "relative
|
|
196120
|
+
className: "relative w-full h-full bg-gray-900",
|
|
196125
196121
|
style: {
|
|
196126
196122
|
aspectRatio: "16/9"
|
|
196127
196123
|
},
|
|
@@ -196315,14 +196311,14 @@ const CallGridLayout = ({
|
|
|
196315
196311
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(CallUserVideo, {
|
|
196316
196312
|
user: callCurrentUser,
|
|
196317
196313
|
video_id: callCurrentUser.rtc_userid + "screen",
|
|
196318
|
-
className: `min-h-0 aspect-video
|
|
196314
|
+
className: `min-h-0 aspect-video w-full h-full object-cover`
|
|
196319
196315
|
}, "local-player-screen")
|
|
196320
196316
|
}), currentPage === 1 && (callCurrentUser == null ? void 0 : callCurrentUser.rtc_userid) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
196321
196317
|
style: videoItemStyle,
|
|
196322
196318
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(CallUserVideo, {
|
|
196323
196319
|
user: callCurrentUser,
|
|
196324
196320
|
video_id: callCurrentUser.rtc_userid,
|
|
196325
|
-
className: `min-h-0 aspect-video
|
|
196321
|
+
className: `min-h-0 aspect-video w-full h-full object-cover`
|
|
196326
196322
|
}, "local-player")
|
|
196327
196323
|
}), currentPageUsers.map((user) => {
|
|
196328
196324
|
if (user.rtc_userid === callConfig.rtc_userid && currentPage === 1) {
|
|
@@ -196334,14 +196330,14 @@ const CallGridLayout = ({
|
|
|
196334
196330
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(CallUserVideo, {
|
|
196335
196331
|
user,
|
|
196336
196332
|
video_id: user.rtc_userid + "screen",
|
|
196337
|
-
className: `min-h-0 aspect-video
|
|
196333
|
+
className: `min-h-0 aspect-video w-full h-full object-cover`
|
|
196338
196334
|
}, user.rtc_userid + "screen")
|
|
196339
196335
|
}), user.rtc_userid && /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
196340
196336
|
style: videoItemStyle,
|
|
196341
196337
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(CallUserVideo, {
|
|
196342
196338
|
user,
|
|
196343
196339
|
video_id: user.rtc_userid,
|
|
196344
|
-
className: `min-h-0 aspect-video
|
|
196340
|
+
className: `min-h-0 aspect-video w-full h-full object-cover`
|
|
196345
196341
|
}, user.rtc_userid)
|
|
196346
196342
|
})]
|
|
196347
196343
|
}, user.rtc_userid);
|
|
@@ -268928,6 +268924,7 @@ const LivePlayer = ({
|
|
|
268928
268924
|
console.log("loadCanvasState", newObj);
|
|
268929
268925
|
setFabricObjects(newObj);
|
|
268930
268926
|
},
|
|
268927
|
+
getRtmpRef: () => rtmpRef,
|
|
268931
268928
|
getActiveVideoStreams: () => activeVideoStreamsRef.current,
|
|
268932
268929
|
getMicrophoneStreams: () => microphoneStreamsRef.current,
|
|
268933
268930
|
getBackgroundAudioStreams: () => backgroundAudioStreamsRef.current,
|
|
@@ -269172,12 +269169,12 @@ const LivePlayer = ({
|
|
|
269172
269169
|
})
|
|
269173
269170
|
}), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
|
|
269174
269171
|
id: "video-container",
|
|
269175
|
-
className: "absolute overflow-hidden bg-#000
|
|
269172
|
+
className: "absolute overflow-hidden bg-#000 w-full z-[-10]",
|
|
269176
269173
|
style: {
|
|
269177
269174
|
aspectRatio: 16 / 9
|
|
269178
269175
|
},
|
|
269179
269176
|
children: [/* @__PURE__ */ jsxRuntimeExports.jsx("video", {
|
|
269180
|
-
className: " h-full object-cover",
|
|
269177
|
+
className: "w-full h-full object-cover",
|
|
269181
269178
|
ref: videoRef
|
|
269182
269179
|
}), !(isMainCanvasUser == null ? void 0 : isMainCanvasUser.isVideoEnabled) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
269183
269180
|
className: "absolute inset-0 bg-gray-800 flex items-center justify-center",
|
|
@@ -280242,7 +280239,6 @@ const MediaSettings = () => {
|
|
|
280242
280239
|
});
|
|
280243
280240
|
const [beautyExtension, setBeautyExtension] = reactExports.useState(null);
|
|
280244
280241
|
const [beautyCompatible, setBeautyCompatible] = reactExports.useState(false);
|
|
280245
|
-
console.log("beautyCompatible", beautyCompatible);
|
|
280246
280242
|
const [beautyInitialized, setBeautyInitialized] = reactExports.useState(false);
|
|
280247
280243
|
const getDevices = reactExports.useCallback(async () => {
|
|
280248
280244
|
try {
|
|
@@ -292343,13 +292339,16 @@ const RtcJoomRoom = reactExports.memo(({
|
|
|
292343
292339
|
}
|
|
292344
292340
|
}, VideoRenderMode.RENDER_MODE_HIDDEN));
|
|
292345
292341
|
if (callConfig.rule === "sub" && callConfig.enter_muted) {
|
|
292346
|
-
toggleAudio(false);
|
|
292342
|
+
await toggleAudio(false);
|
|
292347
292343
|
} else {
|
|
292348
292344
|
updateCallConfig({
|
|
292349
292345
|
isReady: true
|
|
292350
292346
|
});
|
|
292351
292347
|
}
|
|
292352
292348
|
await ((_d2 = getter().rtc) == null ? void 0 : _d2.publishStream());
|
|
292349
|
+
if (callConfig.rule === "main") {
|
|
292350
|
+
callAudioMixing();
|
|
292351
|
+
}
|
|
292353
292352
|
} catch (err2) {
|
|
292354
292353
|
console.error("创建本地流失败" + rtc_userid, "appid:" + appid, "roomid:" + rtc_room_id, "userid:" + rtc_userid, err2);
|
|
292355
292354
|
}
|
|
@@ -292831,9 +292830,6 @@ const CallHome$1 = () => {
|
|
|
292831
292830
|
const [canvasSetting, setCanvasSetting] = reactExports.useState("horizontal");
|
|
292832
292831
|
const rtmpRef = reactExports.useRef(null);
|
|
292833
292832
|
const audioSourcesRef = reactExports.useRef([]);
|
|
292834
|
-
reactExports.useEffect(() => {
|
|
292835
|
-
document.title = "菲耀直播";
|
|
292836
|
-
}, []);
|
|
292837
292833
|
reactExports.useEffect(() => {
|
|
292838
292834
|
const timer = setTimeout(() => {
|
|
292839
292835
|
if (!(callConfig == null ? void 0 : callConfig.rtc_userid)) {
|
|
@@ -292910,7 +292906,6 @@ const {
|
|
|
292910
292906
|
} = Typography;
|
|
292911
292907
|
const WebLiveLogin = () => {
|
|
292912
292908
|
const [form] = Form2.useForm();
|
|
292913
|
-
new URLSearchParams(window.location.search);
|
|
292914
292909
|
const {
|
|
292915
292910
|
setStatus,
|
|
292916
292911
|
setDeviceType
|
|
@@ -293234,9 +293229,6 @@ const WebLiveLogin = () => {
|
|
|
293234
293229
|
handleLogin.cancel();
|
|
293235
293230
|
};
|
|
293236
293231
|
}, [handleLogin]);
|
|
293237
|
-
reactExports.useEffect(() => {
|
|
293238
|
-
document.title = "菲耀直播";
|
|
293239
|
-
}, []);
|
|
293240
293232
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
|
|
293241
293233
|
className: "web-live-login-container",
|
|
293242
293234
|
children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
|
|
@@ -294901,6 +294893,7 @@ const MobileLive = reactExports.memo(({ className = "" }) => {
|
|
|
294901
294893
|
const { setStatus } = useGuestStore((state) => ({
|
|
294902
294894
|
setStatus: state.setStatus
|
|
294903
294895
|
}));
|
|
294896
|
+
useSdkStore((state) => state.callConfig.title);
|
|
294904
294897
|
const [isBackCamera, setIsBackCamera] = reactExports.useState(false);
|
|
294905
294898
|
const [showDeviceSettings, setShowDeviceSettings] = reactExports.useState(false);
|
|
294906
294899
|
const [isDeviceSelected, setIsDeviceSelected] = reactExports.useState({
|
|
@@ -294990,9 +294983,6 @@ const MobileLive = reactExports.memo(({ className = "" }) => {
|
|
|
294990
294983
|
reactExports.useEffect(() => {
|
|
294991
294984
|
document.body.style.minWidth = "100vw";
|
|
294992
294985
|
}, [callConfig]);
|
|
294993
|
-
reactExports.useEffect(() => {
|
|
294994
|
-
document.title = "菲耀直播";
|
|
294995
|
-
}, []);
|
|
294996
294986
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-screen h-screen bg-black relative overflow-hidden", children: [
|
|
294997
294987
|
/* @__PURE__ */ jsxRuntimeExports.jsx(RtcJoomRoom, { access: setupVideoPlayer }),
|
|
294998
294988
|
(callCurrentUser == null ? void 0 : callCurrentUser.waiting_mode_state) !== WaitingModeState.WAITING && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-screen h-screen bg-black relative overflow-hidden", children: [
|
|
@@ -296215,10 +296205,10 @@ const CanvasUploadVideo = ({
|
|
|
296215
296205
|
className: "text-60px text-#6672fc"
|
|
296216
296206
|
})
|
|
296217
296207
|
}), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
296218
|
-
className:
|
|
296208
|
+
className: `text-14px`,
|
|
296219
296209
|
children: "将文件拖到此处,或点击上传"
|
|
296220
296210
|
}), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
296221
|
-
className:
|
|
296211
|
+
className: `text-12px mt-2 mb-10`,
|
|
296222
296212
|
children: "支持mp4格式文件,大小不超过5GB"
|
|
296223
296213
|
})]
|
|
296224
296214
|
})
|
|
@@ -296359,10 +296349,10 @@ const CanvasUploadAudio = ({
|
|
|
296359
296349
|
className: "text-60px text-#6672fc"
|
|
296360
296350
|
})
|
|
296361
296351
|
}), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
296362
|
-
className:
|
|
296352
|
+
className: `text-14px ${theme.useToken().token.colorTextTertiary}`,
|
|
296363
296353
|
children: "将文件拖到此处,或点击上传"
|
|
296364
296354
|
}), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
296365
|
-
className:
|
|
296355
|
+
className: `text-12px mt-2 mb-10 ${theme.useToken().token.colorTextTertiary}`,
|
|
296366
296356
|
children: "支持mp3格式文件,大小不超过5GB"
|
|
296367
296357
|
})]
|
|
296368
296358
|
})
|
|
@@ -304394,7 +304384,8 @@ const MetaItem = ({
|
|
|
304394
304384
|
const isMutedRef = reactExports.useRef(true);
|
|
304395
304385
|
const [isMuted, setIsMuted] = reactExports.useState(true);
|
|
304396
304386
|
const [isLoop, setIsLoop] = reactExports.useState(false);
|
|
304397
|
-
const
|
|
304387
|
+
const fenge = '-":}{_+';
|
|
304388
|
+
const [selectedValue, setSelectedValue] = reactExports.useState(item.objectType === "videoSlot" && item.userId && item.streamIndex ? `${item.userId}${fenge}${item.streamIndex}` : "");
|
|
304398
304389
|
const [currentTime, setCurrentTime] = reactExports.useState(0);
|
|
304399
304390
|
const [isPlay, setIsPlay] = reactExports.useState(false);
|
|
304400
304391
|
const [duration, setDuration] = reactExports.useState(0);
|
|
@@ -304583,7 +304574,6 @@ const MetaItem = ({
|
|
|
304583
304574
|
const {
|
|
304584
304575
|
token: token2
|
|
304585
304576
|
} = useToken2();
|
|
304586
|
-
const fenge = '-":}{_+';
|
|
304587
304577
|
const contentStyle = {
|
|
304588
304578
|
backgroundColor: token2.colorBgElevated,
|
|
304589
304579
|
borderRadius: token2.borderRadiusLG,
|
|
@@ -304638,6 +304628,9 @@ const MetaItem = ({
|
|
|
304638
304628
|
}
|
|
304639
304629
|
}, [callConfig.isCall]);
|
|
304640
304630
|
const targetUser = reactExports.useMemo(() => availableStreams.find((user) => user.rtc_userid === (selectedValue == null ? void 0 : selectedValue.split(fenge)[0])), [selectedValue, availableStreams]);
|
|
304631
|
+
console.log("selectedValue?.split(fenge)[0]", selectedValue == null ? void 0 : selectedValue.split(fenge)[0]);
|
|
304632
|
+
console.log("availableStreams", availableStreams);
|
|
304633
|
+
console.log("targetUser", targetUser);
|
|
304641
304634
|
reactExports.useEffect(() => {
|
|
304642
304635
|
var _a3;
|
|
304643
304636
|
if (item.objectType !== "videoSlot" || !livePlayerRef.current)
|
|
@@ -304695,11 +304688,6 @@ const MetaItem = ({
|
|
|
304695
304688
|
console.error("监听嘉宾视频状态变化时发生错误:", error2);
|
|
304696
304689
|
}
|
|
304697
304690
|
}, [targetUser, targetUser == null ? void 0 : targetUser.isVideoEnabled, item.userId, item.id, selectedValue]);
|
|
304698
|
-
reactExports.useEffect(() => {
|
|
304699
|
-
if (item.objectType === "videoSlot" && item.userId && item.streamIndex) {
|
|
304700
|
-
setSelectedValue(`${item.userId}${fenge}${item.streamIndex}`);
|
|
304701
|
-
}
|
|
304702
|
-
}, [item.objectType, item.id]);
|
|
304703
304691
|
reactExports.useEffect(() => {
|
|
304704
304692
|
setItems(item);
|
|
304705
304693
|
}, [item]);
|
|
@@ -305623,7 +305611,6 @@ const CallHome = () => {
|
|
|
305623
305611
|
const audioStreamRef = reactExports.useRef(/* @__PURE__ */ new Map());
|
|
305624
305612
|
const audioSourcesRef = reactExports.useRef([]);
|
|
305625
305613
|
reactExports.useEffect(() => {
|
|
305626
|
-
document.title = "菲耀直播";
|
|
305627
305614
|
updateCallConfig({
|
|
305628
305615
|
rule: "main",
|
|
305629
305616
|
live_id: Number(liveId || "")
|
|
@@ -306053,52 +306040,20 @@ const WebLiveIndex = () => {
|
|
|
306053
306040
|
}, []);
|
|
306054
306041
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(BrowserNotSupported, { children: isShowHome ? /* @__PURE__ */ jsxRuntimeExports.jsx(CallHome, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(LiveDetection, { setShowHome }) });
|
|
306055
306042
|
};
|
|
306056
|
-
const validateParam = (config2, paramName, message2) => {
|
|
306057
|
-
if (!config2[paramName]) {
|
|
306058
|
-
window.dispatchEvent(new CustomEvent("paramValidationError", {
|
|
306059
|
-
detail: {
|
|
306060
|
-
message: message2,
|
|
306061
|
-
details: {
|
|
306062
|
-
param: paramName,
|
|
306063
|
-
value: config2[paramName],
|
|
306064
|
-
type: "missing"
|
|
306065
|
-
}
|
|
306066
|
-
}
|
|
306067
|
-
}));
|
|
306068
|
-
return false;
|
|
306069
|
-
}
|
|
306070
|
-
return true;
|
|
306071
|
-
};
|
|
306072
306043
|
class CallLiveSdk {
|
|
306073
306044
|
constructor(config2) {
|
|
306045
|
+
var _a2;
|
|
306074
306046
|
this.root = null;
|
|
306075
|
-
|
|
306076
|
-
|
|
306077
|
-
|
|
306078
|
-
|
|
306079
|
-
|
|
306080
|
-
details: {
|
|
306081
|
-
param: "config",
|
|
306082
|
-
value: config2,
|
|
306083
|
-
type: "missing"
|
|
306084
|
-
}
|
|
306085
|
-
}
|
|
306086
|
-
}));
|
|
306087
|
-
return;
|
|
306088
|
-
}
|
|
306089
|
-
if (!validateParam(config2, "el", "挂载元素(el)不能为空"))
|
|
306090
|
-
return;
|
|
306091
|
-
if (!validateParam(config2, "liveId", "直播ID(liveId)不能为空"))
|
|
306092
|
-
return;
|
|
306093
|
-
if (!validateParam(config2, "agentId", "商户ID(agentId)不能为空"))
|
|
306094
|
-
return;
|
|
306095
|
-
if (!validateParam(config2, "sign", "签名信息(sign)不能为空"))
|
|
306096
|
-
return;
|
|
306047
|
+
["el", "liveId", "agentId", "sign"].forEach((key) => {
|
|
306048
|
+
if (!config2[key]) {
|
|
306049
|
+
throw new Error(`Missing required config parameter: ${key}`);
|
|
306050
|
+
}
|
|
306051
|
+
});
|
|
306097
306052
|
this.config = config2;
|
|
306098
306053
|
useSdkStore.setState({
|
|
306099
306054
|
callConfig: this.config
|
|
306100
306055
|
});
|
|
306101
|
-
saveSign(this.config.sign);
|
|
306056
|
+
saveSign((_a2 = this.config) == null ? void 0 : _a2.sign);
|
|
306102
306057
|
if (config2.apiDomain) {
|
|
306103
306058
|
setApiDomain(config2.apiDomain);
|
|
306104
306059
|
}
|
|
@@ -306107,10 +306062,9 @@ class CallLiveSdk {
|
|
|
306107
306062
|
* 初始化SDK
|
|
306108
306063
|
*/
|
|
306109
306064
|
init() {
|
|
306110
|
-
console.log(this.config);
|
|
306111
306065
|
const {
|
|
306112
306066
|
el: el2
|
|
306113
|
-
} = this.config;
|
|
306067
|
+
} = this.config || {};
|
|
306114
306068
|
const container = typeof el2 === "string" ? document.querySelector(el2) : el2;
|
|
306115
306069
|
if (!container) {
|
|
306116
306070
|
throw new Error(`Container element not found: ${el2}`);
|
|
@@ -306122,6 +306076,7 @@ class CallLiveSdk {
|
|
|
306122
306076
|
* 渲染SDK内容
|
|
306123
306077
|
*/
|
|
306124
306078
|
render() {
|
|
306079
|
+
var _a2;
|
|
306125
306080
|
if (!this.root) {
|
|
306126
306081
|
throw new Error("SDK not initialized");
|
|
306127
306082
|
}
|
|
@@ -306130,7 +306085,7 @@ class CallLiveSdk {
|
|
|
306130
306085
|
height: "100%"
|
|
306131
306086
|
},
|
|
306132
306087
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalErrorBoundary, {
|
|
306133
|
-
errorNotification: this.config.errorNotification,
|
|
306088
|
+
errorNotification: (_a2 = this.config) == null ? void 0 : _a2.errorNotification,
|
|
306134
306089
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(WebLiveIndex, {})
|
|
306135
306090
|
})
|
|
306136
306091
|
}));
|
|
@@ -306218,33 +306173,18 @@ class CallLiveSdk {
|
|
|
306218
306173
|
}
|
|
306219
306174
|
class GuestCallSdk {
|
|
306220
306175
|
constructor(config2) {
|
|
306176
|
+
var _a2;
|
|
306221
306177
|
this.root = null;
|
|
306222
|
-
|
|
306223
|
-
|
|
306224
|
-
|
|
306225
|
-
|
|
306226
|
-
|
|
306227
|
-
param: "config",
|
|
306228
|
-
value: config2,
|
|
306229
|
-
type: "missing"
|
|
306230
|
-
}
|
|
306231
|
-
}
|
|
306232
|
-
}));
|
|
306233
|
-
return;
|
|
306234
|
-
}
|
|
306235
|
-
if (!validateParam(config2, "el", "挂载元素(el)不能为空"))
|
|
306236
|
-
return;
|
|
306237
|
-
if (!validateParam(config2, "liveId", "直播ID(liveId)不能为空"))
|
|
306238
|
-
return;
|
|
306239
|
-
if (!validateParam(config2, "sign", "签名信息(sign)不能为空"))
|
|
306240
|
-
return;
|
|
306241
|
-
if (!validateParam(config2, "agentId", "商户ID(agentId)不能为空"))
|
|
306242
|
-
return;
|
|
306178
|
+
["el", "liveId", "agentId", "sign"].forEach((key) => {
|
|
306179
|
+
if (!config2[key]) {
|
|
306180
|
+
throw new Error(`Missing required config parameter: ${key}`);
|
|
306181
|
+
}
|
|
306182
|
+
});
|
|
306243
306183
|
this.config = config2;
|
|
306244
306184
|
useSdkStore.setState({
|
|
306245
306185
|
guestConfig: this.config
|
|
306246
306186
|
});
|
|
306247
|
-
saveSign(this.config.sign);
|
|
306187
|
+
saveSign((_a2 = this.config) == null ? void 0 : _a2.sign);
|
|
306248
306188
|
if (config2.apiDomain) {
|
|
306249
306189
|
setApiDomain(config2.apiDomain);
|
|
306250
306190
|
}
|
|
@@ -306255,7 +306195,7 @@ class GuestCallSdk {
|
|
|
306255
306195
|
init() {
|
|
306256
306196
|
const {
|
|
306257
306197
|
el: el2
|
|
306258
|
-
} = this.config;
|
|
306198
|
+
} = this.config || {};
|
|
306259
306199
|
const container = typeof el2 === "string" ? document.querySelector(el2) : el2;
|
|
306260
306200
|
if (!container) {
|
|
306261
306201
|
throw new Error(`Container element not found: ${el2}`);
|
|
@@ -306267,6 +306207,7 @@ class GuestCallSdk {
|
|
|
306267
306207
|
* 渲染SDK内容
|
|
306268
306208
|
*/
|
|
306269
306209
|
render() {
|
|
306210
|
+
var _a2;
|
|
306270
306211
|
if (!this.root) {
|
|
306271
306212
|
throw new Error("SDK not initialized");
|
|
306272
306213
|
}
|
|
@@ -306276,7 +306217,7 @@ class GuestCallSdk {
|
|
|
306276
306217
|
},
|
|
306277
306218
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(App$1, {
|
|
306278
306219
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalErrorBoundary, {
|
|
306279
|
-
errorNotification: this.config.errorNotification,
|
|
306220
|
+
errorNotification: (_a2 = this.config) == null ? void 0 : _a2.errorNotification,
|
|
306280
306221
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Guest, {})
|
|
306281
306222
|
})
|
|
306282
306223
|
})
|