call-live-sdk1 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25593,9 +25593,6 @@ var define_import_meta_env_default = {};
25593
25593
  const envConfig$1 = {
25594
25594
  // 环境名称
25595
25595
  env: define_import_meta_env_default.VITE_ENV || "development",
25596
- // 地图相关配置
25597
- amapKey: "d3e9b4bd66a3ed8533f2e5d01c24e273",
25598
- amapCode: "ff1c6caa84b5fe4e179dc6a84580995c",
25599
25596
  // SDK 授权配置
25600
25597
  queenSdkKey: "hP7in57avgV12eJB7dff0052b8ac0481da28769b23b37bc77",
25601
25598
  // API 相关配置
@@ -25615,24 +25612,28 @@ var GlobalErrorType = /* @__PURE__ */ ((GlobalErrorType2) => {
25615
25612
  })(GlobalErrorType || {});
25616
25613
  const envConfig = {
25617
25614
  callConfig: {
25618
- el: envConfig$1.env === "production" ? "" : "root",
25619
- sign: envConfig$1.env === "production" ? "" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlZGl0aW9uX2lkIjo0NywiZXhwIjoxNzY2OTg2NDY2LCJpYXQiOjE3NjYzODE2NjYsIm5iZiI6MTc2NjM4MTY2Niwic3ViX3VzZXJpZCI6MCwidXNlcmlkIjoiMzg3MzU5ODkifQ.PoX2zUuJycp_Qt8obbKNO1m6GcAWBYklaeIi2IgxnEI",
25620
- liveId: envConfig$1.env === "production" ? null : 53065,
25621
- title: envConfig$1.env === "production" ? "" : "test",
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" : "菲耀直播",
25622
25619
  components: {
25623
25620
  chat: { enabled: true },
25624
25621
  team: { enabled: true },
25625
25622
  call: { enabled: true, inviteLink: "" }
25626
25623
  },
25627
- agentId: envConfig$1.env === "production" ? null : 38735989,
25624
+ agentId: envConfig$1.env === "dev" ? 38735989 : null,
25628
25625
  apiDomain: envConfig$1.liveProxyUrl
25629
25626
  },
25630
25627
  guestConfig: {
25631
25628
  el: "",
25632
- sign: envConfig$1.env === "production" ? "" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlZGl0aW9uX2lkIjo0NywiZXhwIjoxNzY2OTg2NDY2LCJpYXQiOjE3NjYzODE2NjYsIm5iZiI6MTc2NjM4MTY2Niwic3ViX3VzZXJpZCI6MCwidXNlcmlkIjoiMzg3MzU5ODkifQ.PoX2zUuJycp_Qt8obbKNO1m6GcAWBYklaeIi2IgxnEI",
25633
- liveId: envConfig$1.env === "production" ? null : 53065,
25634
- agentId: envConfig$1.env === "production" ? null : 38735989,
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,
25635
25632
  apiDomain: envConfig$1.liveProxyUrl
25633
+ },
25634
+ styleConfig: {
25635
+ minHeight: 770,
25636
+ minWidth: 1500
25636
25637
  }
25637
25638
  };
25638
25639
  const useSdkStore = create$c((set3, get4) => ({
@@ -46579,10 +46580,14 @@ const errorConfig = {
46579
46580
  console.warn("Login expired, please re-login");
46580
46581
  }
46581
46582
  };
46582
- console.log("<<envConfig.env>>", envConfig$1);
46583
- console.log("=====>", envConfig$1.env === "production" ? useSdkStore.getState().getApiDomain() : envConfig$1);
46583
+ const map$d = {
46584
+ production: useSdkStore.getState().getApiDomain(),
46585
+ test: envConfig$1.liveProxyUrl,
46586
+ dev: ""
46587
+ };
46588
+ console.log("envConfig.env", envConfig$1.env);
46584
46589
  const axiosInstance = axios.create({
46585
- baseURL: envConfig$1.env === "production" ? useSdkStore.getState().getApiDomain() : envConfig$1.liveProxyUrl,
46590
+ baseURL: map$d[envConfig$1.env],
46586
46591
  // 只在生产环境设置基础 URL,开发环境使用代理
46587
46592
  timeout: 3e4,
46588
46593
  // 30秒超时
@@ -82396,6 +82401,259 @@ const useGuestStore = create$c()((set3, get4) => ({
82396
82401
  set3({ status });
82397
82402
  }
82398
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
+ };
82399
82657
  var VideoType = /* @__PURE__ */ ((VideoType2) => {
82400
82658
  VideoType2["CAMERA"] = "video";
82401
82659
  VideoType2["SCREEN"] = "screen";
@@ -83260,281 +83518,14 @@ const useCallStore = create$c()(
83260
83518
  const originalCanvas = fabricInstance == null ? void 0 : fabricInstance.lowerCanvasEl;
83261
83519
  if (!canvas || !context || !originalCanvas)
83262
83520
  return;
83263
- const prepareOffscreenCanvas = (targetCanvas) => {
83264
- let offscreenCanvas2 = get4().offscreenCanvasRef;
83265
- let offscreenContext2 = get4().offscreenContextRef;
83266
- if (!offscreenCanvas2 || offscreenCanvas2.width !== targetCanvas.width || offscreenCanvas2.height !== targetCanvas.height) {
83267
- offscreenCanvas2 = document.createElement("canvas");
83268
- offscreenCanvas2.width = targetCanvas.width;
83269
- offscreenCanvas2.height = targetCanvas.height;
83270
- offscreenContext2 = offscreenCanvas2.getContext("2d");
83271
- set3({
83272
- offscreenCanvasRef: offscreenCanvas2,
83273
- offscreenContextRef: offscreenContext2
83274
- });
83275
- }
83276
- return offscreenCanvas2;
83277
- };
83278
- const calculateAspectRatio = (area) => {
83279
- const targetAspectRatio = 16 / 9;
83280
- const currentAspectRatio = area.width / area.height;
83281
- let drawWidth = area.width;
83282
- let drawHeight = area.height;
83283
- let drawX = area.x;
83284
- let drawY = area.y;
83285
- if (currentAspectRatio > targetAspectRatio) {
83286
- drawWidth = area.height * targetAspectRatio;
83287
- drawX = area.x + (area.width - drawWidth) / 2;
83288
- } else {
83289
- drawHeight = area.width / targetAspectRatio;
83290
- drawY = area.y + (area.height - drawHeight) / 2;
83291
- }
83292
- return { drawX, drawY, drawWidth, drawHeight };
83293
- };
83294
- const renderGridLayout = (ctx2, canvas2, layout) => {
83295
- if (layout.callAreas && layout.callAreas.length > 0) {
83296
- layout.callAreas.forEach((area) => {
83297
- const { drawX, drawY, drawWidth, drawHeight } = calculateAspectRatio(area);
83298
- ctx2.fillStyle = "rgba(26, 26, 26, 0.8)";
83299
- ctx2.fillRect(drawX, drawY, drawWidth, drawHeight);
83300
- ctx2.strokeStyle = "rgba(51, 51, 51, 0.6)";
83301
- ctx2.lineWidth = 2;
83302
- ctx2.strokeRect(drawX, drawY, drawWidth, drawHeight);
83303
- if (!area.isVideoEnabled && area.domId.includes("screen")) {
83304
- get4().renderEmptyUserArea(ctx2, area, drawX, drawY, drawWidth, drawHeight);
83305
- } else {
83306
- const container = document.getElementById(area.domId);
83307
- if (container) {
83308
- const videoElement = container.querySelector("video");
83309
- if (videoElement) {
83310
- get4().drawUserVideoContent(
83311
- ctx2,
83312
- videoElement,
83313
- area,
83314
- drawX,
83315
- drawY,
83316
- drawWidth,
83317
- drawHeight
83318
- );
83319
- }
83320
- }
83321
- get4().drawUserInfo(ctx2, area, drawX, drawY, drawWidth, drawHeight);
83322
- get4().drawStatusIndicators(ctx2, area, drawX, drawY, drawWidth);
83323
- }
83324
- });
83325
- } else {
83326
- ctx2.fillStyle = "rgba(0, 0, 0, 0.3)";
83327
- ctx2.fillRect(0, 0, canvas2.width, canvas2.height);
83328
- ctx2.fillStyle = "#ffffff";
83329
- ctx2.font = "24px Arial";
83330
- ctx2.textAlign = "center";
83331
- ctx2.textBaseline = "middle";
83332
- ctx2.fillText("暂无连麦用户", canvas2.width / 2, canvas2.height / 2);
83333
- }
83334
- };
83335
- const renderMainPlusListLayout = (ctx2, canvas2, originalCanvas2, layout) => {
83336
- if (layout.mainArea) {
83337
- const mainCanvasId = get4().mainCanvasId;
83338
- const shouldRenderTargetVideo = mainCanvasId && mainCanvasId !== callConfig.drawing_board_id;
83339
- if (shouldRenderTargetVideo) {
83340
- const targetUser = callUsers.find((user) => {
83341
- return user.videoList && user.videoList.includes(mainCanvasId);
83342
- });
83343
- if (targetUser) {
83344
- if (!targetUser.isVideoEnabled && mainCanvasId.includes("screen")) {
83345
- get4().renderEmptyUserArea(
83346
- ctx2,
83347
- targetUser,
83348
- layout.mainArea.x,
83349
- layout.mainArea.y,
83350
- layout.mainArea.width,
83351
- layout.mainArea.height
83352
- );
83353
- } else {
83354
- try {
83355
- const videoWrap = document.getElementById(mainCanvasId);
83356
- const videoElement = videoWrap == null ? void 0 : videoWrap.querySelector("video");
83357
- if (videoElement && videoElement.tagName === "VIDEO") {
83358
- const videoWidth = videoElement.videoWidth;
83359
- const videoHeight = videoElement.videoHeight;
83360
- if (videoWidth > 0 && videoHeight > 0) {
83361
- const isUserMobile = targetUser.device === "mobile";
83362
- const mainAreaWidth = layout.mainArea.width;
83363
- const mainAreaHeight = layout.mainArea.height;
83364
- const scaleX = mainAreaWidth / videoWidth;
83365
- const scaleY = mainAreaHeight / videoHeight;
83366
- const scale2 = Math.min(scaleX, scaleY);
83367
- const drawWidth = videoWidth * scale2;
83368
- const drawHeight = videoHeight * scale2;
83369
- const drawX = layout.mainArea.x + (mainAreaWidth - drawWidth) / 2;
83370
- const drawY = layout.mainArea.y + (mainAreaHeight - drawHeight) / 2;
83371
- if (isUserMobile) {
83372
- ctx2.fillStyle = "#000000";
83373
- ctx2.fillRect(
83374
- layout.mainArea.x,
83375
- layout.mainArea.y,
83376
- mainAreaWidth,
83377
- mainAreaHeight
83378
- );
83379
- }
83380
- ctx2.drawImage(videoElement, drawX, drawY, drawWidth, drawHeight);
83381
- } else {
83382
- get4().renderEmptyUserArea(
83383
- ctx2,
83384
- targetUser,
83385
- layout.mainArea.x,
83386
- layout.mainArea.y,
83387
- layout.mainArea.width,
83388
- layout.mainArea.height
83389
- );
83390
- }
83391
- } else {
83392
- get4().renderEmptyUserArea(
83393
- ctx2,
83394
- targetUser,
83395
- layout.mainArea.x,
83396
- layout.mainArea.y,
83397
- layout.mainArea.width,
83398
- layout.mainArea.height
83399
- );
83400
- }
83401
- } catch (error2) {
83402
- console.error("主画布区域-绘制外部视频元素失败:", error2);
83403
- get4().renderEmptyUserArea(
83404
- ctx2,
83405
- targetUser,
83406
- layout.mainArea.x,
83407
- layout.mainArea.y,
83408
- layout.mainArea.width,
83409
- layout.mainArea.height
83410
- );
83411
- }
83412
- }
83413
- } else {
83414
- ctx2.fillStyle = "rgba(31, 41, 55, 0.7)";
83415
- ctx2.fillRect(
83416
- layout.mainArea.x,
83417
- layout.mainArea.y,
83418
- layout.mainArea.width,
83419
- layout.mainArea.height
83420
- );
83421
- }
83422
- } else {
83423
- ctx2.fillStyle = "rgb(0, 0, 0)";
83424
- ctx2.fillRect(
83425
- layout.mainArea.x,
83426
- layout.mainArea.y,
83427
- layout.mainArea.width,
83428
- layout.mainArea.height
83429
- );
83430
- ctx2.drawImage(
83431
- originalCanvas2,
83432
- 0,
83433
- 0,
83434
- originalCanvas2.width,
83435
- originalCanvas2.height,
83436
- layout.mainArea.x,
83437
- layout.mainArea.y,
83438
- layout.mainArea.width,
83439
- layout.mainArea.height
83440
- );
83441
- }
83442
- }
83443
- };
83444
- const renderUserVideoAreas = (context2, callAreas) => {
83445
- callAreas.forEach((area) => {
83446
- var _a2;
83447
- const { drawX, drawY, drawWidth, drawHeight } = calculateAspectRatio(area);
83448
- context2.save();
83449
- context2.fillStyle = "rgba(17, 24, 39, 0.8)";
83450
- context2.fillRect(drawX, drawY, drawWidth, drawHeight);
83451
- const container = document.getElementById(area.domId);
83452
- if (!container || !area.isVideoEnabled && !((_a2 = area.domId) == null ? void 0 : _a2.includes("screen"))) {
83453
- get4().renderEmptyUserArea(context2, area, drawX, drawY, drawWidth, drawHeight);
83454
- context2.restore();
83455
- return;
83456
- }
83457
- const videoElement = container.querySelector("video");
83458
- get4().drawUserVideoContent(
83459
- context2,
83460
- videoElement,
83461
- area,
83462
- drawX,
83463
- drawY,
83464
- drawWidth,
83465
- drawHeight
83466
- );
83467
- get4().drawUserInfo(context2, area, drawX, drawY, drawWidth, drawHeight);
83468
- get4().drawStatusIndicators(context2, area, drawX, drawY, drawWidth);
83469
- context2.restore();
83470
- });
83471
- };
83472
- const drawBackgroundImage = (ctx2, canvas2, backgroundImgUrl2) => {
83473
- const { backgroundImageRef, lastBackgroundImgUrlRef } = get4();
83474
- if (!backgroundImageRef || lastBackgroundImgUrlRef !== backgroundImgUrl2) {
83475
- const img = new Image();
83476
- img.src = backgroundImgUrl2;
83477
- img.crossOrigin = "anonymous";
83478
- set3({
83479
- backgroundImageRef: img,
83480
- lastBackgroundImgUrlRef: backgroundImgUrl2
83481
- });
83482
- img.onload = () => {
83483
- const { renderCompositeFrameSmooth } = get4();
83484
- renderCompositeFrameSmooth();
83485
- };
83486
- img.onerror = () => {
83487
- console.error("[CallStore] 背景图加载失败:", backgroundImgUrl2);
83488
- ctx2.fillStyle = "#000000";
83489
- ctx2.fillRect(0, 0, canvas2.width, canvas2.height);
83490
- };
83491
- } else if (backgroundImageRef.complete && backgroundImageRef.naturalWidth > 0) {
83492
- try {
83493
- ctx2.globalAlpha = 0.9;
83494
- const imgAspectRatio = backgroundImageRef.width / backgroundImageRef.height;
83495
- const canvasAspectRatio = canvas2.width / canvas2.height;
83496
- let drawWidth, drawHeight, drawX, drawY;
83497
- if (imgAspectRatio > canvasAspectRatio) {
83498
- drawHeight = canvas2.height;
83499
- drawWidth = canvas2.height * imgAspectRatio;
83500
- drawX = (canvas2.width - drawWidth) / 2;
83501
- drawY = 0;
83502
- } else {
83503
- drawWidth = canvas2.width;
83504
- drawHeight = canvas2.width / imgAspectRatio;
83505
- drawX = 0;
83506
- drawY = (canvas2.height - drawHeight) / 2;
83507
- }
83508
- ctx2.drawImage(
83509
- backgroundImageRef,
83510
- 0,
83511
- 0,
83512
- backgroundImageRef.width,
83513
- backgroundImageRef.height,
83514
- drawX,
83515
- drawY,
83516
- drawWidth,
83517
- drawHeight
83518
- );
83519
- ctx2.globalAlpha = 1;
83520
- } catch (error2) {
83521
- console.error("[CallStore] 背景图绘制失败:", error2);
83522
- ctx2.fillStyle = "rgba(0, 0, 0, 0.8)";
83523
- ctx2.fillRect(0, 0, canvas2.width, canvas2.height);
83524
- }
83525
- } else {
83526
- ctx2.fillStyle = "rgba(0, 0, 0, 0.8)";
83527
- ctx2.fillRect(0, 0, canvas2.width, canvas2.height);
83528
- }
83529
- };
83530
- const offscreenCanvas = prepareOffscreenCanvas(canvas);
83521
+ const offscreenCanvas = prepareOffscreenCanvas(canvas, get4, set3);
83531
83522
  const offscreenContext = offscreenCanvas.getContext("2d");
83532
83523
  if (!offscreenContext)
83533
83524
  return;
83534
83525
  offscreenContext.clearRect(0, 0, offscreenCanvas.width, offscreenCanvas.height);
83535
83526
  const backgroundImgUrl = callConfig.backgroundImg;
83536
83527
  if (callConfig.isCall && backgroundImgUrl && backgroundImgUrl.trim() !== "") {
83537
- drawBackgroundImage(offscreenContext, offscreenCanvas, backgroundImgUrl);
83528
+ drawBackgroundImage(offscreenContext, offscreenCanvas, backgroundImgUrl, get4, set3);
83538
83529
  } else {
83539
83530
  offscreenContext.fillStyle = "#000000";
83540
83531
  offscreenContext.fillRect(0, 0, offscreenCanvas.width, offscreenCanvas.height);
@@ -83543,14 +83534,22 @@ const useCallStore = create$c()(
83543
83534
  const layout = calculateLayout();
83544
83535
  switch (layoutMode) {
83545
83536
  case "grid":
83546
- renderGridLayout(offscreenContext, canvas, layout);
83537
+ renderGridLayout(offscreenContext, canvas, layout, get4);
83547
83538
  break;
83548
83539
  case "main_plus_list":
83549
- renderMainPlusListLayout(offscreenContext, canvas, originalCanvas, layout);
83540
+ renderMainPlusListLayout(
83541
+ offscreenContext,
83542
+ canvas,
83543
+ originalCanvas,
83544
+ layout,
83545
+ callConfig,
83546
+ callUsers,
83547
+ get4
83548
+ );
83550
83549
  break;
83551
83550
  }
83552
83551
  if (layout.callAreas.length) {
83553
- renderUserVideoAreas(offscreenContext, layout.callAreas);
83552
+ renderUserVideoAreas(offscreenContext, layout.callAreas, get4);
83554
83553
  }
83555
83554
  } else {
83556
83555
  const mainArea = {
@@ -83749,6 +83748,7 @@ const useCallStore = create$c()(
83749
83748
  }
83750
83749
  return result;
83751
83750
  }).filter(Boolean).map((track) => new MediaStream([track]));
83751
+ console.log("连麦音频混流", b2);
83752
83752
  set3({ callAudioStreamsRef: b2 });
83753
83753
  },
83754
83754
  handleRemoteUserPublishScreen: async (userId, isPublishing) => {
@@ -85377,13 +85377,12 @@ function useLiveInfo() {
85377
85377
  live_id
85378
85378
  }
85379
85379
  }).then((res) => {
85380
- console.log("直播信息请求成功:", res);
85381
85380
  if (res.success === false) {
85382
85381
  staticMethods.error(res.errorMessage);
85383
85382
  requestResult.cancel();
85384
- return res;
85383
+ return;
85385
85384
  }
85386
- return res;
85385
+ return res.data;
85387
85386
  }).catch((error22) => {
85388
85387
  console.error("直播信息请求失败,取消轮训:", error22);
85389
85388
  requestResult.cancel();
@@ -85563,7 +85562,6 @@ const Head = ({
85563
85562
  run: state.run,
85564
85563
  cancel: state.cancel
85565
85564
  }));
85566
- console.log("data,title", data2);
85567
85565
  const {
85568
85566
  fetchActivityType
85569
85567
  } = useActivityTypeStore();
@@ -85581,11 +85579,18 @@ const Head = ({
85581
85579
  const {
85582
85580
  livePushCode
85583
85581
  } = useLivePushCodeStore();
85582
+ const title = useSdkStore((state) => state.callConfig.title);
85584
85583
  const {
85585
- data: liveInfoData
85584
+ data: liveInfoData,
85585
+ run: runLiveInfo
85586
85586
  } = useRequest(() => request(`/bis/live-info?id=${liveId}`).then((res) => res.data), {
85587
- manual: callConfig.role !== "main"
85587
+ manual: true
85588
85588
  });
85589
+ reactExports.useEffect(() => {
85590
+ if (callConfig.rule === "main") {
85591
+ runLiveInfo();
85592
+ }
85593
+ }, [callConfig.rule]);
85589
85594
  const [isLive, setIsLive] = reactExports.useState(false);
85590
85595
  const [isCurrentPagePushing, setIsCurrentPagePushing] = reactExports.useState(false);
85591
85596
  const [isModalVisible, setIsModalVisible] = reactExports.useState(false);
@@ -86035,10 +86040,10 @@ const Head = ({
86035
86040
  }
86036
86041
  }, [data2 == null ? void 0 : data2.status]);
86037
86042
  reactExports.useEffect(() => {
86038
- if ((callConfig == null ? void 0 : callConfig.rule) === "main" && !isLive && (data2 == null ? void 0 : data2.is_pushing) !== void 0 && localPushingStatus !== (data2 == null ? void 0 : data2.is_pushing)) {
86043
+ if (!isLive) {
86039
86044
  checkPushingStatus();
86040
86045
  }
86041
- }, [data2 == null ? void 0 : data2.is_pushing, localPushingStatus, checkPushingStatus, isLive, callConfig == null ? void 0 : callConfig.rule]);
86046
+ }, [data2 == null ? void 0 : data2.is_pushing, localPushingStatus, checkPushingStatus, isLive]);
86042
86047
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
86043
86048
  className: "min-h-56px bg-#222933 px-26px flex items-center justify-between",
86044
86049
  children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
@@ -86050,7 +86055,7 @@ const Head = ({
86050
86055
  style: {
86051
86056
  lineHeight: 1
86052
86057
  },
86053
- children: (callConfig == null ? void 0 : callConfig.title) || "菲耀直播"
86058
+ children: title
86054
86059
  }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
86055
86060
  className: "w-1px h-18px bg-#fff mx-4"
86056
86061
  }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
@@ -195591,46 +195596,37 @@ const useDrawingToolsStore = create$c((set3, get4) => ({
195591
195596
  setPenSize: (size) => set3((state) => {
195592
195597
  const newSize = typeof size === "function" ? size(state.penSize) : size;
195593
195598
  return {
195594
- penSize: newSize,
195595
- penSizeRef: { current: newSize }
195599
+ penSize: newSize
195596
195600
  };
195597
195601
  }),
195598
195602
  penColor: "#ff5a5a",
195599
195603
  setPenColor: (color) => set3((state) => {
195600
195604
  const newColor = typeof color === "function" ? color(state.penColor) : color;
195601
195605
  return {
195602
- penColor: newColor,
195603
- penColorRef: { current: newColor }
195606
+ penColor: newColor
195604
195607
  };
195605
195608
  }),
195606
- penSizeRef: { current: 2 },
195607
- penColorRef: { current: "#ff5a5a" },
195608
195609
  // 激光笔设置
195609
195610
  laserPenSize: 2,
195610
195611
  setLaserPenSize: (size) => set3((state) => {
195611
195612
  const newSize = typeof size === "function" ? size(state.laserPenSize) : size;
195612
195613
  return {
195613
- laserPenSize: newSize,
195614
- laserPenSizeRef: { current: newSize }
195614
+ laserPenSize: newSize
195615
195615
  };
195616
195616
  }),
195617
195617
  laserPenColor: "#ff5a5a",
195618
195618
  setLaserPenColor: (color) => set3((state) => {
195619
195619
  const newColor = typeof color === "function" ? color(state.laserPenColor) : color;
195620
195620
  return {
195621
- laserPenColor: newColor,
195622
- laserPenColorRef: { current: newColor }
195621
+ laserPenColor: newColor
195623
195622
  };
195624
195623
  }),
195625
- laserPenSizeRef: { current: 2 },
195626
- laserPenColorRef: { current: "#ff5a5a" },
195627
195624
  // 形状设置
195628
195625
  shapeSize: 2,
195629
195626
  setShapeSize: (size) => set3((state) => {
195630
195627
  const newSize = typeof size === "function" ? size(state.shapeSize) : size;
195631
195628
  return {
195632
- shapeSize: newSize,
195633
- shapeSizeRef: { current: newSize }
195629
+ shapeSize: newSize
195634
195630
  };
195635
195631
  }),
195636
195632
  shapeType: "rect",
@@ -195645,39 +195641,32 @@ const useDrawingToolsStore = create$c((set3, get4) => ({
195645
195641
  setShapeColor: (color) => set3((state) => {
195646
195642
  const newColor = typeof color === "function" ? color(state.shapeColor) : color;
195647
195643
  return {
195648
- shapeColor: newColor,
195649
- shapeColorRef: { current: newColor }
195644
+ shapeColor: newColor
195650
195645
  };
195651
195646
  }),
195652
- shapeSizeRef: { current: 2 },
195653
- shapeTypeRef: { current: "rect" },
195654
- shapeColorRef: { current: "#ff5a5a" },
195655
195647
  // 文字设置
195656
195648
  textSize: 16,
195657
195649
  setTextSize: (size) => set3((state) => {
195658
195650
  const newSize = typeof size === "function" ? size(state.textSize) : size;
195659
195651
  return {
195660
- textSize: newSize,
195661
- textSizeRef: { current: newSize }
195652
+ textSize: newSize
195662
195653
  };
195663
195654
  }),
195664
195655
  textColor: "#ff5a5a",
195665
195656
  setTextColor: (color) => set3((state) => {
195666
195657
  const newColor = typeof color === "function" ? color(state.textColor) : color;
195667
195658
  return {
195668
- textColor: newColor,
195669
- textColorRef: { current: newColor }
195659
+ textColor: newColor
195670
195660
  };
195671
195661
  }),
195672
- textSizeRef: { current: 16 },
195673
- textColorRef: { current: "#ff5a5a" },
195674
195662
  // 预览弹窗状态
195675
195663
  isPreviewModalVisible: false,
195676
195664
  setIsPreviewModalVisible: (visible) => set3({ isPreviewModalVisible: visible }),
195677
195665
  // 绘图相关引用
195678
195666
  downPoint: { current: null },
195679
195667
  upPoint: { current: null },
195680
- currentShape: { current: null }
195668
+ currentShape: { current: null },
195669
+ getter: () => get4()
195681
195670
  }));
195682
195671
  const useCallUserPagination = (config2) => {
195683
195672
  const { gridCols } = config2;
@@ -196128,7 +196117,7 @@ const CallUserVideo = reactExports.memo(({
196128
196117
  }
196129
196118
  },
196130
196119
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
196131
- className: "relative h-full bg-gray-900",
196120
+ className: "relative w-full h-full bg-gray-900",
196132
196121
  style: {
196133
196122
  aspectRatio: "16/9"
196134
196123
  },
@@ -196322,14 +196311,14 @@ const CallGridLayout = ({
196322
196311
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(CallUserVideo, {
196323
196312
  user: callCurrentUser,
196324
196313
  video_id: callCurrentUser.rtc_userid + "screen",
196325
- className: `min-h-0 aspect-video h-full object-cover`
196314
+ className: `min-h-0 aspect-video w-full h-full object-cover`
196326
196315
  }, "local-player-screen")
196327
196316
  }), currentPage === 1 && (callCurrentUser == null ? void 0 : callCurrentUser.rtc_userid) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
196328
196317
  style: videoItemStyle,
196329
196318
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(CallUserVideo, {
196330
196319
  user: callCurrentUser,
196331
196320
  video_id: callCurrentUser.rtc_userid,
196332
- className: `min-h-0 aspect-video h-full object-cover`
196321
+ className: `min-h-0 aspect-video w-full h-full object-cover`
196333
196322
  }, "local-player")
196334
196323
  }), currentPageUsers.map((user) => {
196335
196324
  if (user.rtc_userid === callConfig.rtc_userid && currentPage === 1) {
@@ -196341,14 +196330,14 @@ const CallGridLayout = ({
196341
196330
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(CallUserVideo, {
196342
196331
  user,
196343
196332
  video_id: user.rtc_userid + "screen",
196344
- className: `min-h-0 aspect-video h-full object-cover`
196333
+ className: `min-h-0 aspect-video w-full h-full object-cover`
196345
196334
  }, user.rtc_userid + "screen")
196346
196335
  }), user.rtc_userid && /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
196347
196336
  style: videoItemStyle,
196348
196337
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(CallUserVideo, {
196349
196338
  user,
196350
196339
  video_id: user.rtc_userid,
196351
- className: `min-h-0 aspect-video h-full object-cover`
196340
+ className: `min-h-0 aspect-video w-full h-full object-cover`
196352
196341
  }, user.rtc_userid)
196353
196342
  })]
196354
196343
  }, user.rtc_userid);
@@ -265727,7 +265716,7 @@ const Document$1 = ({
265727
265716
  return /* @__PURE__ */ jsxRuntimeExports.jsx("a", {
265728
265717
  href: r3.buy_url,
265729
265718
  target: "_blank",
265730
- className: "flex text-stone-500",
265719
+ className: "text-[--call-live-sdk-color-primary]",
265731
265720
  rel: "noreferrer",
265732
265721
  children: r3.name
265733
265722
  });
@@ -266087,13 +266076,13 @@ const Document$1 = ({
266087
266076
  title: "预览文档",
266088
266077
  width: 715,
266089
266078
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
266090
- className: "w-670px pt-4 h-430px bg-#e8e8e8 flex items-center flex-col",
266079
+ className: "w-670px pt-4 h-430px bg-#1a1a1a flex items-center flex-col",
266091
266080
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx("img", {
266092
266081
  src: urlList[listIndex],
266093
- className: " h-92 object-contain"
266082
+ className: " h-92 object-contain bg-#0e121c p-4 rounded"
266094
266083
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
266095
- className: "flex items-center h-40px",
266096
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
266084
+ className: "flex items-center h-40px text-white",
266085
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, {
266097
266086
  onClick: () => {
266098
266087
  if (listIndex > 0) {
266099
266088
  setListIndex(listIndex - 1);
@@ -266101,12 +266090,13 @@ const Document$1 = ({
266101
266090
  setListIndex(urlList.length - 1);
266102
266091
  }
266103
266092
  },
266104
- className: " cursor-pointer bg-white px-2",
266093
+ type: "primary",
266094
+ ghost: true,
266105
266095
  children: "上一页"
266106
266096
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
266107
- className: "mx-2",
266097
+ className: "mx-2 text-white",
266108
266098
  children: [listIndex + 1, "/", urlList.length]
266109
- }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
266099
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, {
266110
266100
  onClick: () => {
266111
266101
  if (listIndex < urlList.length - 1) {
266112
266102
  setListIndex(listIndex + 1);
@@ -266114,7 +266104,8 @@ const Document$1 = ({
266114
266104
  setListIndex(0);
266115
266105
  }
266116
266106
  },
266117
- className: " cursor-pointer bg-white px-2",
266107
+ type: "primary",
266108
+ ghost: true,
266118
266109
  children: "下一页"
266119
266110
  })]
266120
266111
  })]
@@ -266211,7 +266202,6 @@ const DocumentControler = ({
266211
266202
  setDocumentIndex(selectedScene.documentIndex);
266212
266203
  handleImageClick(selectedScene.documentIndex);
266213
266204
  }, [currentScene]);
266214
- console.log("documentInfo", documentInfo);
266215
266205
  reactExports.useEffect(() => {
266216
266206
  if (!documentInfo.name) {
266217
266207
  setDocumentScrollLeft(0);
@@ -266528,30 +266518,20 @@ const ToolOption = reactExports.memo(({
266528
266518
  });
266529
266519
  });
266530
266520
  ToolOption.displayName = "ToolOption";
266521
+ const COLORS = ["#ff5a5a", "#ffbf48", "#3a9bff", "#58efb8", "#000000", "#808080", "#ffffff"];
266522
+ const LINE_SIZES = [2, 4, 6];
266523
+ const TEXT_SIZES = [16, 20, 24, 28, 32];
266524
+ const TOOL_IDS = {
266525
+ SELECT: 1,
266526
+ PEN: 2,
266527
+ LASER_PEN: 3,
266528
+ SHAPE: 4,
266529
+ TEXT: 5
266530
+ };
266531
266531
  const DrawingToolbar = ({
266532
266532
  onToolClick,
266533
266533
  onClearCanvas,
266534
- onPreviewClick,
266535
- // 初始值 - 仅用于初始化,实际状态由 model 管理
266536
- initialPenSize = 2,
266537
- initialPenColor = "#ff5a5a",
266538
- initialLaserPenSize = 2,
266539
- initialLaserPenColor = "#ff5a5a",
266540
- initialShapeSize = 2,
266541
- initialShapeType = "rect",
266542
- initialShapeColor = "#ff5a5a",
266543
- initialTextSize = 16,
266544
- initialTextColor = "#ff5a5a",
266545
- // 状态更新回调 - 用于向父组件通知变化
266546
- onPenSizeChange,
266547
- onPenColorChange,
266548
- onLaserPenSizeChange,
266549
- onLaserPenColorChange,
266550
- onShapeSizeChange,
266551
- onShapeTypeChange,
266552
- onShapeColorChange,
266553
- onTextSizeChange,
266554
- onTextColorChange
266534
+ onPreviewClick
266555
266535
  }) => {
266556
266536
  const {
266557
266537
  // 工具选择
@@ -266582,114 +266562,23 @@ const DrawingToolbar = ({
266582
266562
  // 预览弹窗状态
266583
266563
  setIsPreviewModalVisible
266584
266564
  } = useDrawingToolsStore();
266585
- const prevPropsRef = reactExports.useRef({
266586
- initialPenSize,
266587
- initialPenColor,
266588
- initialLaserPenSize,
266589
- initialLaserPenColor,
266590
- initialShapeSize,
266591
- initialShapeType,
266592
- initialShapeColor,
266593
- initialTextSize,
266594
- initialTextColor
266595
- });
266596
- reactExports.useEffect(() => {
266597
- const prevProps = prevPropsRef.current;
266598
- if (prevProps.initialPenSize !== initialPenSize) {
266599
- setPenSize(initialPenSize);
266600
- prevPropsRef.current.initialPenSize = initialPenSize;
266601
- }
266602
- if (prevProps.initialPenColor !== initialPenColor) {
266603
- setPenColor(initialPenColor);
266604
- prevPropsRef.current.initialPenColor = initialPenColor;
266605
- }
266606
- if (prevProps.initialLaserPenSize !== initialLaserPenSize) {
266607
- setLaserPenSize(initialLaserPenSize);
266608
- prevPropsRef.current.initialLaserPenSize = initialLaserPenSize;
266609
- }
266610
- if (prevProps.initialLaserPenColor !== initialLaserPenColor) {
266611
- setLaserPenColor(initialLaserPenColor);
266612
- prevPropsRef.current.initialLaserPenColor = initialLaserPenColor;
266613
- }
266614
- if (prevProps.initialShapeSize !== initialShapeSize) {
266615
- setShapeSize(initialShapeSize);
266616
- prevPropsRef.current.initialShapeSize = initialShapeSize;
266617
- }
266618
- if (prevProps.initialShapeType !== initialShapeType) {
266619
- setShapeType(initialShapeType);
266620
- prevPropsRef.current.initialShapeType = initialShapeType;
266621
- }
266622
- if (prevProps.initialShapeColor !== initialShapeColor) {
266623
- setShapeColor(initialShapeColor);
266624
- prevPropsRef.current.initialShapeColor = initialShapeColor;
266625
- }
266626
- if (prevProps.initialTextSize !== initialTextSize) {
266627
- setTextSize(initialTextSize);
266628
- prevPropsRef.current.initialTextSize = initialTextSize;
266629
- }
266630
- if (prevProps.initialTextColor !== initialTextColor) {
266631
- setTextColor(initialTextColor);
266632
- prevPropsRef.current.initialTextColor = initialTextColor;
266633
- }
266634
- }, [initialPenSize, initialPenColor, initialLaserPenSize, initialLaserPenColor, initialShapeSize, initialShapeType, initialShapeColor, initialTextSize, initialTextColor]);
266635
266565
  const handleToolClick = (tool) => {
266636
266566
  setSelectedTool(tool);
266637
266567
  onToolClick(tool);
266638
266568
  };
266639
- const handlePenSizeChange = (size) => {
266640
- setPenSize(size);
266641
- if (onPenSizeChange)
266642
- onPenSizeChange(size);
266643
- setTimeout(() => onToolClick(2));
266644
- };
266645
- const handlePenColorChange = (color) => {
266646
- setPenColor(color);
266647
- if (onPenColorChange)
266648
- onPenColorChange(color);
266649
- setTimeout(() => onToolClick(2));
266650
- };
266651
- const handleLaserPenSizeChange = (size) => {
266652
- setLaserPenSize(size);
266653
- if (onLaserPenSizeChange)
266654
- onLaserPenSizeChange(size);
266655
- setTimeout(() => onToolClick(3));
266656
- };
266657
- const handleLaserPenColorChange = (color) => {
266658
- setLaserPenColor(color);
266659
- if (onLaserPenColorChange)
266660
- onLaserPenColorChange(color);
266661
- setTimeout(() => onToolClick(3));
266662
- };
266663
- const handleShapeSizeChange = (size) => {
266664
- setShapeSize(size);
266665
- if (onShapeSizeChange)
266666
- onShapeSizeChange(size);
266667
- setTimeout(() => onToolClick(4));
266668
- };
266669
- const handleShapeTypeChange = (type4) => {
266670
- setShapeType(type4);
266671
- if (onShapeTypeChange)
266672
- onShapeTypeChange(type4);
266673
- setTimeout(() => onToolClick(4));
266674
- };
266675
- const handleShapeColorChange = (color) => {
266676
- setShapeColor(color);
266677
- if (onShapeColorChange)
266678
- onShapeColorChange(color);
266679
- setTimeout(() => onToolClick(4));
266680
- };
266681
- const handleTextSizeChange = (size) => {
266682
- setTextSize(size);
266683
- if (onTextSizeChange)
266684
- onTextSizeChange(size);
266685
- setTimeout(() => onToolClick(5));
266686
- };
266687
- const handleTextColorChange = (color) => {
266688
- setTextColor(color);
266689
- if (onTextColorChange)
266690
- onTextColorChange(color);
266691
- setTimeout(() => onToolClick(5));
266692
- };
266569
+ const handleToolSettingChange = (setter, toolId) => (value) => {
266570
+ setter(value);
266571
+ setTimeout(() => onToolClick(toolId));
266572
+ };
266573
+ const handlePenSizeChange = handleToolSettingChange(setPenSize, TOOL_IDS.PEN);
266574
+ const handlePenColorChange = handleToolSettingChange(setPenColor, TOOL_IDS.PEN);
266575
+ const handleLaserPenSizeChange = handleToolSettingChange(setLaserPenSize, TOOL_IDS.LASER_PEN);
266576
+ const handleLaserPenColorChange = handleToolSettingChange(setLaserPenColor, TOOL_IDS.LASER_PEN);
266577
+ const handleShapeSizeChange = handleToolSettingChange(setShapeSize, TOOL_IDS.SHAPE);
266578
+ const handleShapeTypeChange = handleToolSettingChange(setShapeType, TOOL_IDS.SHAPE);
266579
+ const handleShapeColorChange = handleToolSettingChange(setShapeColor, TOOL_IDS.SHAPE);
266580
+ const handleTextSizeChange = handleToolSettingChange(setTextSize, TOOL_IDS.TEXT);
266581
+ const handleTextColorChange = handleToolSettingChange(setTextColor, TOOL_IDS.TEXT);
266693
266582
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
266694
266583
  className: "flex items-center",
266695
266584
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
@@ -266700,10 +266589,10 @@ const DrawingToolbar = ({
266700
266589
  children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
266701
266590
  className: "w-32px h-32px flex justify-center items-center cursor-pointer hover:bg-#12151a",
266702
266591
  style: {
266703
- background: selectedTool === 1 ? "#12151a" : "",
266704
- color: selectedTool === 1 ? "#6672fc" : "#fff"
266592
+ background: selectedTool === TOOL_IDS.SELECT ? "#12151a" : "",
266593
+ color: selectedTool === TOOL_IDS.SELECT ? "#6672fc" : "#fff"
266705
266594
  },
266706
- onClick: () => handleToolClick(1),
266595
+ onClick: () => handleToolClick(TOOL_IDS.SELECT),
266707
266596
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(SvgGuideO, {
266708
266597
  className: "text-24px"
266709
266598
  })
@@ -266713,11 +266602,11 @@ const DrawingToolbar = ({
266713
266602
  optionContent: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
266714
266603
  className: "w-260px py-4 px-3 flex flex-col justify-between",
266715
266604
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(SizePicker, {
266716
- sizes: [2, 4, 6],
266605
+ sizes: LINE_SIZES,
266717
266606
  selectedSize: penSize,
266718
266607
  onSizeChange: handlePenSizeChange
266719
266608
  }), /* @__PURE__ */ jsxRuntimeExports.jsx(ColorPicker, {
266720
- colors: ["#ff5a5a", "#ffbf48", "#3a9bff", "#58efb8", "#000000", "#808080", "#ffffff"],
266609
+ colors: COLORS,
266721
266610
  selectedColor: penColor,
266722
266611
  onColorChange: handlePenColorChange
266723
266612
  })]
@@ -266729,10 +266618,10 @@ const DrawingToolbar = ({
266729
266618
  children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
266730
266619
  className: "w-32px h-32px flex justify-center items-center cursor-pointer hover:bg-#12151a",
266731
266620
  style: {
266732
- background: selectedTool === 2 ? "#12151a" : "",
266733
- color: selectedTool === 2 ? "#6672fc" : "#fff"
266621
+ background: selectedTool === TOOL_IDS.PEN ? "#12151a" : "",
266622
+ color: selectedTool === TOOL_IDS.PEN ? "#6672fc" : "#fff"
266734
266623
  },
266735
- onClick: () => handleToolClick(2),
266624
+ onClick: () => handleToolClick(TOOL_IDS.PEN),
266736
266625
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(SvgEdit, {
266737
266626
  className: "text-18px"
266738
266627
  })
@@ -266743,11 +266632,11 @@ const DrawingToolbar = ({
266743
266632
  optionContent: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
266744
266633
  className: "w-260px py-4 px-3 flex flex-col justify-between",
266745
266634
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(SizePicker, {
266746
- sizes: [2, 4, 6],
266635
+ sizes: LINE_SIZES,
266747
266636
  selectedSize: laserPenSize,
266748
266637
  onSizeChange: handleLaserPenSizeChange
266749
266638
  }), /* @__PURE__ */ jsxRuntimeExports.jsx(ColorPicker, {
266750
- colors: ["#ff5a5a", "#ffbf48", "#3a9bff", "#58efb8", "#000000", "#808080", "#ffffff"],
266639
+ colors: COLORS,
266751
266640
  selectedColor: laserPenColor,
266752
266641
  onColorChange: handleLaserPenColorChange
266753
266642
  })]
@@ -266759,10 +266648,10 @@ const DrawingToolbar = ({
266759
266648
  children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
266760
266649
  className: "w-32px h-32px flex justify-center items-center cursor-pointer hover:bg-#12151a",
266761
266650
  style: {
266762
- background: selectedTool === 3 ? "#12151a" : "",
266763
- color: selectedTool === 3 ? "#6672fc" : "#fff"
266651
+ background: selectedTool === TOOL_IDS.LASER_PEN ? "#12151a" : "",
266652
+ color: selectedTool === TOOL_IDS.LASER_PEN ? "#6672fc" : "#fff"
266764
266653
  },
266765
- onClick: () => handleToolClick(3),
266654
+ onClick: () => handleToolClick(TOOL_IDS.LASER_PEN),
266766
266655
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$r, {
266767
266656
  className: "text-18px"
266768
266657
  })
@@ -266777,7 +266666,7 @@ const DrawingToolbar = ({
266777
266666
  marginBottom: 10
266778
266667
  },
266779
266668
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(SizePicker, {
266780
- sizes: [2, 4, 6],
266669
+ sizes: LINE_SIZES,
266781
266670
  selectedSize: shapeSize,
266782
266671
  onSizeChange: handleShapeSizeChange
266783
266672
  }), /* @__PURE__ */ jsxRuntimeExports.jsx(ShapeTypePicker, {
@@ -266786,7 +266675,7 @@ const DrawingToolbar = ({
266786
266675
  onTypeChange: handleShapeTypeChange
266787
266676
  })]
266788
266677
  }), /* @__PURE__ */ jsxRuntimeExports.jsx(ColorPicker, {
266789
- colors: ["#ff5a5a", "#ffbf48", "#3a9bff", "#58efb8", "#000000", "#808080", "#ffffff"],
266678
+ colors: COLORS,
266790
266679
  selectedColor: shapeColor,
266791
266680
  onColorChange: handleShapeColorChange
266792
266681
  })]
@@ -266798,10 +266687,10 @@ const DrawingToolbar = ({
266798
266687
  children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
266799
266688
  className: "w-32px h-32px flex justify-center items-center cursor-pointer hover:bg-#12151a",
266800
266689
  style: {
266801
- background: selectedTool === 4 ? "#12151a" : "",
266802
- color: selectedTool === 4 ? "#6672fc" : "#fff"
266690
+ background: selectedTool === TOOL_IDS.SHAPE ? "#12151a" : "",
266691
+ color: selectedTool === TOOL_IDS.SHAPE ? "#6672fc" : "#fff"
266803
266692
  },
266804
- onClick: () => handleToolClick(4),
266693
+ onClick: () => handleToolClick(TOOL_IDS.SHAPE),
266805
266694
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$p, {
266806
266695
  className: "text-18px"
266807
266696
  })
@@ -266812,11 +266701,11 @@ const DrawingToolbar = ({
266812
266701
  optionContent: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
266813
266702
  className: "w-260px py-4 px-3 flex flex-col justify-between",
266814
266703
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(TextSizePicker, {
266815
- sizes: [16, 20, 24, 28, 32],
266704
+ sizes: TEXT_SIZES,
266816
266705
  selectedSize: textSize,
266817
266706
  onSizeChange: handleTextSizeChange
266818
266707
  }), /* @__PURE__ */ jsxRuntimeExports.jsx(ColorPicker, {
266819
- colors: ["#ff5a5a", "#ffbf48", "#3a9bff", "#58efb8", "#000000", "#808080", "#ffffff"],
266708
+ colors: COLORS,
266820
266709
  selectedColor: textColor,
266821
266710
  onColorChange: handleTextColorChange
266822
266711
  })]
@@ -266828,10 +266717,10 @@ const DrawingToolbar = ({
266828
266717
  children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
266829
266718
  className: "w-32px h-32px flex justify-center items-center cursor-pointer hover:bg-#12151a",
266830
266719
  style: {
266831
- background: selectedTool === 5 ? "#12151a" : "",
266832
- color: selectedTool === 5 ? "#6672fc" : "#fff"
266720
+ background: selectedTool === TOOL_IDS.TEXT ? "#12151a" : "",
266721
+ color: selectedTool === TOOL_IDS.TEXT ? "#6672fc" : "#fff"
266833
266722
  },
266834
- onClick: () => handleToolClick(5),
266723
+ onClick: () => handleToolClick(TOOL_IDS.TEXT),
266835
266724
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$e, {
266836
266725
  className: "text-18px"
266837
266726
  })
@@ -267049,14 +266938,11 @@ const LivePlayer = ({
267049
266938
  callUsers: state.callUsers,
267050
266939
  toggleRightSidebar: state.toggleRightSidebar
267051
266940
  }));
267052
- useSdkStore((state) => state.callConfig.el);
267053
266941
  const canvasRef = reactExports.useRef(null);
267054
266942
  const canvasContainerRef = reactExports.useRef(null);
267055
266943
  const streamRef = reactExports.useRef(null);
267056
266944
  const streamContainerRef = reactExports.useRef(null);
267057
266945
  const {
267058
- // 工具选择
267059
- selectedTool,
267060
266946
  setSelectedTool,
267061
266947
  // 绘图相关引用
267062
266948
  downPoint,
@@ -267064,37 +266950,37 @@ const LivePlayer = ({
267064
266950
  currentShape,
267065
266951
  // 形状设置
267066
266952
  shapeType,
267067
- setShapeType,
267068
- shapeTypeRef,
267069
266953
  shapeColor,
267070
- setShapeColor,
267071
- shapeColorRef,
267072
266954
  shapeSize,
267073
- setShapeSize,
267074
- shapeSizeRef,
267075
266955
  // 画笔设置
267076
266956
  penColor,
267077
- setPenColor,
267078
- penColorRef,
267079
266957
  penSize,
267080
- setPenSize,
267081
- penSizeRef,
267082
266958
  // 激光笔设置
267083
266959
  laserPenColor,
267084
- setLaserPenColor,
267085
- laserPenColorRef,
267086
266960
  laserPenSize,
267087
- setLaserPenSize,
267088
- laserPenSizeRef,
267089
266961
  // 文字设置
267090
266962
  textColor,
267091
- setTextColor,
267092
- textColorRef,
267093
266963
  textSize,
267094
- setTextSize,
267095
- textSizeRef,
267096
- setIsPreviewModalVisible
267097
- } = useDrawingToolsStore();
266964
+ // 预览弹窗状态
266965
+ setIsPreviewModalVisible,
266966
+ getter: getDrawing
266967
+ } = useDrawingToolsStore((state) => ({
266968
+ setSelectedTool: state.setSelectedTool,
266969
+ downPoint: state.downPoint,
266970
+ upPoint: state.upPoint,
266971
+ currentShape: state.currentShape,
266972
+ shapeType: state.shapeType,
266973
+ shapeColor: state.shapeColor,
266974
+ shapeSize: state.shapeSize,
266975
+ penColor: state.penColor,
266976
+ penSize: state.penSize,
266977
+ laserPenColor: state.laserPenColor,
266978
+ laserPenSize: state.laserPenSize,
266979
+ textColor: state.textColor,
266980
+ textSize: state.textSize,
266981
+ getter: state.getter,
266982
+ setIsPreviewModalVisible: state.setIsPreviewModalVisible
266983
+ }));
267098
266984
  const canvasSettingRef = reactExports.useRef("horizontal");
267099
266985
  const worker = reactExports.useRef(null);
267100
266986
  const isWorkerRunning = reactExports.useRef(false);
@@ -267631,9 +267517,9 @@ const LivePlayer = ({
267631
267517
  };
267632
267518
  const drawShapeMouseDown = (e3) => {
267633
267519
  downPoint.current = e3.absolutePointer;
267634
- const shapeType2 = shapeTypeRef.current;
267635
- const shapeColor2 = shapeColorRef.current;
267636
- const shapeSize2 = shapeSizeRef.current;
267520
+ const shapeType2 = getDrawing().shapeType;
267521
+ const shapeColor2 = getDrawing().shapeColor;
267522
+ const shapeSize2 = getDrawing().shapeSize;
267637
267523
  if (shapeType2 === "circle" || shapeType2 === "rect") {
267638
267524
  currentShape.current = shapeType2 === "circle" ? new xo({
267639
267525
  left: downPoint.current.x,
@@ -267661,7 +267547,7 @@ const LivePlayer = ({
267661
267547
  const drawShapeMouseMove = (e3) => {
267662
267548
  if (!currentShape.current)
267663
267549
  return;
267664
- const shapeType2 = shapeTypeRef.current;
267550
+ const shapeType2 = getDrawing().shapeType;
267665
267551
  const currentPoint = e3.absolutePointer;
267666
267552
  const dx = currentPoint.x - downPoint.current.x;
267667
267553
  const dy = currentPoint.y - downPoint.current.y;
@@ -267695,7 +267581,7 @@ const LivePlayer = ({
267695
267581
  canvasRequestRenderAll();
267696
267582
  };
267697
267583
  const drawShareMouseUp = () => {
267698
- const shapeColor2 = shapeColorRef.current;
267584
+ const shapeColor2 = getDrawing().shapeColor;
267699
267585
  if (currentShape.current) {
267700
267586
  if (JSON.stringify(downPoint.current) === JSON.stringify(upPoint.current)) {
267701
267587
  return;
@@ -267710,8 +267596,8 @@ const LivePlayer = ({
267710
267596
  const drawTextMouseDown = (e3) => {
267711
267597
  var _a3;
267712
267598
  const pointer = (_a3 = getter().fabricInstance) == null ? void 0 : _a3.getPointer(e3.e);
267713
- const textColor2 = textColorRef.current;
267714
- const textSize2 = textSizeRef.current;
267599
+ const textColor2 = getDrawing().textColor;
267600
+ const textSize2 = getDrawing().textSize;
267715
267601
  if (pointer) {
267716
267602
  const {
267717
267603
  x,
@@ -267732,8 +267618,8 @@ const LivePlayer = ({
267732
267618
  };
267733
267619
  const enablePenDrawing = () => {
267734
267620
  const canvas = getter().fabricInstance;
267735
- const penColor2 = penColorRef.current;
267736
- const penSize2 = penSizeRef.current;
267621
+ const penColor2 = getDrawing().penColor;
267622
+ const penSize2 = getDrawing().penSize;
267737
267623
  const pencilBrush = new oo(canvas);
267738
267624
  pencilBrush.color = penColor2;
267739
267625
  pencilBrush.width = penSize2;
@@ -267744,8 +267630,8 @@ const LivePlayer = ({
267744
267630
  };
267745
267631
  const enableLaserPenDrawing = () => {
267746
267632
  const canvas = getter().fabricInstance;
267747
- const laserPenColor2 = laserPenColorRef.current;
267748
- const laserPenSize2 = laserPenSizeRef.current;
267633
+ const laserPenColor2 = getDrawing().laserPenColor;
267634
+ const laserPenSize2 = getDrawing().laserPenSize;
267749
267635
  const pencilBrush = new oo(canvas);
267750
267636
  pencilBrush.color = laserPenColor2;
267751
267637
  pencilBrush.width = laserPenSize2;
@@ -269038,6 +268924,7 @@ const LivePlayer = ({
269038
268924
  console.log("loadCanvasState", newObj);
269039
268925
  setFabricObjects(newObj);
269040
268926
  },
268927
+ getRtmpRef: () => rtmpRef,
269041
268928
  getActiveVideoStreams: () => activeVideoStreamsRef.current,
269042
268929
  getMicrophoneStreams: () => microphoneStreamsRef.current,
269043
268930
  getBackgroundAudioStreams: () => backgroundAudioStreamsRef.current,
@@ -269247,28 +269134,9 @@ const LivePlayer = ({
269247
269134
  children: [isMainRole && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
269248
269135
  className: " flex items-center justify-center h-48px gap-5 bg-#222933",
269249
269136
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(DrawingToolbar, {
269250
- selectedTool,
269251
269137
  onToolClick: clickTool,
269252
269138
  onClearCanvas: clearCanvas,
269253
- onPreviewClick: () => setIsPreviewModalVisible(true),
269254
- initialPenSize: penSize,
269255
- initialPenColor: penColor,
269256
- initialLaserPenSize: laserPenSize,
269257
- initialLaserPenColor: laserPenColor,
269258
- initialShapeSize: shapeSize,
269259
- initialShapeType: shapeType,
269260
- initialShapeColor: shapeColor,
269261
- initialTextSize: textSize,
269262
- initialTextColor: textColor,
269263
- onPenSizeChange: setPenSize,
269264
- onPenColorChange: setPenColor,
269265
- onLaserPenSizeChange: setLaserPenSize,
269266
- onLaserPenColorChange: setLaserPenColor,
269267
- onShapeSizeChange: setShapeSize,
269268
- onShapeTypeChange: setShapeType,
269269
- onShapeColorChange: setShapeColor,
269270
- onTextSizeChange: setTextSize,
269271
- onTextColorChange: setTextColor
269139
+ onPreviewClick: () => setIsPreviewModalVisible(true)
269272
269140
  }), callConfig.isCall && /* @__PURE__ */ jsxRuntimeExports.jsx(LayoutSwitcher, {
269273
269141
  className: "absolute right-10",
269274
269142
  currentLayout: layoutMode,
@@ -269301,12 +269169,12 @@ const LivePlayer = ({
269301
269169
  })
269302
269170
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
269303
269171
  id: "video-container",
269304
- className: "absolute overflow-hidden bg-#000 z-[-10]",
269172
+ className: "absolute overflow-hidden bg-#000 w-full z-[-10]",
269305
269173
  style: {
269306
269174
  aspectRatio: 16 / 9
269307
269175
  },
269308
269176
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx("video", {
269309
- className: " h-full object-cover",
269177
+ className: "w-full h-full object-cover",
269310
269178
  ref: videoRef
269311
269179
  }), !(isMainCanvasUser == null ? void 0 : isMainCanvasUser.isVideoEnabled) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
269312
269180
  className: "absolute inset-0 bg-gray-800 flex items-center justify-center",
@@ -280200,6 +280068,617 @@ let ErrorBoundary$1 = class ErrorBoundary extends reactExports.Component {
280200
280068
  return this.props.children;
280201
280069
  }
280202
280070
  };
280071
+ const AudioVisualizer = reactExports.memo(
280072
+ ({ selectedMicrophone, isVisible: isVisible3, onVolumeLevelsChange }) => {
280073
+ const [audioContext, setAudioContext] = reactExports.useState(null);
280074
+ const [analyser, setAnalyser] = reactExports.useState(null);
280075
+ const [microphoneStream, setMicrophoneStream] = reactExports.useState(null);
280076
+ const [volumeLevels, setVolumeLevels] = reactExports.useState(Array(12).fill(0));
280077
+ const animationFrameRef = reactExports.useRef(null);
280078
+ const canvasRef = reactExports.useRef(null);
280079
+ const microphoneStreamRef = reactExports.useRef(microphoneStream);
280080
+ const audioContextRef = reactExports.useRef(audioContext);
280081
+ const analyserRef = reactExports.useRef(analyser);
280082
+ reactExports.useEffect(() => {
280083
+ microphoneStreamRef.current = microphoneStream;
280084
+ audioContextRef.current = audioContext;
280085
+ analyserRef.current = analyser;
280086
+ }, [microphoneStream, audioContext, analyser]);
280087
+ const cleanupMediaResources = reactExports.useCallback(() => {
280088
+ if (animationFrameRef.current) {
280089
+ cancelAnimationFrame(animationFrameRef.current);
280090
+ animationFrameRef.current = null;
280091
+ }
280092
+ if (microphoneStreamRef.current) {
280093
+ microphoneStreamRef.current.getTracks().forEach((track) => track.stop());
280094
+ setMicrophoneStream(null);
280095
+ }
280096
+ if (audioContextRef.current) {
280097
+ audioContextRef.current.close().catch((err2) => console.error("关闭音频上下文失败:", err2));
280098
+ setAudioContext(null);
280099
+ setAnalyser(null);
280100
+ }
280101
+ }, []);
280102
+ reactExports.useEffect(() => {
280103
+ if (onVolumeLevelsChange) {
280104
+ onVolumeLevelsChange(volumeLevels);
280105
+ }
280106
+ }, [volumeLevels, onVolumeLevelsChange]);
280107
+ reactExports.useEffect(() => {
280108
+ if (isVisible3 && selectedMicrophone) {
280109
+ const context = new (window.AudioContext || window.webkitAudioContext)();
280110
+ setAudioContext(context);
280111
+ const audioAnalyser = context.createAnalyser();
280112
+ audioAnalyser.fftSize = 2048;
280113
+ setAnalyser(audioAnalyser);
280114
+ navigator.mediaDevices.getUserMedia({
280115
+ audio: {
280116
+ deviceId: selectedMicrophone ? { exact: selectedMicrophone } : void 0
280117
+ }
280118
+ }).then((stream) => {
280119
+ setMicrophoneStream(stream);
280120
+ const source = context.createMediaStreamSource(stream);
280121
+ source.connect(audioAnalyser);
280122
+ const canvas = canvasRef.current;
280123
+ const canvasCtx = canvas == null ? void 0 : canvas.getContext("2d");
280124
+ const frequencyDataArray = new Uint8Array(audioAnalyser.frequencyBinCount);
280125
+ const timeDataArray = new Uint8Array(audioAnalyser.frequencyBinCount);
280126
+ const analyzeVolume = () => {
280127
+ audioAnalyser.getByteFrequencyData(frequencyDataArray);
280128
+ audioAnalyser.getByteTimeDomainData(timeDataArray);
280129
+ if (canvasCtx && canvas) {
280130
+ canvasCtx.clearRect(0, 0, canvas.width, canvas.height);
280131
+ canvasCtx.lineWidth = 2;
280132
+ canvasCtx.strokeStyle = "#2196F3";
280133
+ canvasCtx.beginPath();
280134
+ const sliceWidth = canvas.width / timeDataArray.length;
280135
+ let x = 0;
280136
+ for (let i = 0; i < timeDataArray.length; i++) {
280137
+ const v3 = timeDataArray[i] / 128;
280138
+ const y3 = v3 * canvas.height / 2;
280139
+ if (i === 0) {
280140
+ canvasCtx.moveTo(x, y3);
280141
+ } else {
280142
+ canvasCtx.lineTo(x, y3);
280143
+ }
280144
+ x += sliceWidth;
280145
+ }
280146
+ canvasCtx.lineTo(canvas.width, canvas.height / 2);
280147
+ canvasCtx.stroke();
280148
+ }
280149
+ const segmentSize = Math.floor(frequencyDataArray.length / 12);
280150
+ const normalizedLevels = Array(12).fill(0).map((_2, index2) => {
280151
+ const start2 = index2 * segmentSize;
280152
+ const end2 = start2 + segmentSize;
280153
+ const segmentAvg = frequencyDataArray.slice(start2, end2).reduce((sum2, value) => sum2 + value, 0) / segmentSize;
280154
+ return Math.min(1, Math.pow(segmentAvg / 255, 0.8));
280155
+ });
280156
+ setVolumeLevels(normalizedLevels);
280157
+ animationFrameRef.current = requestAnimationFrame(analyzeVolume);
280158
+ };
280159
+ analyzeVolume();
280160
+ }).catch((err2) => {
280161
+ console.error("获取麦克风失败:", err2);
280162
+ const interval = setInterval(() => {
280163
+ const newLevels = Array(12).fill(0).map(() => Math.random());
280164
+ setVolumeLevels(newLevels);
280165
+ }, 200);
280166
+ return () => clearInterval(interval);
280167
+ });
280168
+ return cleanupMediaResources;
280169
+ }
280170
+ }, [isVisible3, selectedMicrophone, cleanupMediaResources]);
280171
+ reactExports.useEffect(() => {
280172
+ return () => {
280173
+ cleanupMediaResources();
280174
+ };
280175
+ }, [cleanupMediaResources]);
280176
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col space-y-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: " h-24 bg-gray-50 rounded border border-gray-200", children: /* @__PURE__ */ jsxRuntimeExports.jsx("canvas", { ref: canvasRef, className: " h-full", width: "400", height: "100" }) }) });
280177
+ }
280178
+ );
280179
+ AudioVisualizer.displayName = "AudioVisualizer";
280180
+ class MediaErrorBoundary extends reactExports.Component {
280181
+ constructor(props) {
280182
+ super(props);
280183
+ this.state = {
280184
+ hasError: false,
280185
+ errorMessage: ""
280186
+ };
280187
+ }
280188
+ static getDerivedStateFromError(error2) {
280189
+ return {
280190
+ hasError: true,
280191
+ errorMessage: error2.message
280192
+ };
280193
+ }
280194
+ componentDidCatch(error2, errorInfo) {
280195
+ console.error("媒体设备错误:", error2, errorInfo);
280196
+ }
280197
+ render() {
280198
+ if (this.state.hasError) {
280199
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280200
+ className: "p-4 border border-red-300 rounded bg-red-50",
280201
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx(Alert, {
280202
+ message: "媒体设备错误",
280203
+ description: `无法访问媒体设备: ${this.state.errorMessage}。请检查设备权限或连接。`,
280204
+ type: "error",
280205
+ showIcon: true,
280206
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon, {})
280207
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, {
280208
+ type: "primary",
280209
+ className: "mt-4",
280210
+ onClick: () => this.setState({
280211
+ hasError: false,
280212
+ errorMessage: ""
280213
+ }),
280214
+ children: "重试"
280215
+ })]
280216
+ });
280217
+ }
280218
+ return this.props.children;
280219
+ }
280220
+ }
280221
+ const MediaSettings = () => {
280222
+ const {
280223
+ callCurrentUser,
280224
+ toggleVideo,
280225
+ rtc,
280226
+ getter
280227
+ } = useCallStore();
280228
+ const [isModalVisible, setIsModalVisible] = reactExports.useState(false);
280229
+ const [mirrorEnabled, setMirrorEnabled] = reactExports.useState(true);
280230
+ const [cameraDevices, setCameraDevices] = reactExports.useState([]);
280231
+ const [microphoneDevices, setMicrophoneDevices] = reactExports.useState([]);
280232
+ const [selectedCamera, setSelectedCamera] = reactExports.useState("");
280233
+ const [selectedMicrophone, setSelectedMicrophone] = reactExports.useState("");
280234
+ const [beautySettings, setBeautySettings] = reactExports.useState({
280235
+ enabled: false,
280236
+ whiteIntensity: 0.5,
280237
+ smoothIntensity: 0.5,
280238
+ sharpenIntensity: 0.5
280239
+ });
280240
+ const [beautyExtension, setBeautyExtension] = reactExports.useState(null);
280241
+ const [beautyCompatible, setBeautyCompatible] = reactExports.useState(false);
280242
+ const [beautyInitialized, setBeautyInitialized] = reactExports.useState(false);
280243
+ const getDevices = reactExports.useCallback(async () => {
280244
+ try {
280245
+ if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) {
280246
+ console.error("浏览器不支持获取媒体设备列表");
280247
+ staticMethods.error("您的浏览器不支持媒体设备选择功能");
280248
+ return;
280249
+ }
280250
+ await navigator.mediaDevices.getUserMedia({
280251
+ audio: true,
280252
+ video: true
280253
+ }).catch((err2) => console.error("获取媒体权限失败:", err2));
280254
+ const devices = await navigator.mediaDevices.enumerateDevices();
280255
+ const cameras = devices.filter((device) => device.kind === "videoinput").map((device) => ({
280256
+ id: device.deviceId,
280257
+ label: device.label || `摄像头 ${device.deviceId.slice(0, 5)}...`
280258
+ }));
280259
+ const microphones = devices.filter((device) => device.kind === "audioinput").map((device) => ({
280260
+ id: device.deviceId,
280261
+ label: device.label || `麦克风 ${device.deviceId.slice(0, 5)}...`
280262
+ }));
280263
+ if (cameras.length > 0) {
280264
+ setCameraDevices(cameras);
280265
+ setSelectedCamera((prevCamera) => {
280266
+ return cameras.find((cam) => cam.id === prevCamera) ? prevCamera : cameras[0].id;
280267
+ });
280268
+ }
280269
+ if (microphones.length > 0) {
280270
+ setMicrophoneDevices(microphones);
280271
+ setSelectedMicrophone((prevMic) => {
280272
+ return microphones.find((mic) => mic.id === prevMic) ? prevMic : microphones[0].id;
280273
+ });
280274
+ }
280275
+ } catch (error2) {
280276
+ console.error("获取设备列表失败:", error2);
280277
+ staticMethods.error("获取媒体设备失败,请检查设备权限");
280278
+ setCameraDevices([{
280279
+ id: "default",
280280
+ label: "默认摄像头"
280281
+ }]);
280282
+ setMicrophoneDevices([{
280283
+ id: "default",
280284
+ label: "默认麦克风"
280285
+ }]);
280286
+ }
280287
+ }, []);
280288
+ reactExports.useEffect(() => {
280289
+ if (isModalVisible) {
280290
+ getDevices();
280291
+ }
280292
+ if (navigator.mediaDevices) {
280293
+ navigator.mediaDevices.addEventListener("devicechange", getDevices);
280294
+ return () => {
280295
+ navigator.mediaDevices.removeEventListener("devicechange", getDevices);
280296
+ };
280297
+ }
280298
+ }, [getDevices, isModalVisible]);
280299
+ reactExports.useEffect(() => {
280300
+ if (isModalVisible && !beautyInitialized) {
280301
+ initializeBeautyExtension();
280302
+ }
280303
+ }, [isModalVisible, beautyInitialized]);
280304
+ const initializeBeautyExtension = reactExports.useCallback(async () => {
280305
+ try {
280306
+ const rtcInstance = getter().rtc;
280307
+ if (rtcInstance && rtcInstance.beautyExtension) {
280308
+ const extension = rtcInstance.beautyExtension;
280309
+ const compatibilityResult = await extension.checkCompatibility();
280310
+ console.log("浏览器兼容性检查结果:", compatibilityResult);
280311
+ if (compatibilityResult.isCompatible) {
280312
+ setBeautyExtension(extension);
280313
+ setBeautyCompatible(true);
280314
+ setBeautyInitialized(true);
280315
+ console.log("美颜扩展初始化成功");
280316
+ } else {
280317
+ console.warn("浏览器不支持美颜功能:", compatibilityResult.message || "兼容性检查失败");
280318
+ setBeautyCompatible(false);
280319
+ staticMethods.warning("您的浏览器不支持美颜功能,请使用 Chrome 78+ 或其他兼容浏览器");
280320
+ }
280321
+ } else {
280322
+ console.warn("RTC客户端或美颜扩展未初始化");
280323
+ setBeautyCompatible(false);
280324
+ staticMethods.warning("RTC客户端未初始化,无法使用美颜功能");
280325
+ }
280326
+ } catch (error2) {
280327
+ console.error("美颜扩展初始化失败:", error2);
280328
+ setBeautyCompatible(false);
280329
+ staticMethods.error("美颜功能初始化失败");
280330
+ }
280331
+ }, [rtc]);
280332
+ const handleBeautyToggle = reactExports.useCallback((enabled) => {
280333
+ if (!beautyExtension || !beautyCompatible) {
280334
+ staticMethods.warning("美颜功能不可用");
280335
+ return;
280336
+ }
280337
+ try {
280338
+ if (enabled) {
280339
+ beautyExtension.enableBeauty();
280340
+ console.log("美颜已开启");
280341
+ } else {
280342
+ beautyExtension.disableBeauty();
280343
+ console.log("美颜已关闭");
280344
+ }
280345
+ setBeautySettings((prev2) => ({
280346
+ ...prev2,
280347
+ enabled
280348
+ }));
280349
+ } catch (error2) {
280350
+ console.error("美颜开关操作失败:", error2);
280351
+ staticMethods.error("美颜开关操作失败");
280352
+ }
280353
+ }, [beautyExtension, beautyCompatible]);
280354
+ const handleBeautyIntensityChange = reactExports.useCallback(
280355
+ debounce$6((type4, value) => {
280356
+ if (!beautyExtension || !beautyCompatible) {
280357
+ return;
280358
+ }
280359
+ try {
280360
+ let mode;
280361
+ let settingKey;
280362
+ switch (type4) {
280363
+ case "white":
280364
+ mode = EffectBeautyMode.EFFECT_WHITE_MODE;
280365
+ settingKey = "whiteIntensity";
280366
+ break;
280367
+ case "smooth":
280368
+ mode = EffectBeautyMode.EFFECT_SMOOTH_MODE;
280369
+ settingKey = "smoothIntensity";
280370
+ break;
280371
+ case "sharpen":
280372
+ mode = EffectBeautyMode.EFFECT_SHARPEN_MODE;
280373
+ settingKey = "sharpenIntensity";
280374
+ break;
280375
+ default:
280376
+ return;
280377
+ }
280378
+ beautyExtension.setBeautyIntensity(mode, value);
280379
+ setBeautySettings((prev2) => ({
280380
+ ...prev2,
280381
+ [settingKey]: value
280382
+ }));
280383
+ console.log(`${type4} 强度已设置为:`, value);
280384
+ } catch (error2) {
280385
+ console.error("美颜强度设置失败:", error2);
280386
+ staticMethods.error("美颜强度设置失败");
280387
+ }
280388
+ }, 300),
280389
+ // 300ms 防抖延迟
280390
+ [beautyExtension, beautyCompatible]
280391
+ );
280392
+ reactExports.useEffect(() => {
280393
+ const savedBeautySettings = localStorage.getItem("beautySettings");
280394
+ if (savedBeautySettings) {
280395
+ try {
280396
+ const parsed = JSON.parse(savedBeautySettings);
280397
+ setBeautySettings(parsed);
280398
+ } catch (error2) {
280399
+ console.error("加载美颜设置失败:", error2);
280400
+ }
280401
+ }
280402
+ }, []);
280403
+ reactExports.useEffect(() => {
280404
+ localStorage.setItem("beautySettings", JSON.stringify(beautySettings));
280405
+ }, [beautySettings]);
280406
+ const handleCameraChange = reactExports.useCallback(async (newCameraId) => {
280407
+ setSelectedCamera(newCameraId);
280408
+ try {
280409
+ const rtcInstance = getter().rtc;
280410
+ if (rtcInstance && rtcInstance.setMediaDevices) {
280411
+ const result = await rtcInstance.setMediaDevices({
280412
+ cameraId: newCameraId,
280413
+ mirrorEnabled
280414
+ });
280415
+ if (result.success) {
280416
+ console.log("摄像头设备已切换:", newCameraId);
280417
+ } else {
280418
+ console.error("摄像头切换失败:", result.message);
280419
+ staticMethods.error("摄像头切换失败");
280420
+ }
280421
+ }
280422
+ } catch (error2) {
280423
+ console.error("摄像头配置失败:", error2);
280424
+ staticMethods.error("摄像头配置失败");
280425
+ }
280426
+ }, [rtc, mirrorEnabled]);
280427
+ const handleMicrophoneChange = reactExports.useCallback(async (newMicrophoneId) => {
280428
+ setSelectedMicrophone(newMicrophoneId);
280429
+ try {
280430
+ const rtcInstance = getter().rtc;
280431
+ if (rtcInstance && rtcInstance.setMediaDevices) {
280432
+ const result = await rtcInstance.setMediaDevices({
280433
+ microphoneId: newMicrophoneId
280434
+ });
280435
+ if (result.success) {
280436
+ console.log("麦克风设备已切换:", newMicrophoneId);
280437
+ } else {
280438
+ console.error("麦克风切换失败:", result.message);
280439
+ staticMethods.error("麦克风切换失败");
280440
+ }
280441
+ }
280442
+ } catch (error2) {
280443
+ console.error("麦克风配置失败:", error2);
280444
+ staticMethods.error("麦克风配置失败");
280445
+ }
280446
+ }, [rtc]);
280447
+ const handleMirrorChange = reactExports.useCallback(async (checked) => {
280448
+ setMirrorEnabled(checked);
280449
+ try {
280450
+ const rtcInstance = getter().rtc;
280451
+ if (rtcInstance && rtcInstance.setMediaDevices) {
280452
+ const result = await rtcInstance.setMediaDevices({
280453
+ cameraId: selectedCamera,
280454
+ mirrorEnabled: checked
280455
+ });
280456
+ if (result.success) {
280457
+ console.log("镜像翻转已设置:", checked);
280458
+ } else {
280459
+ console.error("镜像翻转设置失败:", result.message);
280460
+ staticMethods.error("镜像翻转设置失败");
280461
+ }
280462
+ }
280463
+ } catch (error2) {
280464
+ console.error("镜像翻转配置失败:", error2);
280465
+ staticMethods.error("镜像翻转配置失败");
280466
+ }
280467
+ }, [rtc, selectedCamera]);
280468
+ const closeMediaSettings = reactExports.useCallback(() => {
280469
+ setIsModalVisible(false);
280470
+ }, []);
280471
+ const openMediaSettings = () => {
280472
+ console.log("openMediaSettings");
280473
+ setIsModalVisible(true);
280474
+ };
280475
+ const handleClose = reactExports.useCallback(() => {
280476
+ closeMediaSettings();
280477
+ }, [closeMediaSettings]);
280478
+ reactExports.useEffect(() => {
280479
+ console.log("useEffect openMediaSettings");
280480
+ eventBus.on("openMediaSettings", openMediaSettings);
280481
+ eventBus.on("closeMediaSettings", closeMediaSettings);
280482
+ return () => {
280483
+ eventBus.off("openMediaSettings", openMediaSettings);
280484
+ eventBus.off("closeMediaSettings", closeMediaSettings);
280485
+ };
280486
+ }, []);
280487
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, {
280488
+ open: isModalVisible,
280489
+ title: "媒体设置",
280490
+ onCancel: handleClose,
280491
+ width: 910,
280492
+ footer: null,
280493
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280494
+ className: "flex justify-between",
280495
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx(MediaErrorBoundary, {
280496
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
280497
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280498
+ className: "mb-6",
280499
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280500
+ className: "flex items-center mb-2",
280501
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
280502
+ className: "mr-2",
280503
+ children: "摄像头:"
280504
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
280505
+ className: "flex-1",
280506
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Select$1, {
280507
+ className: "w-full",
280508
+ value: selectedCamera,
280509
+ onChange: handleCameraChange,
280510
+ options: reactExports.useMemo(() => cameraDevices.map((device) => ({
280511
+ value: device.id,
280512
+ label: device.label
280513
+ })), [cameraDevices])
280514
+ })
280515
+ })]
280516
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280517
+ className: "flex items-center mb-2",
280518
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
280519
+ className: "mr-2",
280520
+ children: "麦克风:"
280521
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
280522
+ className: "flex-1",
280523
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Select$1, {
280524
+ className: "w-full",
280525
+ value: selectedMicrophone,
280526
+ onChange: handleMicrophoneChange,
280527
+ options: reactExports.useMemo(() => microphoneDevices.map((device) => ({
280528
+ value: device.id,
280529
+ label: device.label
280530
+ })), [microphoneDevices])
280531
+ })
280532
+ })]
280533
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280534
+ className: "mt-8",
280535
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
280536
+ className: "flex items-center justify-between mb-2",
280537
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
280538
+ children: "音频监控"
280539
+ })
280540
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx(MediaErrorBoundary, {
280541
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(AudioVisualizer, {
280542
+ selectedMicrophone,
280543
+ isVisible: isModalVisible
280544
+ })
280545
+ })]
280546
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
280547
+ className: "mt-8",
280548
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280549
+ className: "flex items-center justify-between mb-2",
280550
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
280551
+ children: "镜像翻转"
280552
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx(Switch, {
280553
+ checked: mirrorEnabled,
280554
+ onChange: handleMirrorChange,
280555
+ size: "small"
280556
+ })]
280557
+ })
280558
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
280559
+ className: "mt-8 border-t pt-6",
280560
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280561
+ className: "mb-4",
280562
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("h3", {
280563
+ className: "text-lg font-medium mb-4 flex items-center",
280564
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
280565
+ className: "mr-2",
280566
+ children: "🎨"
280567
+ }), "美颜设置", !beautyCompatible && /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
280568
+ className: "ml-2 text-xs text-red-500 bg-red-50 px-2 py-1 rounded",
280569
+ children: "不支持"
280570
+ })]
280571
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280572
+ className: "flex items-center justify-between mb-4",
280573
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
280574
+ className: "text-sm",
280575
+ children: "启用美颜"
280576
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx(Switch, {
280577
+ checked: beautySettings.enabled,
280578
+ onChange: handleBeautyToggle,
280579
+ disabled: !beautyCompatible,
280580
+ size: "small"
280581
+ })]
280582
+ }), beautySettings.enabled && beautyCompatible && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280583
+ className: "space-y-4",
280584
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280585
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280586
+ className: "flex items-center justify-between mb-2",
280587
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
280588
+ className: "text-sm",
280589
+ children: "美白强度"
280590
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
280591
+ className: "text-xs text-gray-500",
280592
+ children: [Math.round(beautySettings.whiteIntensity * 100), "%"]
280593
+ })]
280594
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx(Slider2, {
280595
+ min: 0,
280596
+ max: 1,
280597
+ step: 0.1,
280598
+ value: beautySettings.whiteIntensity,
280599
+ onChange: (value) => handleBeautyIntensityChange("white", value),
280600
+ tooltip: {
280601
+ formatter: (value) => `${Math.round((value || 0) * 100)}%`
280602
+ }
280603
+ })]
280604
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280605
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280606
+ className: "flex items-center justify-between mb-2",
280607
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
280608
+ className: "text-sm",
280609
+ children: "磨皮强度"
280610
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
280611
+ className: "text-xs text-gray-500",
280612
+ children: [Math.round(beautySettings.smoothIntensity * 100), "%"]
280613
+ })]
280614
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx(Slider2, {
280615
+ min: 0,
280616
+ max: 1,
280617
+ step: 0.1,
280618
+ value: beautySettings.smoothIntensity,
280619
+ onChange: (value) => handleBeautyIntensityChange("smooth", value),
280620
+ tooltip: {
280621
+ formatter: (value) => `${Math.round((value || 0) * 100)}%`
280622
+ }
280623
+ })]
280624
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280625
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280626
+ className: "flex items-center justify-between mb-2",
280627
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
280628
+ className: "text-sm",
280629
+ children: "锐化强度"
280630
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
280631
+ className: "text-xs text-gray-500",
280632
+ children: [Math.round(beautySettings.sharpenIntensity * 100), "%"]
280633
+ })]
280634
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx(Slider2, {
280635
+ min: 0,
280636
+ max: 1,
280637
+ step: 0.1,
280638
+ value: beautySettings.sharpenIntensity,
280639
+ onChange: (value) => handleBeautyIntensityChange("sharpen", value),
280640
+ tooltip: {
280641
+ formatter: (value) => `${Math.round((value || 0) * 100)}%`
280642
+ }
280643
+ })]
280644
+ })]
280645
+ }), !beautyCompatible && /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, {
280646
+ message: "美颜功能不可用",
280647
+ description: "您的浏览器不支持美颜功能,请使用 Chrome 78+ 或其他兼容浏览器",
280648
+ type: "warning",
280649
+ showIcon: true,
280650
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon, {}),
280651
+ className: "mt-4"
280652
+ })]
280653
+ })
280654
+ })]
280655
+ })
280656
+ })
280657
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280658
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
280659
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(MediaErrorBoundary, {
280660
+ children: isModalVisible && /* @__PURE__ */ jsxRuntimeExports.jsx(CallUserVideo, {
280661
+ video_id: (callCurrentUser == null ? void 0 : callCurrentUser.rtc_userid) + "preview",
280662
+ user: callCurrentUser,
280663
+ className: " h-60",
280664
+ selectable: false
280665
+ })
280666
+ })
280667
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280668
+ className: "mt-4 flex items-center justify-center",
280669
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
280670
+ className: "text-sm",
280671
+ children: [(callCurrentUser == null ? void 0 : callCurrentUser.isVideoEnabled) ? "开启" : "关闭", "摄像头"]
280672
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx(Switch, {
280673
+ checked: callCurrentUser == null ? void 0 : callCurrentUser.isVideoEnabled,
280674
+ onChange: toggleVideo,
280675
+ size: "small"
280676
+ })]
280677
+ })]
280678
+ })]
280679
+ })
280680
+ });
280681
+ };
280203
280682
  const CallComponent = () => {
280204
280683
  const liveId = useLiveId();
280205
280684
  const {
@@ -280310,7 +280789,7 @@ const CallComponent = () => {
280310
280789
  })
280311
280790
  }), callConfig.rule === "main" && callConfig.isCall && /* @__PURE__ */ jsxRuntimeExports.jsx(CallBottomActions, {
280312
280791
  onConfigUpdate: handleUpdateRTCConfig
280313
- })]
280792
+ }), (callConfig == null ? void 0 : callConfig.isCall) && /* @__PURE__ */ jsxRuntimeExports.jsx(MediaSettings, {})]
280314
280793
  })
280315
280794
  })
280316
280795
  })
@@ -280967,10 +281446,141 @@ const useCommentSocketStore = create$c((set3, get4) => ({
280967
281446
  disconnect: void 0,
280968
281447
  // 业务方法(空实现,后续由 Hook 覆盖)
280969
281448
  fetChatUrl: async (id3) => {
280970
- },
280971
- setCallback: () => {
280972
281449
  }
280973
281450
  }));
281451
+ function useCommentSocket() {
281452
+ const liveId = useLiveId();
281453
+ const callbackRef = reactExports.useRef();
281454
+ const fetchLivePush = useLivePushCodeStore((state) => state.fetchLivePush);
281455
+ const chat_url = useCommentSocketStore((state) => state.chat_url);
281456
+ const handleMessageChange = reactExports.useCallback((mess) => {
281457
+ var _a2;
281458
+ if (!(mess == null ? void 0 : mess.data))
281459
+ return;
281460
+ let message2;
281461
+ try {
281462
+ message2 = JSON.parse(mess.data);
281463
+ } catch (e3) {
281464
+ console.error("解析 WebSocket 消息失败:", e3);
281465
+ return;
281466
+ }
281467
+ useCommentSocketStore.setState({ latestMessage: mess });
281468
+ switch (message2.type) {
281469
+ case "comment_delete":
281470
+ useCommentSocketStore.setState({ commentDeleteItem: message2.data });
281471
+ setTimeout(() => {
281472
+ useCommentSocketStore.setState({ commentDeleteItem: {} });
281473
+ }, 0);
281474
+ break;
281475
+ case "chat_forward":
281476
+ (_a2 = callbackRef.current) == null ? void 0 : _a2.call(callbackRef, message2.data);
281477
+ break;
281478
+ case "activity_config_change":
281479
+ useCommentSocketStore.setState({ activityConfigChange: message2.data });
281480
+ break;
281481
+ }
281482
+ }, []);
281483
+ const socketRef = reactExports.useRef(null);
281484
+ reactExports.useEffect(() => {
281485
+ if (!chat_url) {
281486
+ return;
281487
+ }
281488
+ if (socketRef.current) {
281489
+ socketRef.current.close();
281490
+ socketRef.current = null;
281491
+ }
281492
+ try {
281493
+ socketRef.current = new WebSocket(chat_url);
281494
+ socketRef.current.onopen = (event) => {
281495
+ if (liveId && socketRef.current) {
281496
+ try {
281497
+ const joinRoomMessage = JSON.stringify({
281498
+ type: "join_room",
281499
+ data: { room_id: liveId }
281500
+ });
281501
+ socketRef.current.send(joinRoomMessage);
281502
+ } catch (error2) {
281503
+ console.error("❌ WebSocket: 发送 join_room 失败:", error2);
281504
+ }
281505
+ }
281506
+ useCommentSocketStore.setState({ readyState: 1 });
281507
+ };
281508
+ socketRef.current.onclose = (event) => {
281509
+ useCommentSocketStore.setState({ readyState: 3 });
281510
+ };
281511
+ socketRef.current.onerror = (error2) => {
281512
+ console.error("❌ WebSocket: 连接错误:", error2);
281513
+ useCommentSocketStore.setState({ readyState: 3 });
281514
+ };
281515
+ socketRef.current.onmessage = (event) => {
281516
+ handleMessageChange(event);
281517
+ };
281518
+ } catch (error2) {
281519
+ console.error("❌ WebSocket: 创建连接失败:", error2);
281520
+ useCommentSocketStore.setState({ readyState: 3 });
281521
+ }
281522
+ return () => {
281523
+ if (socketRef.current) {
281524
+ socketRef.current.close();
281525
+ socketRef.current = null;
281526
+ }
281527
+ };
281528
+ }, [chat_url, liveId, handleMessageChange]);
281529
+ const fetChatUrl = reactExports.useCallback(
281530
+ async (id3) => {
281531
+ if (!id3) {
281532
+ return;
281533
+ }
281534
+ try {
281535
+ const res = await fetchLivePush(id3);
281536
+ if (!res) {
281537
+ console.error("❌ 获取直播推流配置失败");
281538
+ return;
281539
+ }
281540
+ let newChatUrl = res.chat_url || "";
281541
+ if (newChatUrl) {
281542
+ const userAgentParam = `equipment=${encodeURIComponent(navigator.userAgent)}`;
281543
+ newChatUrl += newChatUrl.includes("?") ? `&${userAgentParam}` : `?${userAgentParam}`;
281544
+ } else {
281545
+ console.error("❌ 未获取到有效的 chat_url");
281546
+ }
281547
+ useCommentSocketStore.setState({
281548
+ chat_url: newChatUrl,
281549
+ rtmUrl: res.rtm_push_url || "",
281550
+ webTransportUrl: res.web_transport_url || ""
281551
+ });
281552
+ } catch (error2) {
281553
+ console.error("❌ 获取直播推流配置失败:", error2);
281554
+ }
281555
+ },
281556
+ [fetchLivePush]
281557
+ );
281558
+ const setCallback = reactExports.useCallback((callback) => {
281559
+ callbackRef.current = callback;
281560
+ }, []);
281561
+ const sendMessage = reactExports.useCallback((message2) => {
281562
+ if (socketRef.current && socketRef.current.readyState === 1) {
281563
+ socketRef.current.send(message2);
281564
+ } else {
281565
+ console.error("useCommentSocket - 发送消息失败,WebSocket 未连接");
281566
+ }
281567
+ }, []);
281568
+ const disconnect = reactExports.useCallback(() => {
281569
+ if (socketRef.current) {
281570
+ socketRef.current.close();
281571
+ socketRef.current = null;
281572
+ useCommentSocketStore.setState({ readyState: 3 });
281573
+ }
281574
+ }, []);
281575
+ reactExports.useEffect(() => {
281576
+ useCommentSocketStore.setState({
281577
+ sendMessage,
281578
+ disconnect,
281579
+ fetChatUrl
281580
+ });
281581
+ }, [sendMessage, disconnect, fetChatUrl]);
281582
+ return { ...useCommentSocketStore.getState(), setCallback };
281583
+ }
280974
281584
  function getTargetElement(target, defaultElement) {
280975
281585
  if (!target) {
280976
281586
  return defaultElement;
@@ -288902,7 +289512,7 @@ const ChatComponent = () => {
288902
289512
  fetChatUrl,
288903
289513
  disconnect,
288904
289514
  setCallback
288905
- } = useCommentSocketStore();
289515
+ } = useCommentSocket();
288906
289516
  const [selectFilter, setSelectFilter] = reactExports.useState(1);
288907
289517
  const fetchInteractionList = async () => {
288908
289518
  const res = await request("/bis/interaction-list", {
@@ -288942,11 +289552,20 @@ const ChatComponent = () => {
288942
289552
  }
288943
289553
  };
288944
289554
  reactExports.useEffect(() => {
288945
- fetChatUrl(liveId);
289555
+ setCallback(handleMessage);
288946
289556
  return () => {
288947
- disconnect == null ? void 0 : disconnect();
289557
+ setCallback(() => {
289558
+ });
288948
289559
  };
288949
289560
  }, []);
289561
+ reactExports.useEffect(() => {
289562
+ if (liveId) {
289563
+ fetChatUrl(liveId);
289564
+ }
289565
+ return () => {
289566
+ disconnect == null ? void 0 : disconnect();
289567
+ };
289568
+ }, [liveId, fetChatUrl, disconnect]);
288950
289569
  const handleMessage = (message2) => {
288951
289570
  console.log("New message received:", message2);
288952
289571
  if (Object.keys(message2).length === 0)
@@ -288971,13 +289590,6 @@ const ChatComponent = () => {
288971
289590
  }
288972
289591
  }
288973
289592
  };
288974
- reactExports.useEffect(() => {
288975
- setCallback(handleMessage);
288976
- return () => {
288977
- setCallback(() => {
288978
- });
288979
- };
288980
- }, []);
288981
289593
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
288982
289594
  className: " h-full",
288983
289595
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
@@ -291727,13 +292339,16 @@ const RtcJoomRoom = reactExports.memo(({
291727
292339
  }
291728
292340
  }, VideoRenderMode.RENDER_MODE_HIDDEN));
291729
292341
  if (callConfig.rule === "sub" && callConfig.enter_muted) {
291730
- toggleAudio(false);
292342
+ await toggleAudio(false);
291731
292343
  } else {
291732
292344
  updateCallConfig({
291733
292345
  isReady: true
291734
292346
  });
291735
292347
  }
291736
292348
  await ((_d2 = getter().rtc) == null ? void 0 : _d2.publishStream());
292349
+ if (callConfig.rule === "main") {
292350
+ callAudioMixing();
292351
+ }
291737
292352
  } catch (err2) {
291738
292353
  console.error("创建本地流失败" + rtc_userid, "appid:" + appid, "roomid:" + rtc_room_id, "userid:" + rtc_userid, err2);
291739
292354
  }
@@ -292200,618 +292815,6 @@ const RtcJoomRoom = reactExports.memo(({
292200
292815
  })
292201
292816
  });
292202
292817
  });
292203
- const AudioVisualizer = reactExports.memo(
292204
- ({ selectedMicrophone, isVisible: isVisible3, onVolumeLevelsChange }) => {
292205
- const [audioContext, setAudioContext] = reactExports.useState(null);
292206
- const [analyser, setAnalyser] = reactExports.useState(null);
292207
- const [microphoneStream, setMicrophoneStream] = reactExports.useState(null);
292208
- const [volumeLevels, setVolumeLevels] = reactExports.useState(Array(12).fill(0));
292209
- const animationFrameRef = reactExports.useRef(null);
292210
- const canvasRef = reactExports.useRef(null);
292211
- const microphoneStreamRef = reactExports.useRef(microphoneStream);
292212
- const audioContextRef = reactExports.useRef(audioContext);
292213
- const analyserRef = reactExports.useRef(analyser);
292214
- reactExports.useEffect(() => {
292215
- microphoneStreamRef.current = microphoneStream;
292216
- audioContextRef.current = audioContext;
292217
- analyserRef.current = analyser;
292218
- }, [microphoneStream, audioContext, analyser]);
292219
- const cleanupMediaResources = reactExports.useCallback(() => {
292220
- if (animationFrameRef.current) {
292221
- cancelAnimationFrame(animationFrameRef.current);
292222
- animationFrameRef.current = null;
292223
- }
292224
- if (microphoneStreamRef.current) {
292225
- microphoneStreamRef.current.getTracks().forEach((track) => track.stop());
292226
- setMicrophoneStream(null);
292227
- }
292228
- if (audioContextRef.current) {
292229
- audioContextRef.current.close().catch((err2) => console.error("关闭音频上下文失败:", err2));
292230
- setAudioContext(null);
292231
- setAnalyser(null);
292232
- }
292233
- }, []);
292234
- reactExports.useEffect(() => {
292235
- if (onVolumeLevelsChange) {
292236
- onVolumeLevelsChange(volumeLevels);
292237
- }
292238
- }, [volumeLevels, onVolumeLevelsChange]);
292239
- reactExports.useEffect(() => {
292240
- if (isVisible3 && selectedMicrophone) {
292241
- const context = new (window.AudioContext || window.webkitAudioContext)();
292242
- setAudioContext(context);
292243
- const audioAnalyser = context.createAnalyser();
292244
- audioAnalyser.fftSize = 2048;
292245
- setAnalyser(audioAnalyser);
292246
- navigator.mediaDevices.getUserMedia({
292247
- audio: {
292248
- deviceId: selectedMicrophone ? { exact: selectedMicrophone } : void 0
292249
- }
292250
- }).then((stream) => {
292251
- setMicrophoneStream(stream);
292252
- const source = context.createMediaStreamSource(stream);
292253
- source.connect(audioAnalyser);
292254
- const canvas = canvasRef.current;
292255
- const canvasCtx = canvas == null ? void 0 : canvas.getContext("2d");
292256
- const frequencyDataArray = new Uint8Array(audioAnalyser.frequencyBinCount);
292257
- const timeDataArray = new Uint8Array(audioAnalyser.frequencyBinCount);
292258
- const analyzeVolume = () => {
292259
- audioAnalyser.getByteFrequencyData(frequencyDataArray);
292260
- audioAnalyser.getByteTimeDomainData(timeDataArray);
292261
- if (canvasCtx && canvas) {
292262
- canvasCtx.clearRect(0, 0, canvas.width, canvas.height);
292263
- canvasCtx.lineWidth = 2;
292264
- canvasCtx.strokeStyle = "#2196F3";
292265
- canvasCtx.beginPath();
292266
- const sliceWidth = canvas.width / timeDataArray.length;
292267
- let x = 0;
292268
- for (let i = 0; i < timeDataArray.length; i++) {
292269
- const v3 = timeDataArray[i] / 128;
292270
- const y3 = v3 * canvas.height / 2;
292271
- if (i === 0) {
292272
- canvasCtx.moveTo(x, y3);
292273
- } else {
292274
- canvasCtx.lineTo(x, y3);
292275
- }
292276
- x += sliceWidth;
292277
- }
292278
- canvasCtx.lineTo(canvas.width, canvas.height / 2);
292279
- canvasCtx.stroke();
292280
- }
292281
- const segmentSize = Math.floor(frequencyDataArray.length / 12);
292282
- const normalizedLevels = Array(12).fill(0).map((_2, index2) => {
292283
- const start2 = index2 * segmentSize;
292284
- const end2 = start2 + segmentSize;
292285
- const segmentAvg = frequencyDataArray.slice(start2, end2).reduce((sum2, value) => sum2 + value, 0) / segmentSize;
292286
- return Math.min(1, Math.pow(segmentAvg / 255, 0.8));
292287
- });
292288
- setVolumeLevels(normalizedLevels);
292289
- animationFrameRef.current = requestAnimationFrame(analyzeVolume);
292290
- };
292291
- analyzeVolume();
292292
- }).catch((err2) => {
292293
- console.error("获取麦克风失败:", err2);
292294
- const interval = setInterval(() => {
292295
- const newLevels = Array(12).fill(0).map(() => Math.random());
292296
- setVolumeLevels(newLevels);
292297
- }, 200);
292298
- return () => clearInterval(interval);
292299
- });
292300
- return cleanupMediaResources;
292301
- }
292302
- }, [isVisible3, selectedMicrophone, cleanupMediaResources]);
292303
- reactExports.useEffect(() => {
292304
- return () => {
292305
- cleanupMediaResources();
292306
- };
292307
- }, [cleanupMediaResources]);
292308
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col space-y-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: " h-24 bg-gray-50 rounded border border-gray-200", children: /* @__PURE__ */ jsxRuntimeExports.jsx("canvas", { ref: canvasRef, className: " h-full", width: "400", height: "100" }) }) });
292309
- }
292310
- );
292311
- AudioVisualizer.displayName = "AudioVisualizer";
292312
- class MediaErrorBoundary extends reactExports.Component {
292313
- constructor(props) {
292314
- super(props);
292315
- this.state = {
292316
- hasError: false,
292317
- errorMessage: ""
292318
- };
292319
- }
292320
- static getDerivedStateFromError(error2) {
292321
- return {
292322
- hasError: true,
292323
- errorMessage: error2.message
292324
- };
292325
- }
292326
- componentDidCatch(error2, errorInfo) {
292327
- console.error("媒体设备错误:", error2, errorInfo);
292328
- }
292329
- render() {
292330
- if (this.state.hasError) {
292331
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
292332
- className: "p-4 border border-red-300 rounded bg-red-50",
292333
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx(Alert, {
292334
- message: "媒体设备错误",
292335
- description: `无法访问媒体设备: ${this.state.errorMessage}。请检查设备权限或连接。`,
292336
- type: "error",
292337
- showIcon: true,
292338
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon, {})
292339
- }), /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, {
292340
- type: "primary",
292341
- className: "mt-4",
292342
- onClick: () => this.setState({
292343
- hasError: false,
292344
- errorMessage: ""
292345
- }),
292346
- children: "重试"
292347
- })]
292348
- });
292349
- }
292350
- return this.props.children;
292351
- }
292352
- }
292353
- const MediaSettings = () => {
292354
- const {
292355
- callCurrentUser,
292356
- toggleVideo,
292357
- rtc,
292358
- getter
292359
- } = useCallStore();
292360
- const [isModalVisible, setIsModalVisible] = reactExports.useState(false);
292361
- const [mirrorEnabled, setMirrorEnabled] = reactExports.useState(true);
292362
- const [cameraDevices, setCameraDevices] = reactExports.useState([]);
292363
- const [microphoneDevices, setMicrophoneDevices] = reactExports.useState([]);
292364
- const [selectedCamera, setSelectedCamera] = reactExports.useState("");
292365
- const [selectedMicrophone, setSelectedMicrophone] = reactExports.useState("");
292366
- const [beautySettings, setBeautySettings] = reactExports.useState({
292367
- enabled: false,
292368
- whiteIntensity: 0.5,
292369
- smoothIntensity: 0.5,
292370
- sharpenIntensity: 0.5
292371
- });
292372
- const [beautyExtension, setBeautyExtension] = reactExports.useState(null);
292373
- const [beautyCompatible, setBeautyCompatible] = reactExports.useState(false);
292374
- console.log("beautyCompatible", beautyCompatible);
292375
- const [beautyInitialized, setBeautyInitialized] = reactExports.useState(false);
292376
- const getDevices = reactExports.useCallback(async () => {
292377
- try {
292378
- if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) {
292379
- console.error("浏览器不支持获取媒体设备列表");
292380
- staticMethods.error("您的浏览器不支持媒体设备选择功能");
292381
- return;
292382
- }
292383
- await navigator.mediaDevices.getUserMedia({
292384
- audio: true,
292385
- video: true
292386
- }).catch((err2) => console.error("获取媒体权限失败:", err2));
292387
- const devices = await navigator.mediaDevices.enumerateDevices();
292388
- const cameras = devices.filter((device) => device.kind === "videoinput").map((device) => ({
292389
- id: device.deviceId,
292390
- label: device.label || `摄像头 ${device.deviceId.slice(0, 5)}...`
292391
- }));
292392
- const microphones = devices.filter((device) => device.kind === "audioinput").map((device) => ({
292393
- id: device.deviceId,
292394
- label: device.label || `麦克风 ${device.deviceId.slice(0, 5)}...`
292395
- }));
292396
- if (cameras.length > 0) {
292397
- setCameraDevices(cameras);
292398
- setSelectedCamera((prevCamera) => {
292399
- return cameras.find((cam) => cam.id === prevCamera) ? prevCamera : cameras[0].id;
292400
- });
292401
- }
292402
- if (microphones.length > 0) {
292403
- setMicrophoneDevices(microphones);
292404
- setSelectedMicrophone((prevMic) => {
292405
- return microphones.find((mic) => mic.id === prevMic) ? prevMic : microphones[0].id;
292406
- });
292407
- }
292408
- } catch (error2) {
292409
- console.error("获取设备列表失败:", error2);
292410
- staticMethods.error("获取媒体设备失败,请检查设备权限");
292411
- setCameraDevices([{
292412
- id: "default",
292413
- label: "默认摄像头"
292414
- }]);
292415
- setMicrophoneDevices([{
292416
- id: "default",
292417
- label: "默认麦克风"
292418
- }]);
292419
- }
292420
- }, []);
292421
- reactExports.useEffect(() => {
292422
- if (isModalVisible) {
292423
- getDevices();
292424
- }
292425
- if (navigator.mediaDevices) {
292426
- navigator.mediaDevices.addEventListener("devicechange", getDevices);
292427
- return () => {
292428
- navigator.mediaDevices.removeEventListener("devicechange", getDevices);
292429
- };
292430
- }
292431
- }, [getDevices, isModalVisible]);
292432
- reactExports.useEffect(() => {
292433
- if (isModalVisible && !beautyInitialized) {
292434
- initializeBeautyExtension();
292435
- }
292436
- }, [isModalVisible, beautyInitialized]);
292437
- const initializeBeautyExtension = reactExports.useCallback(async () => {
292438
- try {
292439
- const rtcInstance = getter().rtc;
292440
- if (rtcInstance && rtcInstance.beautyExtension) {
292441
- const extension = rtcInstance.beautyExtension;
292442
- const compatibilityResult = await extension.checkCompatibility();
292443
- console.log("浏览器兼容性检查结果:", compatibilityResult);
292444
- if (compatibilityResult.isCompatible) {
292445
- setBeautyExtension(extension);
292446
- setBeautyCompatible(true);
292447
- setBeautyInitialized(true);
292448
- console.log("美颜扩展初始化成功");
292449
- } else {
292450
- console.warn("浏览器不支持美颜功能:", compatibilityResult.message || "兼容性检查失败");
292451
- setBeautyCompatible(false);
292452
- staticMethods.warning("您的浏览器不支持美颜功能,请使用 Chrome 78+ 或其他兼容浏览器");
292453
- }
292454
- } else {
292455
- console.warn("RTC客户端或美颜扩展未初始化");
292456
- setBeautyCompatible(false);
292457
- staticMethods.warning("RTC客户端未初始化,无法使用美颜功能");
292458
- }
292459
- } catch (error2) {
292460
- console.error("美颜扩展初始化失败:", error2);
292461
- setBeautyCompatible(false);
292462
- staticMethods.error("美颜功能初始化失败");
292463
- }
292464
- }, [rtc]);
292465
- const handleBeautyToggle = reactExports.useCallback((enabled) => {
292466
- if (!beautyExtension || !beautyCompatible) {
292467
- staticMethods.warning("美颜功能不可用");
292468
- return;
292469
- }
292470
- try {
292471
- if (enabled) {
292472
- beautyExtension.enableBeauty();
292473
- console.log("美颜已开启");
292474
- } else {
292475
- beautyExtension.disableBeauty();
292476
- console.log("美颜已关闭");
292477
- }
292478
- setBeautySettings((prev2) => ({
292479
- ...prev2,
292480
- enabled
292481
- }));
292482
- } catch (error2) {
292483
- console.error("美颜开关操作失败:", error2);
292484
- staticMethods.error("美颜开关操作失败");
292485
- }
292486
- }, [beautyExtension, beautyCompatible]);
292487
- const handleBeautyIntensityChange = reactExports.useCallback(
292488
- debounce$6((type4, value) => {
292489
- if (!beautyExtension || !beautyCompatible) {
292490
- return;
292491
- }
292492
- try {
292493
- let mode;
292494
- let settingKey;
292495
- switch (type4) {
292496
- case "white":
292497
- mode = EffectBeautyMode.EFFECT_WHITE_MODE;
292498
- settingKey = "whiteIntensity";
292499
- break;
292500
- case "smooth":
292501
- mode = EffectBeautyMode.EFFECT_SMOOTH_MODE;
292502
- settingKey = "smoothIntensity";
292503
- break;
292504
- case "sharpen":
292505
- mode = EffectBeautyMode.EFFECT_SHARPEN_MODE;
292506
- settingKey = "sharpenIntensity";
292507
- break;
292508
- default:
292509
- return;
292510
- }
292511
- beautyExtension.setBeautyIntensity(mode, value);
292512
- setBeautySettings((prev2) => ({
292513
- ...prev2,
292514
- [settingKey]: value
292515
- }));
292516
- console.log(`${type4} 强度已设置为:`, value);
292517
- } catch (error2) {
292518
- console.error("美颜强度设置失败:", error2);
292519
- staticMethods.error("美颜强度设置失败");
292520
- }
292521
- }, 300),
292522
- // 300ms 防抖延迟
292523
- [beautyExtension, beautyCompatible]
292524
- );
292525
- reactExports.useEffect(() => {
292526
- const savedBeautySettings = localStorage.getItem("beautySettings");
292527
- if (savedBeautySettings) {
292528
- try {
292529
- const parsed = JSON.parse(savedBeautySettings);
292530
- setBeautySettings(parsed);
292531
- } catch (error2) {
292532
- console.error("加载美颜设置失败:", error2);
292533
- }
292534
- }
292535
- }, []);
292536
- reactExports.useEffect(() => {
292537
- localStorage.setItem("beautySettings", JSON.stringify(beautySettings));
292538
- }, [beautySettings]);
292539
- const handleCameraChange = reactExports.useCallback(async (newCameraId) => {
292540
- setSelectedCamera(newCameraId);
292541
- try {
292542
- const rtcInstance = getter().rtc;
292543
- if (rtcInstance && rtcInstance.setMediaDevices) {
292544
- const result = await rtcInstance.setMediaDevices({
292545
- cameraId: newCameraId,
292546
- mirrorEnabled
292547
- });
292548
- if (result.success) {
292549
- console.log("摄像头设备已切换:", newCameraId);
292550
- } else {
292551
- console.error("摄像头切换失败:", result.message);
292552
- staticMethods.error("摄像头切换失败");
292553
- }
292554
- }
292555
- } catch (error2) {
292556
- console.error("摄像头配置失败:", error2);
292557
- staticMethods.error("摄像头配置失败");
292558
- }
292559
- }, [rtc, mirrorEnabled]);
292560
- const handleMicrophoneChange = reactExports.useCallback(async (newMicrophoneId) => {
292561
- setSelectedMicrophone(newMicrophoneId);
292562
- try {
292563
- const rtcInstance = getter().rtc;
292564
- if (rtcInstance && rtcInstance.setMediaDevices) {
292565
- const result = await rtcInstance.setMediaDevices({
292566
- microphoneId: newMicrophoneId
292567
- });
292568
- if (result.success) {
292569
- console.log("麦克风设备已切换:", newMicrophoneId);
292570
- } else {
292571
- console.error("麦克风切换失败:", result.message);
292572
- staticMethods.error("麦克风切换失败");
292573
- }
292574
- }
292575
- } catch (error2) {
292576
- console.error("麦克风配置失败:", error2);
292577
- staticMethods.error("麦克风配置失败");
292578
- }
292579
- }, [rtc]);
292580
- const handleMirrorChange = reactExports.useCallback(async (checked) => {
292581
- setMirrorEnabled(checked);
292582
- try {
292583
- const rtcInstance = getter().rtc;
292584
- if (rtcInstance && rtcInstance.setMediaDevices) {
292585
- const result = await rtcInstance.setMediaDevices({
292586
- cameraId: selectedCamera,
292587
- mirrorEnabled: checked
292588
- });
292589
- if (result.success) {
292590
- console.log("镜像翻转已设置:", checked);
292591
- } else {
292592
- console.error("镜像翻转设置失败:", result.message);
292593
- staticMethods.error("镜像翻转设置失败");
292594
- }
292595
- }
292596
- } catch (error2) {
292597
- console.error("镜像翻转配置失败:", error2);
292598
- staticMethods.error("镜像翻转配置失败");
292599
- }
292600
- }, [rtc, selectedCamera]);
292601
- const closeMediaSettings = reactExports.useCallback(() => {
292602
- setIsModalVisible(false);
292603
- }, []);
292604
- const openMediaSettings = () => {
292605
- console.log("openMediaSettings");
292606
- setIsModalVisible(true);
292607
- };
292608
- const handleClose = reactExports.useCallback(() => {
292609
- closeMediaSettings();
292610
- }, [closeMediaSettings]);
292611
- reactExports.useEffect(() => {
292612
- console.log("useEffect openMediaSettings");
292613
- eventBus.on("openMediaSettings", openMediaSettings);
292614
- eventBus.on("closeMediaSettings", closeMediaSettings);
292615
- return () => {
292616
- eventBus.off("openMediaSettings", openMediaSettings);
292617
- eventBus.off("closeMediaSettings", closeMediaSettings);
292618
- };
292619
- }, []);
292620
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, {
292621
- open: isModalVisible,
292622
- title: "媒体设置",
292623
- onCancel: handleClose,
292624
- width: 910,
292625
- footer: null,
292626
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
292627
- className: "flex justify-between",
292628
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx(MediaErrorBoundary, {
292629
- children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
292630
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
292631
- className: "mb-6",
292632
- children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
292633
- className: "flex items-center mb-2",
292634
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
292635
- className: "mr-2",
292636
- children: "摄像头:"
292637
- }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
292638
- className: "flex-1",
292639
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Select$1, {
292640
- className: "w-full",
292641
- value: selectedCamera,
292642
- onChange: handleCameraChange,
292643
- options: reactExports.useMemo(() => cameraDevices.map((device) => ({
292644
- value: device.id,
292645
- label: device.label
292646
- })), [cameraDevices])
292647
- })
292648
- })]
292649
- }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
292650
- className: "flex items-center mb-2",
292651
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
292652
- className: "mr-2",
292653
- children: "麦克风:"
292654
- }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
292655
- className: "flex-1",
292656
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Select$1, {
292657
- className: "w-full",
292658
- value: selectedMicrophone,
292659
- onChange: handleMicrophoneChange,
292660
- options: reactExports.useMemo(() => microphoneDevices.map((device) => ({
292661
- value: device.id,
292662
- label: device.label
292663
- })), [microphoneDevices])
292664
- })
292665
- })]
292666
- }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
292667
- className: "mt-8",
292668
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
292669
- className: "flex items-center justify-between mb-2",
292670
- children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
292671
- children: "音频监控"
292672
- })
292673
- }), /* @__PURE__ */ jsxRuntimeExports.jsx(MediaErrorBoundary, {
292674
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(AudioVisualizer, {
292675
- selectedMicrophone,
292676
- isVisible: isModalVisible
292677
- })
292678
- })]
292679
- }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
292680
- className: "mt-8",
292681
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
292682
- className: "flex items-center justify-between mb-2",
292683
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
292684
- children: "镜像翻转"
292685
- }), /* @__PURE__ */ jsxRuntimeExports.jsx(Switch, {
292686
- checked: mirrorEnabled,
292687
- onChange: handleMirrorChange,
292688
- size: "small"
292689
- })]
292690
- })
292691
- }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
292692
- className: "mt-8 border-t pt-6",
292693
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
292694
- className: "mb-4",
292695
- children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("h3", {
292696
- className: "text-lg font-medium mb-4 flex items-center",
292697
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
292698
- className: "mr-2",
292699
- children: "🎨"
292700
- }), "美颜设置", !beautyCompatible && /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
292701
- className: "ml-2 text-xs text-red-500 bg-red-50 px-2 py-1 rounded",
292702
- children: "不支持"
292703
- })]
292704
- }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
292705
- className: "flex items-center justify-between mb-4",
292706
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
292707
- className: "text-sm",
292708
- children: "启用美颜"
292709
- }), /* @__PURE__ */ jsxRuntimeExports.jsx(Switch, {
292710
- checked: beautySettings.enabled,
292711
- onChange: handleBeautyToggle,
292712
- disabled: !beautyCompatible,
292713
- size: "small"
292714
- })]
292715
- }), beautySettings.enabled && beautyCompatible && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
292716
- className: "space-y-4",
292717
- children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
292718
- children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
292719
- className: "flex items-center justify-between mb-2",
292720
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
292721
- className: "text-sm",
292722
- children: "美白强度"
292723
- }), /* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
292724
- className: "text-xs text-gray-500",
292725
- children: [Math.round(beautySettings.whiteIntensity * 100), "%"]
292726
- })]
292727
- }), /* @__PURE__ */ jsxRuntimeExports.jsx(Slider2, {
292728
- min: 0,
292729
- max: 1,
292730
- step: 0.1,
292731
- value: beautySettings.whiteIntensity,
292732
- onChange: (value) => handleBeautyIntensityChange("white", value),
292733
- tooltip: {
292734
- formatter: (value) => `${Math.round((value || 0) * 100)}%`
292735
- }
292736
- })]
292737
- }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
292738
- children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
292739
- className: "flex items-center justify-between mb-2",
292740
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
292741
- className: "text-sm",
292742
- children: "磨皮强度"
292743
- }), /* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
292744
- className: "text-xs text-gray-500",
292745
- children: [Math.round(beautySettings.smoothIntensity * 100), "%"]
292746
- })]
292747
- }), /* @__PURE__ */ jsxRuntimeExports.jsx(Slider2, {
292748
- min: 0,
292749
- max: 1,
292750
- step: 0.1,
292751
- value: beautySettings.smoothIntensity,
292752
- onChange: (value) => handleBeautyIntensityChange("smooth", value),
292753
- tooltip: {
292754
- formatter: (value) => `${Math.round((value || 0) * 100)}%`
292755
- }
292756
- })]
292757
- }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
292758
- children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
292759
- className: "flex items-center justify-between mb-2",
292760
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
292761
- className: "text-sm",
292762
- children: "锐化强度"
292763
- }), /* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
292764
- className: "text-xs text-gray-500",
292765
- children: [Math.round(beautySettings.sharpenIntensity * 100), "%"]
292766
- })]
292767
- }), /* @__PURE__ */ jsxRuntimeExports.jsx(Slider2, {
292768
- min: 0,
292769
- max: 1,
292770
- step: 0.1,
292771
- value: beautySettings.sharpenIntensity,
292772
- onChange: (value) => handleBeautyIntensityChange("sharpen", value),
292773
- tooltip: {
292774
- formatter: (value) => `${Math.round((value || 0) * 100)}%`
292775
- }
292776
- })]
292777
- })]
292778
- }), !beautyCompatible && /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, {
292779
- message: "美颜功能不可用",
292780
- description: "您的浏览器不支持美颜功能,请使用 Chrome 78+ 或其他兼容浏览器",
292781
- type: "warning",
292782
- showIcon: true,
292783
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon, {}),
292784
- className: "mt-4"
292785
- })]
292786
- })
292787
- })]
292788
- })
292789
- })
292790
- }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
292791
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
292792
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(MediaErrorBoundary, {
292793
- children: isModalVisible && /* @__PURE__ */ jsxRuntimeExports.jsx(CallUserVideo, {
292794
- video_id: (callCurrentUser == null ? void 0 : callCurrentUser.rtc_userid) + "preview",
292795
- user: callCurrentUser,
292796
- className: " h-60",
292797
- selectable: false
292798
- })
292799
- })
292800
- }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
292801
- className: "mt-4 flex items-center justify-center",
292802
- children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
292803
- className: "text-sm",
292804
- children: [(callCurrentUser == null ? void 0 : callCurrentUser.isVideoEnabled) ? "开启" : "关闭", "摄像头"]
292805
- }), /* @__PURE__ */ jsxRuntimeExports.jsx(Switch, {
292806
- checked: callCurrentUser == null ? void 0 : callCurrentUser.isVideoEnabled,
292807
- onChange: toggleVideo,
292808
- size: "small"
292809
- })]
292810
- })]
292811
- })]
292812
- })
292813
- });
292814
- };
292815
292818
  const CallHome$1 = () => {
292816
292819
  const audioContextRef = reactExports.useRef(null);
292817
292820
  const audioDestinationRef = reactExports.useRef(null);
@@ -292827,9 +292830,6 @@ const CallHome$1 = () => {
292827
292830
  const [canvasSetting, setCanvasSetting] = reactExports.useState("horizontal");
292828
292831
  const rtmpRef = reactExports.useRef(null);
292829
292832
  const audioSourcesRef = reactExports.useRef([]);
292830
- reactExports.useEffect(() => {
292831
- document.title = "菲耀直播";
292832
- }, []);
292833
292833
  reactExports.useEffect(() => {
292834
292834
  const timer = setTimeout(() => {
292835
292835
  if (!(callConfig == null ? void 0 : callConfig.rtc_userid)) {
@@ -292877,7 +292877,7 @@ const CallHome$1 = () => {
292877
292877
  rule: "sub"
292878
292878
  }), /* @__PURE__ */ jsxRuntimeExports.jsx(RightSidebar, {
292879
292879
  canvasSetting
292880
- }), (callConfig == null ? void 0 : callConfig.isCall) && /* @__PURE__ */ jsxRuntimeExports.jsx(MediaSettings, {})]
292880
+ })]
292881
292881
  })]
292882
292882
  }), (callCurrentUser == null ? void 0 : callCurrentUser.waiting_mode_state) === WaitingModeState.WAITING && /* @__PURE__ */ jsxRuntimeExports.jsx(LiveWaitingRoom, {
292883
292883
  hostName: callConfig.title
@@ -292906,7 +292906,6 @@ const {
292906
292906
  } = Typography;
292907
292907
  const WebLiveLogin = () => {
292908
292908
  const [form] = Form2.useForm();
292909
- new URLSearchParams(window.location.search);
292910
292909
  const {
292911
292910
  setStatus,
292912
292911
  setDeviceType
@@ -293230,9 +293229,6 @@ const WebLiveLogin = () => {
293230
293229
  handleLogin.cancel();
293231
293230
  };
293232
293231
  }, [handleLogin]);
293233
- reactExports.useEffect(() => {
293234
- document.title = "菲耀直播";
293235
- }, []);
293236
293232
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
293237
293233
  className: "web-live-login-container",
293238
293234
  children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
@@ -294897,6 +294893,7 @@ const MobileLive = reactExports.memo(({ className = "" }) => {
294897
294893
  const { setStatus } = useGuestStore((state) => ({
294898
294894
  setStatus: state.setStatus
294899
294895
  }));
294896
+ useSdkStore((state) => state.callConfig.title);
294900
294897
  const [isBackCamera, setIsBackCamera] = reactExports.useState(false);
294901
294898
  const [showDeviceSettings, setShowDeviceSettings] = reactExports.useState(false);
294902
294899
  const [isDeviceSelected, setIsDeviceSelected] = reactExports.useState({
@@ -294986,9 +294983,6 @@ const MobileLive = reactExports.memo(({ className = "" }) => {
294986
294983
  reactExports.useEffect(() => {
294987
294984
  document.body.style.minWidth = "100vw";
294988
294985
  }, [callConfig]);
294989
- reactExports.useEffect(() => {
294990
- document.title = "菲耀直播";
294991
- }, []);
294992
294986
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-screen h-screen bg-black relative overflow-hidden", children: [
294993
294987
  /* @__PURE__ */ jsxRuntimeExports.jsx(RtcJoomRoom, { access: setupVideoPlayer }),
294994
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: [
@@ -296185,13 +296179,13 @@ const CanvasUploadVideo = ({
296185
296179
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(Dragger$1, {
296186
296180
  ...props,
296187
296181
  children: videoUrl ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
296188
- className: "relative aspect-video flex items-center justify-center videoUploadWrap",
296182
+ className: "relative w-full aspect-video flex items-center justify-center videoUploadWrap",
296189
296183
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx("video", {
296190
296184
  src: videoUrl,
296191
296185
  autoPlay: !isVideoAutoPlay,
296192
- className: " aspect-video"
296186
+ className: "w-full"
296193
296187
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
296194
- className: " h-full absolute top-0 left-0 text-#fff bg-#0009 items-center justify-center uploadContent flex-col",
296188
+ className: "w-full h-full absolute top-0 left-0 text-#fff bg-#0009 items-center justify-center uploadContent flex-col",
296195
296189
  style: {
296196
296190
  display: "none"
296197
296191
  },
@@ -296211,10 +296205,10 @@ const CanvasUploadVideo = ({
296211
296205
  className: "text-60px text-#6672fc"
296212
296206
  })
296213
296207
  }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
296214
- className: "text-14px text-black/50",
296208
+ className: `text-14px`,
296215
296209
  children: "将文件拖到此处,或点击上传"
296216
296210
  }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
296217
- className: "text-12px text-black/50 mt-2 mb-10",
296211
+ className: `text-12px mt-2 mb-10`,
296218
296212
  children: "支持mp4格式文件,大小不超过5GB"
296219
296213
  })]
296220
296214
  })
@@ -296335,7 +296329,7 @@ const CanvasUploadAudio = ({
296335
296329
  className: "mt-2",
296336
296330
  children: fileData.current.name
296337
296331
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
296338
- className: " h-full absolute top-0 left-0 text-#fff bg-#0009 items-center justify-center uploadContent flex-col",
296332
+ className: "w-full h-full absolute top-0 left-0 text-#fff bg-#0009 items-center justify-center uploadContent flex-col",
296339
296333
  style: {
296340
296334
  display: "none"
296341
296335
  },
@@ -296355,10 +296349,10 @@ const CanvasUploadAudio = ({
296355
296349
  className: "text-60px text-#6672fc"
296356
296350
  })
296357
296351
  }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
296358
- className: "text-14px text-black/50",
296352
+ className: `text-14px ${theme.useToken().token.colorTextTertiary}`,
296359
296353
  children: "将文件拖到此处,或点击上传"
296360
296354
  }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
296361
- className: "text-12px text-black/50 mt-2 mb-10",
296355
+ className: `text-12px mt-2 mb-10 ${theme.useToken().token.colorTextTertiary}`,
296362
296356
  children: "支持mp3格式文件,大小不超过5GB"
296363
296357
  })]
296364
296358
  })
@@ -304390,7 +304384,8 @@ const MetaItem = ({
304390
304384
  const isMutedRef = reactExports.useRef(true);
304391
304385
  const [isMuted, setIsMuted] = reactExports.useState(true);
304392
304386
  const [isLoop, setIsLoop] = reactExports.useState(false);
304393
- const [selectedValue, setSelectedValue] = reactExports.useState("");
304387
+ const fenge = '-":}{_+';
304388
+ const [selectedValue, setSelectedValue] = reactExports.useState(item.objectType === "videoSlot" && item.userId && item.streamIndex ? `${item.userId}${fenge}${item.streamIndex}` : "");
304394
304389
  const [currentTime, setCurrentTime] = reactExports.useState(0);
304395
304390
  const [isPlay, setIsPlay] = reactExports.useState(false);
304396
304391
  const [duration, setDuration] = reactExports.useState(0);
@@ -304579,7 +304574,6 @@ const MetaItem = ({
304579
304574
  const {
304580
304575
  token: token2
304581
304576
  } = useToken2();
304582
- const fenge = '-":}{_+';
304583
304577
  const contentStyle = {
304584
304578
  backgroundColor: token2.colorBgElevated,
304585
304579
  borderRadius: token2.borderRadiusLG,
@@ -304634,6 +304628,9 @@ const MetaItem = ({
304634
304628
  }
304635
304629
  }, [callConfig.isCall]);
304636
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);
304637
304634
  reactExports.useEffect(() => {
304638
304635
  var _a3;
304639
304636
  if (item.objectType !== "videoSlot" || !livePlayerRef.current)
@@ -304691,11 +304688,6 @@ const MetaItem = ({
304691
304688
  console.error("监听嘉宾视频状态变化时发生错误:", error2);
304692
304689
  }
304693
304690
  }, [targetUser, targetUser == null ? void 0 : targetUser.isVideoEnabled, item.userId, item.id, selectedValue]);
304694
- reactExports.useEffect(() => {
304695
- if (item.objectType === "videoSlot" && item.userId && item.streamIndex) {
304696
- setSelectedValue(`${item.userId}${fenge}${item.streamIndex}`);
304697
- }
304698
- }, [item.objectType, item.id]);
304699
304691
  reactExports.useEffect(() => {
304700
304692
  setItems(item);
304701
304693
  }, [item]);
@@ -305608,7 +305600,6 @@ const CallHome = () => {
305608
305600
  fabricInstance,
305609
305601
  updateCallConfig
305610
305602
  } = useCallStore();
305611
- console.log("重新渲染推流端");
305612
305603
  const pcRef = reactExports.useRef(null);
305613
305604
  const audioContextRef = reactExports.useRef(null);
305614
305605
  const audioDestinationRef = reactExports.useRef(null);
@@ -305620,7 +305611,6 @@ const CallHome = () => {
305620
305611
  const audioStreamRef = reactExports.useRef(/* @__PURE__ */ new Map());
305621
305612
  const audioSourcesRef = reactExports.useRef([]);
305622
305613
  reactExports.useEffect(() => {
305623
- document.title = "菲耀直播";
305624
305614
  updateCallConfig({
305625
305615
  rule: "main",
305626
305616
  live_id: Number(liveId || "")
@@ -305773,16 +305763,6 @@ const CallHome = () => {
305773
305763
  newBackgroundAudioStreams.set(streamId, audioStream);
305774
305764
  audioStreamRef.current = newBackgroundAudioStreams;
305775
305765
  });
305776
- return () => {
305777
- var _a3;
305778
- const rtmp = rtmpRef.current;
305779
- console.log("rtmp", rtmp);
305780
- if (rtmpRef.current) {
305781
- rtmpRef.current.stopPush();
305782
- (_a3 = rtmpRef.current) == null ? void 0 : _a3.destroy();
305783
- rtmpRef.current = null;
305784
- }
305785
- };
305786
305766
  }, []);
305787
305767
  reactExports.useEffect(() => {
305788
305768
  const handleBeforeUnload = (e3) => {
@@ -305835,26 +305815,54 @@ const CallHome = () => {
305835
305815
  return;
305836
305816
  (_a3 = livePlayerRef.current) == null ? void 0 : _a3.canvasRequestRenderAll();
305837
305817
  }, [isSelectedId, isHoveredId]);
305838
- const sizeEl = useSdkStore((state) => state.callConfig.el);
305818
+ const {
305819
+ sizeEl,
305820
+ styleConfig
305821
+ } = useSdkStore((state) => ({
305822
+ sizeEl: state.callConfig.el,
305823
+ styleConfig: state.styleConfig
305824
+ }));
305839
305825
  const wapRef = reactExports.useRef(null);
305840
305826
  reactExports.useEffect(() => {
305841
- console.log("[livePlayer.设置视频容器高度]", sizeEl);
305842
305827
  if (!wapRef.current)
305843
305828
  return;
305844
- let el2;
305829
+ let el2 = null;
305845
305830
  if (typeof sizeEl === "string") {
305846
305831
  el2 = document.getElementById(sizeEl);
305847
- } else {
305832
+ if (!el2) {
305833
+ console.warn(`[ResizeObserver] 找不到 ID 为 "${sizeEl}" 的元素,`);
305834
+ }
305835
+ } else if (sizeEl instanceof HTMLElement) {
305848
305836
  el2 = sizeEl;
305837
+ } else {
305838
+ console.warn("[ResizeObserver] sizeEl 无效,");
305849
305839
  }
305850
- if (!el2)
305840
+ if (!el2) {
305841
+ console.error("[ResizeObserver] 无法获取要观察的元素");
305851
305842
  return;
305843
+ }
305844
+ console.log("[ResizeObserver] 开始观察元素:", el2);
305845
+ const updateHeight = () => {
305846
+ if (wapRef.current) {
305847
+ const newHeight = el2.clientHeight - 60;
305848
+ wapRef.current.style.height = newHeight + "px";
305849
+ wapRef.current.style.minHeight = "770px";
305850
+ console.log("[ResizeObserver] 更新高度:", newHeight);
305851
+ }
305852
+ };
305852
305853
  const resizeObserver2 = new ResizeObserver(() => {
305853
- wapRef.current.style.height = (el2 == null ? void 0 : el2.clientHeight) - 60 + "px";
305854
+ updateHeight();
305854
305855
  });
305855
305856
  resizeObserver2.observe(el2);
305857
+ const handleWindowResize = () => {
305858
+ updateHeight();
305859
+ };
305860
+ window.addEventListener("resize", handleWindowResize);
305861
+ updateHeight();
305856
305862
  return () => {
305863
+ console.log("[ResizeObserver] 停止观察元素:", el2);
305857
305864
  resizeObserver2.disconnect();
305865
+ window.removeEventListener("resize", handleWindowResize);
305858
305866
  };
305859
305867
  }, [sizeEl]);
305860
305868
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(ConfigProvider$1, {
@@ -305869,7 +305877,7 @@ const CallHome = () => {
305869
305877
  }
305870
305878
  },
305871
305879
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(RtcJoomRoom, {}), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
305872
- className: "h-full bg-#0e131c min-w-[1500px] min-h-[770px] overflow-auto",
305880
+ className: `h-full bg-#0e131c min-w-[${styleConfig.minWidth}] min-h-[${styleConfig.minHeight}] overflow-auto`,
305873
305881
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(Head$1, {
305874
305882
  canvasSetting,
305875
305883
  setCanvasSetting,
@@ -305880,7 +305888,7 @@ const CallHome = () => {
305880
305888
  audioDestinationRef
305881
305889
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
305882
305890
  ref: wapRef,
305883
- className: "h-[calc(100vh-60px)] relative flex mt-1 gap-1 ",
305891
+ className: "h-[calc(100%-60px)] relative flex mt-1 gap-1 ",
305884
305892
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(LeftSidebar, {
305885
305893
  onSceneClick: handleSceneClick,
305886
305894
  currentScene,
@@ -306050,6 +306058,7 @@ const validateParam = (config2, paramName, message2) => {
306050
306058
  };
306051
306059
  class CallLiveSdk {
306052
306060
  constructor(config2) {
306061
+ var _a2;
306053
306062
  this.root = null;
306054
306063
  console.log("<<config>>", config2, useSdkStore.getState());
306055
306064
  if (!config2) {
@@ -306077,7 +306086,7 @@ class CallLiveSdk {
306077
306086
  useSdkStore.setState({
306078
306087
  callConfig: this.config
306079
306088
  });
306080
- saveSign(this.config.sign);
306089
+ saveSign((_a2 = this.config) == null ? void 0 : _a2.sign);
306081
306090
  if (config2.apiDomain) {
306082
306091
  setApiDomain(config2.apiDomain);
306083
306092
  }
@@ -306089,7 +306098,7 @@ class CallLiveSdk {
306089
306098
  console.log(this.config);
306090
306099
  const {
306091
306100
  el: el2
306092
- } = this.config;
306101
+ } = this.config || {};
306093
306102
  const container = typeof el2 === "string" ? document.querySelector(el2) : el2;
306094
306103
  if (!container) {
306095
306104
  throw new Error(`Container element not found: ${el2}`);
@@ -306101,6 +306110,7 @@ class CallLiveSdk {
306101
306110
  * 渲染SDK内容
306102
306111
  */
306103
306112
  render() {
306113
+ var _a2;
306104
306114
  if (!this.root) {
306105
306115
  throw new Error("SDK not initialized");
306106
306116
  }
@@ -306109,7 +306119,7 @@ class CallLiveSdk {
306109
306119
  height: "100%"
306110
306120
  },
306111
306121
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalErrorBoundary, {
306112
- errorNotification: this.config.errorNotification,
306122
+ errorNotification: (_a2 = this.config) == null ? void 0 : _a2.errorNotification,
306113
306123
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(WebLiveIndex, {})
306114
306124
  })
306115
306125
  }));
@@ -306197,6 +306207,7 @@ class CallLiveSdk {
306197
306207
  }
306198
306208
  class GuestCallSdk {
306199
306209
  constructor(config2) {
306210
+ var _a2;
306200
306211
  this.root = null;
306201
306212
  if (!config2) {
306202
306213
  window.dispatchEvent(new CustomEvent("paramValidationError", {
@@ -306223,7 +306234,7 @@ class GuestCallSdk {
306223
306234
  useSdkStore.setState({
306224
306235
  guestConfig: this.config
306225
306236
  });
306226
- saveSign(this.config.sign);
306237
+ saveSign((_a2 = this.config) == null ? void 0 : _a2.sign);
306227
306238
  if (config2.apiDomain) {
306228
306239
  setApiDomain(config2.apiDomain);
306229
306240
  }
@@ -306234,7 +306245,7 @@ class GuestCallSdk {
306234
306245
  init() {
306235
306246
  const {
306236
306247
  el: el2
306237
- } = this.config;
306248
+ } = this.config || {};
306238
306249
  const container = typeof el2 === "string" ? document.querySelector(el2) : el2;
306239
306250
  if (!container) {
306240
306251
  throw new Error(`Container element not found: ${el2}`);
@@ -306246,6 +306257,7 @@ class GuestCallSdk {
306246
306257
  * 渲染SDK内容
306247
306258
  */
306248
306259
  render() {
306260
+ var _a2;
306249
306261
  if (!this.root) {
306250
306262
  throw new Error("SDK not initialized");
306251
306263
  }
@@ -306255,7 +306267,7 @@ class GuestCallSdk {
306255
306267
  },
306256
306268
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(App$1, {
306257
306269
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalErrorBoundary, {
306258
- errorNotification: this.config.errorNotification,
306270
+ errorNotification: (_a2 = this.config) == null ? void 0 : _a2.errorNotification,
306259
306271
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(Guest, {})
306260
306272
  })
306261
306273
  })