call-live-sdk1 0.0.2 → 0.0.3

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 相关配置
@@ -25633,6 +25630,10 @@ const envConfig = {
25633
25630
  liveId: envConfig$1.env === "production" ? null : 53065,
25634
25631
  agentId: envConfig$1.env === "production" ? 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秒超时
@@ -85377,7 +85382,6 @@ function useLiveInfo() {
85377
85382
  live_id
85378
85383
  }
85379
85384
  }).then((res) => {
85380
- console.log("直播信息请求成功:", res);
85381
85385
  if (res.success === false) {
85382
85386
  staticMethods.error(res.errorMessage);
85383
85387
  requestResult.cancel();
@@ -85563,7 +85567,6 @@ const Head = ({
85563
85567
  run: state.run,
85564
85568
  cancel: state.cancel
85565
85569
  }));
85566
- console.log("data,title", data2);
85567
85570
  const {
85568
85571
  fetchActivityType
85569
85572
  } = useActivityTypeStore();
@@ -85582,10 +85585,16 @@ const Head = ({
85582
85585
  livePushCode
85583
85586
  } = useLivePushCodeStore();
85584
85587
  const {
85585
- data: liveInfoData
85588
+ data: liveInfoData,
85589
+ run: runLiveInfo
85586
85590
  } = useRequest(() => request(`/bis/live-info?id=${liveId}`).then((res) => res.data), {
85587
- manual: callConfig.role !== "main"
85591
+ manual: true
85588
85592
  });
85593
+ reactExports.useEffect(() => {
85594
+ if (callConfig.rule === "main") {
85595
+ runLiveInfo();
85596
+ }
85597
+ }, [callConfig.rule]);
85589
85598
  const [isLive, setIsLive] = reactExports.useState(false);
85590
85599
  const [isCurrentPagePushing, setIsCurrentPagePushing] = reactExports.useState(false);
85591
85600
  const [isModalVisible, setIsModalVisible] = reactExports.useState(false);
@@ -195591,46 +195600,37 @@ const useDrawingToolsStore = create$c((set3, get4) => ({
195591
195600
  setPenSize: (size) => set3((state) => {
195592
195601
  const newSize = typeof size === "function" ? size(state.penSize) : size;
195593
195602
  return {
195594
- penSize: newSize,
195595
- penSizeRef: { current: newSize }
195603
+ penSize: newSize
195596
195604
  };
195597
195605
  }),
195598
195606
  penColor: "#ff5a5a",
195599
195607
  setPenColor: (color) => set3((state) => {
195600
195608
  const newColor = typeof color === "function" ? color(state.penColor) : color;
195601
195609
  return {
195602
- penColor: newColor,
195603
- penColorRef: { current: newColor }
195610
+ penColor: newColor
195604
195611
  };
195605
195612
  }),
195606
- penSizeRef: { current: 2 },
195607
- penColorRef: { current: "#ff5a5a" },
195608
195613
  // 激光笔设置
195609
195614
  laserPenSize: 2,
195610
195615
  setLaserPenSize: (size) => set3((state) => {
195611
195616
  const newSize = typeof size === "function" ? size(state.laserPenSize) : size;
195612
195617
  return {
195613
- laserPenSize: newSize,
195614
- laserPenSizeRef: { current: newSize }
195618
+ laserPenSize: newSize
195615
195619
  };
195616
195620
  }),
195617
195621
  laserPenColor: "#ff5a5a",
195618
195622
  setLaserPenColor: (color) => set3((state) => {
195619
195623
  const newColor = typeof color === "function" ? color(state.laserPenColor) : color;
195620
195624
  return {
195621
- laserPenColor: newColor,
195622
- laserPenColorRef: { current: newColor }
195625
+ laserPenColor: newColor
195623
195626
  };
195624
195627
  }),
195625
- laserPenSizeRef: { current: 2 },
195626
- laserPenColorRef: { current: "#ff5a5a" },
195627
195628
  // 形状设置
195628
195629
  shapeSize: 2,
195629
195630
  setShapeSize: (size) => set3((state) => {
195630
195631
  const newSize = typeof size === "function" ? size(state.shapeSize) : size;
195631
195632
  return {
195632
- shapeSize: newSize,
195633
- shapeSizeRef: { current: newSize }
195633
+ shapeSize: newSize
195634
195634
  };
195635
195635
  }),
195636
195636
  shapeType: "rect",
@@ -195645,39 +195645,32 @@ const useDrawingToolsStore = create$c((set3, get4) => ({
195645
195645
  setShapeColor: (color) => set3((state) => {
195646
195646
  const newColor = typeof color === "function" ? color(state.shapeColor) : color;
195647
195647
  return {
195648
- shapeColor: newColor,
195649
- shapeColorRef: { current: newColor }
195648
+ shapeColor: newColor
195650
195649
  };
195651
195650
  }),
195652
- shapeSizeRef: { current: 2 },
195653
- shapeTypeRef: { current: "rect" },
195654
- shapeColorRef: { current: "#ff5a5a" },
195655
195651
  // 文字设置
195656
195652
  textSize: 16,
195657
195653
  setTextSize: (size) => set3((state) => {
195658
195654
  const newSize = typeof size === "function" ? size(state.textSize) : size;
195659
195655
  return {
195660
- textSize: newSize,
195661
- textSizeRef: { current: newSize }
195656
+ textSize: newSize
195662
195657
  };
195663
195658
  }),
195664
195659
  textColor: "#ff5a5a",
195665
195660
  setTextColor: (color) => set3((state) => {
195666
195661
  const newColor = typeof color === "function" ? color(state.textColor) : color;
195667
195662
  return {
195668
- textColor: newColor,
195669
- textColorRef: { current: newColor }
195663
+ textColor: newColor
195670
195664
  };
195671
195665
  }),
195672
- textSizeRef: { current: 16 },
195673
- textColorRef: { current: "#ff5a5a" },
195674
195666
  // 预览弹窗状态
195675
195667
  isPreviewModalVisible: false,
195676
195668
  setIsPreviewModalVisible: (visible) => set3({ isPreviewModalVisible: visible }),
195677
195669
  // 绘图相关引用
195678
195670
  downPoint: { current: null },
195679
195671
  upPoint: { current: null },
195680
- currentShape: { current: null }
195672
+ currentShape: { current: null },
195673
+ getter: () => get4()
195681
195674
  }));
195682
195675
  const useCallUserPagination = (config2) => {
195683
195676
  const { gridCols } = config2;
@@ -265727,7 +265720,7 @@ const Document$1 = ({
265727
265720
  return /* @__PURE__ */ jsxRuntimeExports.jsx("a", {
265728
265721
  href: r3.buy_url,
265729
265722
  target: "_blank",
265730
- className: "flex text-stone-500",
265723
+ className: "text-[--call-live-sdk-color-primary]",
265731
265724
  rel: "noreferrer",
265732
265725
  children: r3.name
265733
265726
  });
@@ -266087,13 +266080,13 @@ const Document$1 = ({
266087
266080
  title: "预览文档",
266088
266081
  width: 715,
266089
266082
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
266090
- className: "w-670px pt-4 h-430px bg-#e8e8e8 flex items-center flex-col",
266083
+ className: "w-670px pt-4 h-430px bg-#1a1a1a flex items-center flex-col",
266091
266084
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx("img", {
266092
266085
  src: urlList[listIndex],
266093
- className: " h-92 object-contain"
266086
+ className: " h-92 object-contain bg-#0e121c p-4 rounded"
266094
266087
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
266095
- className: "flex items-center h-40px",
266096
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
266088
+ className: "flex items-center h-40px text-white",
266089
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, {
266097
266090
  onClick: () => {
266098
266091
  if (listIndex > 0) {
266099
266092
  setListIndex(listIndex - 1);
@@ -266101,12 +266094,13 @@ const Document$1 = ({
266101
266094
  setListIndex(urlList.length - 1);
266102
266095
  }
266103
266096
  },
266104
- className: " cursor-pointer bg-white px-2",
266097
+ type: "primary",
266098
+ ghost: true,
266105
266099
  children: "上一页"
266106
266100
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
266107
- className: "mx-2",
266101
+ className: "mx-2 text-white",
266108
266102
  children: [listIndex + 1, "/", urlList.length]
266109
- }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
266103
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, {
266110
266104
  onClick: () => {
266111
266105
  if (listIndex < urlList.length - 1) {
266112
266106
  setListIndex(listIndex + 1);
@@ -266114,7 +266108,8 @@ const Document$1 = ({
266114
266108
  setListIndex(0);
266115
266109
  }
266116
266110
  },
266117
- className: " cursor-pointer bg-white px-2",
266111
+ type: "primary",
266112
+ ghost: true,
266118
266113
  children: "下一页"
266119
266114
  })]
266120
266115
  })]
@@ -266211,7 +266206,6 @@ const DocumentControler = ({
266211
266206
  setDocumentIndex(selectedScene.documentIndex);
266212
266207
  handleImageClick(selectedScene.documentIndex);
266213
266208
  }, [currentScene]);
266214
- console.log("documentInfo", documentInfo);
266215
266209
  reactExports.useEffect(() => {
266216
266210
  if (!documentInfo.name) {
266217
266211
  setDocumentScrollLeft(0);
@@ -266528,30 +266522,20 @@ const ToolOption = reactExports.memo(({
266528
266522
  });
266529
266523
  });
266530
266524
  ToolOption.displayName = "ToolOption";
266525
+ const COLORS = ["#ff5a5a", "#ffbf48", "#3a9bff", "#58efb8", "#000000", "#808080", "#ffffff"];
266526
+ const LINE_SIZES = [2, 4, 6];
266527
+ const TEXT_SIZES = [16, 20, 24, 28, 32];
266528
+ const TOOL_IDS = {
266529
+ SELECT: 1,
266530
+ PEN: 2,
266531
+ LASER_PEN: 3,
266532
+ SHAPE: 4,
266533
+ TEXT: 5
266534
+ };
266531
266535
  const DrawingToolbar = ({
266532
266536
  onToolClick,
266533
266537
  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
266538
+ onPreviewClick
266555
266539
  }) => {
266556
266540
  const {
266557
266541
  // 工具选择
@@ -266582,114 +266566,23 @@ const DrawingToolbar = ({
266582
266566
  // 预览弹窗状态
266583
266567
  setIsPreviewModalVisible
266584
266568
  } = 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
266569
  const handleToolClick = (tool) => {
266636
266570
  setSelectedTool(tool);
266637
266571
  onToolClick(tool);
266638
266572
  };
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
- };
266573
+ const handleToolSettingChange = (setter, toolId) => (value) => {
266574
+ setter(value);
266575
+ setTimeout(() => onToolClick(toolId));
266576
+ };
266577
+ const handlePenSizeChange = handleToolSettingChange(setPenSize, TOOL_IDS.PEN);
266578
+ const handlePenColorChange = handleToolSettingChange(setPenColor, TOOL_IDS.PEN);
266579
+ const handleLaserPenSizeChange = handleToolSettingChange(setLaserPenSize, TOOL_IDS.LASER_PEN);
266580
+ const handleLaserPenColorChange = handleToolSettingChange(setLaserPenColor, TOOL_IDS.LASER_PEN);
266581
+ const handleShapeSizeChange = handleToolSettingChange(setShapeSize, TOOL_IDS.SHAPE);
266582
+ const handleShapeTypeChange = handleToolSettingChange(setShapeType, TOOL_IDS.SHAPE);
266583
+ const handleShapeColorChange = handleToolSettingChange(setShapeColor, TOOL_IDS.SHAPE);
266584
+ const handleTextSizeChange = handleToolSettingChange(setTextSize, TOOL_IDS.TEXT);
266585
+ const handleTextColorChange = handleToolSettingChange(setTextColor, TOOL_IDS.TEXT);
266693
266586
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
266694
266587
  className: "flex items-center",
266695
266588
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
@@ -266700,10 +266593,10 @@ const DrawingToolbar = ({
266700
266593
  children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
266701
266594
  className: "w-32px h-32px flex justify-center items-center cursor-pointer hover:bg-#12151a",
266702
266595
  style: {
266703
- background: selectedTool === 1 ? "#12151a" : "",
266704
- color: selectedTool === 1 ? "#6672fc" : "#fff"
266596
+ background: selectedTool === TOOL_IDS.SELECT ? "#12151a" : "",
266597
+ color: selectedTool === TOOL_IDS.SELECT ? "#6672fc" : "#fff"
266705
266598
  },
266706
- onClick: () => handleToolClick(1),
266599
+ onClick: () => handleToolClick(TOOL_IDS.SELECT),
266707
266600
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(SvgGuideO, {
266708
266601
  className: "text-24px"
266709
266602
  })
@@ -266713,11 +266606,11 @@ const DrawingToolbar = ({
266713
266606
  optionContent: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
266714
266607
  className: "w-260px py-4 px-3 flex flex-col justify-between",
266715
266608
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(SizePicker, {
266716
- sizes: [2, 4, 6],
266609
+ sizes: LINE_SIZES,
266717
266610
  selectedSize: penSize,
266718
266611
  onSizeChange: handlePenSizeChange
266719
266612
  }), /* @__PURE__ */ jsxRuntimeExports.jsx(ColorPicker, {
266720
- colors: ["#ff5a5a", "#ffbf48", "#3a9bff", "#58efb8", "#000000", "#808080", "#ffffff"],
266613
+ colors: COLORS,
266721
266614
  selectedColor: penColor,
266722
266615
  onColorChange: handlePenColorChange
266723
266616
  })]
@@ -266729,10 +266622,10 @@ const DrawingToolbar = ({
266729
266622
  children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
266730
266623
  className: "w-32px h-32px flex justify-center items-center cursor-pointer hover:bg-#12151a",
266731
266624
  style: {
266732
- background: selectedTool === 2 ? "#12151a" : "",
266733
- color: selectedTool === 2 ? "#6672fc" : "#fff"
266625
+ background: selectedTool === TOOL_IDS.PEN ? "#12151a" : "",
266626
+ color: selectedTool === TOOL_IDS.PEN ? "#6672fc" : "#fff"
266734
266627
  },
266735
- onClick: () => handleToolClick(2),
266628
+ onClick: () => handleToolClick(TOOL_IDS.PEN),
266736
266629
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(SvgEdit, {
266737
266630
  className: "text-18px"
266738
266631
  })
@@ -266743,11 +266636,11 @@ const DrawingToolbar = ({
266743
266636
  optionContent: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
266744
266637
  className: "w-260px py-4 px-3 flex flex-col justify-between",
266745
266638
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(SizePicker, {
266746
- sizes: [2, 4, 6],
266639
+ sizes: LINE_SIZES,
266747
266640
  selectedSize: laserPenSize,
266748
266641
  onSizeChange: handleLaserPenSizeChange
266749
266642
  }), /* @__PURE__ */ jsxRuntimeExports.jsx(ColorPicker, {
266750
- colors: ["#ff5a5a", "#ffbf48", "#3a9bff", "#58efb8", "#000000", "#808080", "#ffffff"],
266643
+ colors: COLORS,
266751
266644
  selectedColor: laserPenColor,
266752
266645
  onColorChange: handleLaserPenColorChange
266753
266646
  })]
@@ -266759,10 +266652,10 @@ const DrawingToolbar = ({
266759
266652
  children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
266760
266653
  className: "w-32px h-32px flex justify-center items-center cursor-pointer hover:bg-#12151a",
266761
266654
  style: {
266762
- background: selectedTool === 3 ? "#12151a" : "",
266763
- color: selectedTool === 3 ? "#6672fc" : "#fff"
266655
+ background: selectedTool === TOOL_IDS.LASER_PEN ? "#12151a" : "",
266656
+ color: selectedTool === TOOL_IDS.LASER_PEN ? "#6672fc" : "#fff"
266764
266657
  },
266765
- onClick: () => handleToolClick(3),
266658
+ onClick: () => handleToolClick(TOOL_IDS.LASER_PEN),
266766
266659
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$r, {
266767
266660
  className: "text-18px"
266768
266661
  })
@@ -266777,7 +266670,7 @@ const DrawingToolbar = ({
266777
266670
  marginBottom: 10
266778
266671
  },
266779
266672
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(SizePicker, {
266780
- sizes: [2, 4, 6],
266673
+ sizes: LINE_SIZES,
266781
266674
  selectedSize: shapeSize,
266782
266675
  onSizeChange: handleShapeSizeChange
266783
266676
  }), /* @__PURE__ */ jsxRuntimeExports.jsx(ShapeTypePicker, {
@@ -266786,7 +266679,7 @@ const DrawingToolbar = ({
266786
266679
  onTypeChange: handleShapeTypeChange
266787
266680
  })]
266788
266681
  }), /* @__PURE__ */ jsxRuntimeExports.jsx(ColorPicker, {
266789
- colors: ["#ff5a5a", "#ffbf48", "#3a9bff", "#58efb8", "#000000", "#808080", "#ffffff"],
266682
+ colors: COLORS,
266790
266683
  selectedColor: shapeColor,
266791
266684
  onColorChange: handleShapeColorChange
266792
266685
  })]
@@ -266798,10 +266691,10 @@ const DrawingToolbar = ({
266798
266691
  children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
266799
266692
  className: "w-32px h-32px flex justify-center items-center cursor-pointer hover:bg-#12151a",
266800
266693
  style: {
266801
- background: selectedTool === 4 ? "#12151a" : "",
266802
- color: selectedTool === 4 ? "#6672fc" : "#fff"
266694
+ background: selectedTool === TOOL_IDS.SHAPE ? "#12151a" : "",
266695
+ color: selectedTool === TOOL_IDS.SHAPE ? "#6672fc" : "#fff"
266803
266696
  },
266804
- onClick: () => handleToolClick(4),
266697
+ onClick: () => handleToolClick(TOOL_IDS.SHAPE),
266805
266698
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$p, {
266806
266699
  className: "text-18px"
266807
266700
  })
@@ -266812,11 +266705,11 @@ const DrawingToolbar = ({
266812
266705
  optionContent: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
266813
266706
  className: "w-260px py-4 px-3 flex flex-col justify-between",
266814
266707
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(TextSizePicker, {
266815
- sizes: [16, 20, 24, 28, 32],
266708
+ sizes: TEXT_SIZES,
266816
266709
  selectedSize: textSize,
266817
266710
  onSizeChange: handleTextSizeChange
266818
266711
  }), /* @__PURE__ */ jsxRuntimeExports.jsx(ColorPicker, {
266819
- colors: ["#ff5a5a", "#ffbf48", "#3a9bff", "#58efb8", "#000000", "#808080", "#ffffff"],
266712
+ colors: COLORS,
266820
266713
  selectedColor: textColor,
266821
266714
  onColorChange: handleTextColorChange
266822
266715
  })]
@@ -266828,10 +266721,10 @@ const DrawingToolbar = ({
266828
266721
  children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
266829
266722
  className: "w-32px h-32px flex justify-center items-center cursor-pointer hover:bg-#12151a",
266830
266723
  style: {
266831
- background: selectedTool === 5 ? "#12151a" : "",
266832
- color: selectedTool === 5 ? "#6672fc" : "#fff"
266724
+ background: selectedTool === TOOL_IDS.TEXT ? "#12151a" : "",
266725
+ color: selectedTool === TOOL_IDS.TEXT ? "#6672fc" : "#fff"
266833
266726
  },
266834
- onClick: () => handleToolClick(5),
266727
+ onClick: () => handleToolClick(TOOL_IDS.TEXT),
266835
266728
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$e, {
266836
266729
  className: "text-18px"
266837
266730
  })
@@ -267049,14 +266942,11 @@ const LivePlayer = ({
267049
266942
  callUsers: state.callUsers,
267050
266943
  toggleRightSidebar: state.toggleRightSidebar
267051
266944
  }));
267052
- useSdkStore((state) => state.callConfig.el);
267053
266945
  const canvasRef = reactExports.useRef(null);
267054
266946
  const canvasContainerRef = reactExports.useRef(null);
267055
266947
  const streamRef = reactExports.useRef(null);
267056
266948
  const streamContainerRef = reactExports.useRef(null);
267057
266949
  const {
267058
- // 工具选择
267059
- selectedTool,
267060
266950
  setSelectedTool,
267061
266951
  // 绘图相关引用
267062
266952
  downPoint,
@@ -267064,37 +266954,37 @@ const LivePlayer = ({
267064
266954
  currentShape,
267065
266955
  // 形状设置
267066
266956
  shapeType,
267067
- setShapeType,
267068
- shapeTypeRef,
267069
266957
  shapeColor,
267070
- setShapeColor,
267071
- shapeColorRef,
267072
266958
  shapeSize,
267073
- setShapeSize,
267074
- shapeSizeRef,
267075
266959
  // 画笔设置
267076
266960
  penColor,
267077
- setPenColor,
267078
- penColorRef,
267079
266961
  penSize,
267080
- setPenSize,
267081
- penSizeRef,
267082
266962
  // 激光笔设置
267083
266963
  laserPenColor,
267084
- setLaserPenColor,
267085
- laserPenColorRef,
267086
266964
  laserPenSize,
267087
- setLaserPenSize,
267088
- laserPenSizeRef,
267089
266965
  // 文字设置
267090
266966
  textColor,
267091
- setTextColor,
267092
- textColorRef,
267093
266967
  textSize,
267094
- setTextSize,
267095
- textSizeRef,
267096
- setIsPreviewModalVisible
267097
- } = useDrawingToolsStore();
266968
+ // 预览弹窗状态
266969
+ setIsPreviewModalVisible,
266970
+ getter: getDrawing
266971
+ } = useDrawingToolsStore((state) => ({
266972
+ setSelectedTool: state.setSelectedTool,
266973
+ downPoint: state.downPoint,
266974
+ upPoint: state.upPoint,
266975
+ currentShape: state.currentShape,
266976
+ shapeType: state.shapeType,
266977
+ shapeColor: state.shapeColor,
266978
+ shapeSize: state.shapeSize,
266979
+ penColor: state.penColor,
266980
+ penSize: state.penSize,
266981
+ laserPenColor: state.laserPenColor,
266982
+ laserPenSize: state.laserPenSize,
266983
+ textColor: state.textColor,
266984
+ textSize: state.textSize,
266985
+ getter: state.getter,
266986
+ setIsPreviewModalVisible: state.setIsPreviewModalVisible
266987
+ }));
267098
266988
  const canvasSettingRef = reactExports.useRef("horizontal");
267099
266989
  const worker = reactExports.useRef(null);
267100
266990
  const isWorkerRunning = reactExports.useRef(false);
@@ -267631,9 +267521,9 @@ const LivePlayer = ({
267631
267521
  };
267632
267522
  const drawShapeMouseDown = (e3) => {
267633
267523
  downPoint.current = e3.absolutePointer;
267634
- const shapeType2 = shapeTypeRef.current;
267635
- const shapeColor2 = shapeColorRef.current;
267636
- const shapeSize2 = shapeSizeRef.current;
267524
+ const shapeType2 = getDrawing().shapeType;
267525
+ const shapeColor2 = getDrawing().shapeColor;
267526
+ const shapeSize2 = getDrawing().shapeSize;
267637
267527
  if (shapeType2 === "circle" || shapeType2 === "rect") {
267638
267528
  currentShape.current = shapeType2 === "circle" ? new xo({
267639
267529
  left: downPoint.current.x,
@@ -267661,7 +267551,7 @@ const LivePlayer = ({
267661
267551
  const drawShapeMouseMove = (e3) => {
267662
267552
  if (!currentShape.current)
267663
267553
  return;
267664
- const shapeType2 = shapeTypeRef.current;
267554
+ const shapeType2 = getDrawing().shapeType;
267665
267555
  const currentPoint = e3.absolutePointer;
267666
267556
  const dx = currentPoint.x - downPoint.current.x;
267667
267557
  const dy = currentPoint.y - downPoint.current.y;
@@ -267695,7 +267585,7 @@ const LivePlayer = ({
267695
267585
  canvasRequestRenderAll();
267696
267586
  };
267697
267587
  const drawShareMouseUp = () => {
267698
- const shapeColor2 = shapeColorRef.current;
267588
+ const shapeColor2 = getDrawing().shapeColor;
267699
267589
  if (currentShape.current) {
267700
267590
  if (JSON.stringify(downPoint.current) === JSON.stringify(upPoint.current)) {
267701
267591
  return;
@@ -267710,8 +267600,8 @@ const LivePlayer = ({
267710
267600
  const drawTextMouseDown = (e3) => {
267711
267601
  var _a3;
267712
267602
  const pointer = (_a3 = getter().fabricInstance) == null ? void 0 : _a3.getPointer(e3.e);
267713
- const textColor2 = textColorRef.current;
267714
- const textSize2 = textSizeRef.current;
267603
+ const textColor2 = getDrawing().textColor;
267604
+ const textSize2 = getDrawing().textSize;
267715
267605
  if (pointer) {
267716
267606
  const {
267717
267607
  x,
@@ -267732,8 +267622,8 @@ const LivePlayer = ({
267732
267622
  };
267733
267623
  const enablePenDrawing = () => {
267734
267624
  const canvas = getter().fabricInstance;
267735
- const penColor2 = penColorRef.current;
267736
- const penSize2 = penSizeRef.current;
267625
+ const penColor2 = getDrawing().penColor;
267626
+ const penSize2 = getDrawing().penSize;
267737
267627
  const pencilBrush = new oo(canvas);
267738
267628
  pencilBrush.color = penColor2;
267739
267629
  pencilBrush.width = penSize2;
@@ -267744,8 +267634,8 @@ const LivePlayer = ({
267744
267634
  };
267745
267635
  const enableLaserPenDrawing = () => {
267746
267636
  const canvas = getter().fabricInstance;
267747
- const laserPenColor2 = laserPenColorRef.current;
267748
- const laserPenSize2 = laserPenSizeRef.current;
267637
+ const laserPenColor2 = getDrawing().laserPenColor;
267638
+ const laserPenSize2 = getDrawing().laserPenSize;
267749
267639
  const pencilBrush = new oo(canvas);
267750
267640
  pencilBrush.color = laserPenColor2;
267751
267641
  pencilBrush.width = laserPenSize2;
@@ -269247,28 +269137,9 @@ const LivePlayer = ({
269247
269137
  children: [isMainRole && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
269248
269138
  className: " flex items-center justify-center h-48px gap-5 bg-#222933",
269249
269139
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(DrawingToolbar, {
269250
- selectedTool,
269251
269140
  onToolClick: clickTool,
269252
269141
  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
269142
+ onPreviewClick: () => setIsPreviewModalVisible(true)
269272
269143
  }), callConfig.isCall && /* @__PURE__ */ jsxRuntimeExports.jsx(LayoutSwitcher, {
269273
269144
  className: "absolute right-10",
269274
269145
  currentLayout: layoutMode,
@@ -280200,6 +280071,618 @@ let ErrorBoundary$1 = class ErrorBoundary extends reactExports.Component {
280200
280071
  return this.props.children;
280201
280072
  }
280202
280073
  };
280074
+ const AudioVisualizer = reactExports.memo(
280075
+ ({ selectedMicrophone, isVisible: isVisible3, onVolumeLevelsChange }) => {
280076
+ const [audioContext, setAudioContext] = reactExports.useState(null);
280077
+ const [analyser, setAnalyser] = reactExports.useState(null);
280078
+ const [microphoneStream, setMicrophoneStream] = reactExports.useState(null);
280079
+ const [volumeLevels, setVolumeLevels] = reactExports.useState(Array(12).fill(0));
280080
+ const animationFrameRef = reactExports.useRef(null);
280081
+ const canvasRef = reactExports.useRef(null);
280082
+ const microphoneStreamRef = reactExports.useRef(microphoneStream);
280083
+ const audioContextRef = reactExports.useRef(audioContext);
280084
+ const analyserRef = reactExports.useRef(analyser);
280085
+ reactExports.useEffect(() => {
280086
+ microphoneStreamRef.current = microphoneStream;
280087
+ audioContextRef.current = audioContext;
280088
+ analyserRef.current = analyser;
280089
+ }, [microphoneStream, audioContext, analyser]);
280090
+ const cleanupMediaResources = reactExports.useCallback(() => {
280091
+ if (animationFrameRef.current) {
280092
+ cancelAnimationFrame(animationFrameRef.current);
280093
+ animationFrameRef.current = null;
280094
+ }
280095
+ if (microphoneStreamRef.current) {
280096
+ microphoneStreamRef.current.getTracks().forEach((track) => track.stop());
280097
+ setMicrophoneStream(null);
280098
+ }
280099
+ if (audioContextRef.current) {
280100
+ audioContextRef.current.close().catch((err2) => console.error("关闭音频上下文失败:", err2));
280101
+ setAudioContext(null);
280102
+ setAnalyser(null);
280103
+ }
280104
+ }, []);
280105
+ reactExports.useEffect(() => {
280106
+ if (onVolumeLevelsChange) {
280107
+ onVolumeLevelsChange(volumeLevels);
280108
+ }
280109
+ }, [volumeLevels, onVolumeLevelsChange]);
280110
+ reactExports.useEffect(() => {
280111
+ if (isVisible3 && selectedMicrophone) {
280112
+ const context = new (window.AudioContext || window.webkitAudioContext)();
280113
+ setAudioContext(context);
280114
+ const audioAnalyser = context.createAnalyser();
280115
+ audioAnalyser.fftSize = 2048;
280116
+ setAnalyser(audioAnalyser);
280117
+ navigator.mediaDevices.getUserMedia({
280118
+ audio: {
280119
+ deviceId: selectedMicrophone ? { exact: selectedMicrophone } : void 0
280120
+ }
280121
+ }).then((stream) => {
280122
+ setMicrophoneStream(stream);
280123
+ const source = context.createMediaStreamSource(stream);
280124
+ source.connect(audioAnalyser);
280125
+ const canvas = canvasRef.current;
280126
+ const canvasCtx = canvas == null ? void 0 : canvas.getContext("2d");
280127
+ const frequencyDataArray = new Uint8Array(audioAnalyser.frequencyBinCount);
280128
+ const timeDataArray = new Uint8Array(audioAnalyser.frequencyBinCount);
280129
+ const analyzeVolume = () => {
280130
+ audioAnalyser.getByteFrequencyData(frequencyDataArray);
280131
+ audioAnalyser.getByteTimeDomainData(timeDataArray);
280132
+ if (canvasCtx && canvas) {
280133
+ canvasCtx.clearRect(0, 0, canvas.width, canvas.height);
280134
+ canvasCtx.lineWidth = 2;
280135
+ canvasCtx.strokeStyle = "#2196F3";
280136
+ canvasCtx.beginPath();
280137
+ const sliceWidth = canvas.width / timeDataArray.length;
280138
+ let x = 0;
280139
+ for (let i = 0; i < timeDataArray.length; i++) {
280140
+ const v3 = timeDataArray[i] / 128;
280141
+ const y3 = v3 * canvas.height / 2;
280142
+ if (i === 0) {
280143
+ canvasCtx.moveTo(x, y3);
280144
+ } else {
280145
+ canvasCtx.lineTo(x, y3);
280146
+ }
280147
+ x += sliceWidth;
280148
+ }
280149
+ canvasCtx.lineTo(canvas.width, canvas.height / 2);
280150
+ canvasCtx.stroke();
280151
+ }
280152
+ const segmentSize = Math.floor(frequencyDataArray.length / 12);
280153
+ const normalizedLevels = Array(12).fill(0).map((_2, index2) => {
280154
+ const start2 = index2 * segmentSize;
280155
+ const end2 = start2 + segmentSize;
280156
+ const segmentAvg = frequencyDataArray.slice(start2, end2).reduce((sum2, value) => sum2 + value, 0) / segmentSize;
280157
+ return Math.min(1, Math.pow(segmentAvg / 255, 0.8));
280158
+ });
280159
+ setVolumeLevels(normalizedLevels);
280160
+ animationFrameRef.current = requestAnimationFrame(analyzeVolume);
280161
+ };
280162
+ analyzeVolume();
280163
+ }).catch((err2) => {
280164
+ console.error("获取麦克风失败:", err2);
280165
+ const interval = setInterval(() => {
280166
+ const newLevels = Array(12).fill(0).map(() => Math.random());
280167
+ setVolumeLevels(newLevels);
280168
+ }, 200);
280169
+ return () => clearInterval(interval);
280170
+ });
280171
+ return cleanupMediaResources;
280172
+ }
280173
+ }, [isVisible3, selectedMicrophone, cleanupMediaResources]);
280174
+ reactExports.useEffect(() => {
280175
+ return () => {
280176
+ cleanupMediaResources();
280177
+ };
280178
+ }, [cleanupMediaResources]);
280179
+ 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" }) }) });
280180
+ }
280181
+ );
280182
+ AudioVisualizer.displayName = "AudioVisualizer";
280183
+ class MediaErrorBoundary extends reactExports.Component {
280184
+ constructor(props) {
280185
+ super(props);
280186
+ this.state = {
280187
+ hasError: false,
280188
+ errorMessage: ""
280189
+ };
280190
+ }
280191
+ static getDerivedStateFromError(error2) {
280192
+ return {
280193
+ hasError: true,
280194
+ errorMessage: error2.message
280195
+ };
280196
+ }
280197
+ componentDidCatch(error2, errorInfo) {
280198
+ console.error("媒体设备错误:", error2, errorInfo);
280199
+ }
280200
+ render() {
280201
+ if (this.state.hasError) {
280202
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280203
+ className: "p-4 border border-red-300 rounded bg-red-50",
280204
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx(Alert, {
280205
+ message: "媒体设备错误",
280206
+ description: `无法访问媒体设备: ${this.state.errorMessage}。请检查设备权限或连接。`,
280207
+ type: "error",
280208
+ showIcon: true,
280209
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon, {})
280210
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, {
280211
+ type: "primary",
280212
+ className: "mt-4",
280213
+ onClick: () => this.setState({
280214
+ hasError: false,
280215
+ errorMessage: ""
280216
+ }),
280217
+ children: "重试"
280218
+ })]
280219
+ });
280220
+ }
280221
+ return this.props.children;
280222
+ }
280223
+ }
280224
+ const MediaSettings = () => {
280225
+ const {
280226
+ callCurrentUser,
280227
+ toggleVideo,
280228
+ rtc,
280229
+ getter
280230
+ } = useCallStore();
280231
+ const [isModalVisible, setIsModalVisible] = reactExports.useState(false);
280232
+ const [mirrorEnabled, setMirrorEnabled] = reactExports.useState(true);
280233
+ const [cameraDevices, setCameraDevices] = reactExports.useState([]);
280234
+ const [microphoneDevices, setMicrophoneDevices] = reactExports.useState([]);
280235
+ const [selectedCamera, setSelectedCamera] = reactExports.useState("");
280236
+ const [selectedMicrophone, setSelectedMicrophone] = reactExports.useState("");
280237
+ const [beautySettings, setBeautySettings] = reactExports.useState({
280238
+ enabled: false,
280239
+ whiteIntensity: 0.5,
280240
+ smoothIntensity: 0.5,
280241
+ sharpenIntensity: 0.5
280242
+ });
280243
+ const [beautyExtension, setBeautyExtension] = reactExports.useState(null);
280244
+ const [beautyCompatible, setBeautyCompatible] = reactExports.useState(false);
280245
+ console.log("beautyCompatible", beautyCompatible);
280246
+ const [beautyInitialized, setBeautyInitialized] = reactExports.useState(false);
280247
+ const getDevices = reactExports.useCallback(async () => {
280248
+ try {
280249
+ if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) {
280250
+ console.error("浏览器不支持获取媒体设备列表");
280251
+ staticMethods.error("您的浏览器不支持媒体设备选择功能");
280252
+ return;
280253
+ }
280254
+ await navigator.mediaDevices.getUserMedia({
280255
+ audio: true,
280256
+ video: true
280257
+ }).catch((err2) => console.error("获取媒体权限失败:", err2));
280258
+ const devices = await navigator.mediaDevices.enumerateDevices();
280259
+ const cameras = devices.filter((device) => device.kind === "videoinput").map((device) => ({
280260
+ id: device.deviceId,
280261
+ label: device.label || `摄像头 ${device.deviceId.slice(0, 5)}...`
280262
+ }));
280263
+ const microphones = devices.filter((device) => device.kind === "audioinput").map((device) => ({
280264
+ id: device.deviceId,
280265
+ label: device.label || `麦克风 ${device.deviceId.slice(0, 5)}...`
280266
+ }));
280267
+ if (cameras.length > 0) {
280268
+ setCameraDevices(cameras);
280269
+ setSelectedCamera((prevCamera) => {
280270
+ return cameras.find((cam) => cam.id === prevCamera) ? prevCamera : cameras[0].id;
280271
+ });
280272
+ }
280273
+ if (microphones.length > 0) {
280274
+ setMicrophoneDevices(microphones);
280275
+ setSelectedMicrophone((prevMic) => {
280276
+ return microphones.find((mic) => mic.id === prevMic) ? prevMic : microphones[0].id;
280277
+ });
280278
+ }
280279
+ } catch (error2) {
280280
+ console.error("获取设备列表失败:", error2);
280281
+ staticMethods.error("获取媒体设备失败,请检查设备权限");
280282
+ setCameraDevices([{
280283
+ id: "default",
280284
+ label: "默认摄像头"
280285
+ }]);
280286
+ setMicrophoneDevices([{
280287
+ id: "default",
280288
+ label: "默认麦克风"
280289
+ }]);
280290
+ }
280291
+ }, []);
280292
+ reactExports.useEffect(() => {
280293
+ if (isModalVisible) {
280294
+ getDevices();
280295
+ }
280296
+ if (navigator.mediaDevices) {
280297
+ navigator.mediaDevices.addEventListener("devicechange", getDevices);
280298
+ return () => {
280299
+ navigator.mediaDevices.removeEventListener("devicechange", getDevices);
280300
+ };
280301
+ }
280302
+ }, [getDevices, isModalVisible]);
280303
+ reactExports.useEffect(() => {
280304
+ if (isModalVisible && !beautyInitialized) {
280305
+ initializeBeautyExtension();
280306
+ }
280307
+ }, [isModalVisible, beautyInitialized]);
280308
+ const initializeBeautyExtension = reactExports.useCallback(async () => {
280309
+ try {
280310
+ const rtcInstance = getter().rtc;
280311
+ if (rtcInstance && rtcInstance.beautyExtension) {
280312
+ const extension = rtcInstance.beautyExtension;
280313
+ const compatibilityResult = await extension.checkCompatibility();
280314
+ console.log("浏览器兼容性检查结果:", compatibilityResult);
280315
+ if (compatibilityResult.isCompatible) {
280316
+ setBeautyExtension(extension);
280317
+ setBeautyCompatible(true);
280318
+ setBeautyInitialized(true);
280319
+ console.log("美颜扩展初始化成功");
280320
+ } else {
280321
+ console.warn("浏览器不支持美颜功能:", compatibilityResult.message || "兼容性检查失败");
280322
+ setBeautyCompatible(false);
280323
+ staticMethods.warning("您的浏览器不支持美颜功能,请使用 Chrome 78+ 或其他兼容浏览器");
280324
+ }
280325
+ } else {
280326
+ console.warn("RTC客户端或美颜扩展未初始化");
280327
+ setBeautyCompatible(false);
280328
+ staticMethods.warning("RTC客户端未初始化,无法使用美颜功能");
280329
+ }
280330
+ } catch (error2) {
280331
+ console.error("美颜扩展初始化失败:", error2);
280332
+ setBeautyCompatible(false);
280333
+ staticMethods.error("美颜功能初始化失败");
280334
+ }
280335
+ }, [rtc]);
280336
+ const handleBeautyToggle = reactExports.useCallback((enabled) => {
280337
+ if (!beautyExtension || !beautyCompatible) {
280338
+ staticMethods.warning("美颜功能不可用");
280339
+ return;
280340
+ }
280341
+ try {
280342
+ if (enabled) {
280343
+ beautyExtension.enableBeauty();
280344
+ console.log("美颜已开启");
280345
+ } else {
280346
+ beautyExtension.disableBeauty();
280347
+ console.log("美颜已关闭");
280348
+ }
280349
+ setBeautySettings((prev2) => ({
280350
+ ...prev2,
280351
+ enabled
280352
+ }));
280353
+ } catch (error2) {
280354
+ console.error("美颜开关操作失败:", error2);
280355
+ staticMethods.error("美颜开关操作失败");
280356
+ }
280357
+ }, [beautyExtension, beautyCompatible]);
280358
+ const handleBeautyIntensityChange = reactExports.useCallback(
280359
+ debounce$6((type4, value) => {
280360
+ if (!beautyExtension || !beautyCompatible) {
280361
+ return;
280362
+ }
280363
+ try {
280364
+ let mode;
280365
+ let settingKey;
280366
+ switch (type4) {
280367
+ case "white":
280368
+ mode = EffectBeautyMode.EFFECT_WHITE_MODE;
280369
+ settingKey = "whiteIntensity";
280370
+ break;
280371
+ case "smooth":
280372
+ mode = EffectBeautyMode.EFFECT_SMOOTH_MODE;
280373
+ settingKey = "smoothIntensity";
280374
+ break;
280375
+ case "sharpen":
280376
+ mode = EffectBeautyMode.EFFECT_SHARPEN_MODE;
280377
+ settingKey = "sharpenIntensity";
280378
+ break;
280379
+ default:
280380
+ return;
280381
+ }
280382
+ beautyExtension.setBeautyIntensity(mode, value);
280383
+ setBeautySettings((prev2) => ({
280384
+ ...prev2,
280385
+ [settingKey]: value
280386
+ }));
280387
+ console.log(`${type4} 强度已设置为:`, value);
280388
+ } catch (error2) {
280389
+ console.error("美颜强度设置失败:", error2);
280390
+ staticMethods.error("美颜强度设置失败");
280391
+ }
280392
+ }, 300),
280393
+ // 300ms 防抖延迟
280394
+ [beautyExtension, beautyCompatible]
280395
+ );
280396
+ reactExports.useEffect(() => {
280397
+ const savedBeautySettings = localStorage.getItem("beautySettings");
280398
+ if (savedBeautySettings) {
280399
+ try {
280400
+ const parsed = JSON.parse(savedBeautySettings);
280401
+ setBeautySettings(parsed);
280402
+ } catch (error2) {
280403
+ console.error("加载美颜设置失败:", error2);
280404
+ }
280405
+ }
280406
+ }, []);
280407
+ reactExports.useEffect(() => {
280408
+ localStorage.setItem("beautySettings", JSON.stringify(beautySettings));
280409
+ }, [beautySettings]);
280410
+ const handleCameraChange = reactExports.useCallback(async (newCameraId) => {
280411
+ setSelectedCamera(newCameraId);
280412
+ try {
280413
+ const rtcInstance = getter().rtc;
280414
+ if (rtcInstance && rtcInstance.setMediaDevices) {
280415
+ const result = await rtcInstance.setMediaDevices({
280416
+ cameraId: newCameraId,
280417
+ mirrorEnabled
280418
+ });
280419
+ if (result.success) {
280420
+ console.log("摄像头设备已切换:", newCameraId);
280421
+ } else {
280422
+ console.error("摄像头切换失败:", result.message);
280423
+ staticMethods.error("摄像头切换失败");
280424
+ }
280425
+ }
280426
+ } catch (error2) {
280427
+ console.error("摄像头配置失败:", error2);
280428
+ staticMethods.error("摄像头配置失败");
280429
+ }
280430
+ }, [rtc, mirrorEnabled]);
280431
+ const handleMicrophoneChange = reactExports.useCallback(async (newMicrophoneId) => {
280432
+ setSelectedMicrophone(newMicrophoneId);
280433
+ try {
280434
+ const rtcInstance = getter().rtc;
280435
+ if (rtcInstance && rtcInstance.setMediaDevices) {
280436
+ const result = await rtcInstance.setMediaDevices({
280437
+ microphoneId: newMicrophoneId
280438
+ });
280439
+ if (result.success) {
280440
+ console.log("麦克风设备已切换:", newMicrophoneId);
280441
+ } else {
280442
+ console.error("麦克风切换失败:", result.message);
280443
+ staticMethods.error("麦克风切换失败");
280444
+ }
280445
+ }
280446
+ } catch (error2) {
280447
+ console.error("麦克风配置失败:", error2);
280448
+ staticMethods.error("麦克风配置失败");
280449
+ }
280450
+ }, [rtc]);
280451
+ const handleMirrorChange = reactExports.useCallback(async (checked) => {
280452
+ setMirrorEnabled(checked);
280453
+ try {
280454
+ const rtcInstance = getter().rtc;
280455
+ if (rtcInstance && rtcInstance.setMediaDevices) {
280456
+ const result = await rtcInstance.setMediaDevices({
280457
+ cameraId: selectedCamera,
280458
+ mirrorEnabled: checked
280459
+ });
280460
+ if (result.success) {
280461
+ console.log("镜像翻转已设置:", checked);
280462
+ } else {
280463
+ console.error("镜像翻转设置失败:", result.message);
280464
+ staticMethods.error("镜像翻转设置失败");
280465
+ }
280466
+ }
280467
+ } catch (error2) {
280468
+ console.error("镜像翻转配置失败:", error2);
280469
+ staticMethods.error("镜像翻转配置失败");
280470
+ }
280471
+ }, [rtc, selectedCamera]);
280472
+ const closeMediaSettings = reactExports.useCallback(() => {
280473
+ setIsModalVisible(false);
280474
+ }, []);
280475
+ const openMediaSettings = () => {
280476
+ console.log("openMediaSettings");
280477
+ setIsModalVisible(true);
280478
+ };
280479
+ const handleClose = reactExports.useCallback(() => {
280480
+ closeMediaSettings();
280481
+ }, [closeMediaSettings]);
280482
+ reactExports.useEffect(() => {
280483
+ console.log("useEffect openMediaSettings");
280484
+ eventBus.on("openMediaSettings", openMediaSettings);
280485
+ eventBus.on("closeMediaSettings", closeMediaSettings);
280486
+ return () => {
280487
+ eventBus.off("openMediaSettings", openMediaSettings);
280488
+ eventBus.off("closeMediaSettings", closeMediaSettings);
280489
+ };
280490
+ }, []);
280491
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, {
280492
+ open: isModalVisible,
280493
+ title: "媒体设置",
280494
+ onCancel: handleClose,
280495
+ width: 910,
280496
+ footer: null,
280497
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280498
+ className: "flex justify-between",
280499
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx(MediaErrorBoundary, {
280500
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
280501
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280502
+ className: "mb-6",
280503
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280504
+ className: "flex items-center mb-2",
280505
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
280506
+ className: "mr-2",
280507
+ children: "摄像头:"
280508
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
280509
+ className: "flex-1",
280510
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Select$1, {
280511
+ className: "w-full",
280512
+ value: selectedCamera,
280513
+ onChange: handleCameraChange,
280514
+ options: reactExports.useMemo(() => cameraDevices.map((device) => ({
280515
+ value: device.id,
280516
+ label: device.label
280517
+ })), [cameraDevices])
280518
+ })
280519
+ })]
280520
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280521
+ className: "flex items-center mb-2",
280522
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
280523
+ className: "mr-2",
280524
+ children: "麦克风:"
280525
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
280526
+ className: "flex-1",
280527
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Select$1, {
280528
+ className: "w-full",
280529
+ value: selectedMicrophone,
280530
+ onChange: handleMicrophoneChange,
280531
+ options: reactExports.useMemo(() => microphoneDevices.map((device) => ({
280532
+ value: device.id,
280533
+ label: device.label
280534
+ })), [microphoneDevices])
280535
+ })
280536
+ })]
280537
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280538
+ className: "mt-8",
280539
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
280540
+ className: "flex items-center justify-between mb-2",
280541
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
280542
+ children: "音频监控"
280543
+ })
280544
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx(MediaErrorBoundary, {
280545
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(AudioVisualizer, {
280546
+ selectedMicrophone,
280547
+ isVisible: isModalVisible
280548
+ })
280549
+ })]
280550
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
280551
+ className: "mt-8",
280552
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280553
+ className: "flex items-center justify-between mb-2",
280554
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
280555
+ children: "镜像翻转"
280556
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx(Switch, {
280557
+ checked: mirrorEnabled,
280558
+ onChange: handleMirrorChange,
280559
+ size: "small"
280560
+ })]
280561
+ })
280562
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
280563
+ className: "mt-8 border-t pt-6",
280564
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280565
+ className: "mb-4",
280566
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("h3", {
280567
+ className: "text-lg font-medium mb-4 flex items-center",
280568
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
280569
+ className: "mr-2",
280570
+ children: "🎨"
280571
+ }), "美颜设置", !beautyCompatible && /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
280572
+ className: "ml-2 text-xs text-red-500 bg-red-50 px-2 py-1 rounded",
280573
+ children: "不支持"
280574
+ })]
280575
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280576
+ className: "flex items-center justify-between mb-4",
280577
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
280578
+ className: "text-sm",
280579
+ children: "启用美颜"
280580
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx(Switch, {
280581
+ checked: beautySettings.enabled,
280582
+ onChange: handleBeautyToggle,
280583
+ disabled: !beautyCompatible,
280584
+ size: "small"
280585
+ })]
280586
+ }), beautySettings.enabled && beautyCompatible && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280587
+ className: "space-y-4",
280588
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280589
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280590
+ className: "flex items-center justify-between mb-2",
280591
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
280592
+ className: "text-sm",
280593
+ children: "美白强度"
280594
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
280595
+ className: "text-xs text-gray-500",
280596
+ children: [Math.round(beautySettings.whiteIntensity * 100), "%"]
280597
+ })]
280598
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx(Slider2, {
280599
+ min: 0,
280600
+ max: 1,
280601
+ step: 0.1,
280602
+ value: beautySettings.whiteIntensity,
280603
+ onChange: (value) => handleBeautyIntensityChange("white", value),
280604
+ tooltip: {
280605
+ formatter: (value) => `${Math.round((value || 0) * 100)}%`
280606
+ }
280607
+ })]
280608
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280609
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280610
+ className: "flex items-center justify-between mb-2",
280611
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
280612
+ className: "text-sm",
280613
+ children: "磨皮强度"
280614
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
280615
+ className: "text-xs text-gray-500",
280616
+ children: [Math.round(beautySettings.smoothIntensity * 100), "%"]
280617
+ })]
280618
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx(Slider2, {
280619
+ min: 0,
280620
+ max: 1,
280621
+ step: 0.1,
280622
+ value: beautySettings.smoothIntensity,
280623
+ onChange: (value) => handleBeautyIntensityChange("smooth", value),
280624
+ tooltip: {
280625
+ formatter: (value) => `${Math.round((value || 0) * 100)}%`
280626
+ }
280627
+ })]
280628
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280629
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280630
+ className: "flex items-center justify-between mb-2",
280631
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
280632
+ className: "text-sm",
280633
+ children: "锐化强度"
280634
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
280635
+ className: "text-xs text-gray-500",
280636
+ children: [Math.round(beautySettings.sharpenIntensity * 100), "%"]
280637
+ })]
280638
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx(Slider2, {
280639
+ min: 0,
280640
+ max: 1,
280641
+ step: 0.1,
280642
+ value: beautySettings.sharpenIntensity,
280643
+ onChange: (value) => handleBeautyIntensityChange("sharpen", value),
280644
+ tooltip: {
280645
+ formatter: (value) => `${Math.round((value || 0) * 100)}%`
280646
+ }
280647
+ })]
280648
+ })]
280649
+ }), !beautyCompatible && /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, {
280650
+ message: "美颜功能不可用",
280651
+ description: "您的浏览器不支持美颜功能,请使用 Chrome 78+ 或其他兼容浏览器",
280652
+ type: "warning",
280653
+ showIcon: true,
280654
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon, {}),
280655
+ className: "mt-4"
280656
+ })]
280657
+ })
280658
+ })]
280659
+ })
280660
+ })
280661
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280662
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
280663
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(MediaErrorBoundary, {
280664
+ children: isModalVisible && /* @__PURE__ */ jsxRuntimeExports.jsx(CallUserVideo, {
280665
+ video_id: (callCurrentUser == null ? void 0 : callCurrentUser.rtc_userid) + "preview",
280666
+ user: callCurrentUser,
280667
+ className: " h-60",
280668
+ selectable: false
280669
+ })
280670
+ })
280671
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
280672
+ className: "mt-4 flex items-center justify-center",
280673
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
280674
+ className: "text-sm",
280675
+ children: [(callCurrentUser == null ? void 0 : callCurrentUser.isVideoEnabled) ? "开启" : "关闭", "摄像头"]
280676
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx(Switch, {
280677
+ checked: callCurrentUser == null ? void 0 : callCurrentUser.isVideoEnabled,
280678
+ onChange: toggleVideo,
280679
+ size: "small"
280680
+ })]
280681
+ })]
280682
+ })]
280683
+ })
280684
+ });
280685
+ };
280203
280686
  const CallComponent = () => {
280204
280687
  const liveId = useLiveId();
280205
280688
  const {
@@ -280310,7 +280793,7 @@ const CallComponent = () => {
280310
280793
  })
280311
280794
  }), callConfig.rule === "main" && callConfig.isCall && /* @__PURE__ */ jsxRuntimeExports.jsx(CallBottomActions, {
280312
280795
  onConfigUpdate: handleUpdateRTCConfig
280313
- })]
280796
+ }), (callConfig == null ? void 0 : callConfig.isCall) && /* @__PURE__ */ jsxRuntimeExports.jsx(MediaSettings, {})]
280314
280797
  })
280315
280798
  })
280316
280799
  })
@@ -280967,10 +281450,141 @@ const useCommentSocketStore = create$c((set3, get4) => ({
280967
281450
  disconnect: void 0,
280968
281451
  // 业务方法(空实现,后续由 Hook 覆盖)
280969
281452
  fetChatUrl: async (id3) => {
280970
- },
280971
- setCallback: () => {
280972
281453
  }
280973
281454
  }));
281455
+ function useCommentSocket() {
281456
+ const liveId = useLiveId();
281457
+ const callbackRef = reactExports.useRef();
281458
+ const fetchLivePush = useLivePushCodeStore((state) => state.fetchLivePush);
281459
+ const chat_url = useCommentSocketStore((state) => state.chat_url);
281460
+ const handleMessageChange = reactExports.useCallback((mess) => {
281461
+ var _a2;
281462
+ if (!(mess == null ? void 0 : mess.data))
281463
+ return;
281464
+ let message2;
281465
+ try {
281466
+ message2 = JSON.parse(mess.data);
281467
+ } catch (e3) {
281468
+ console.error("解析 WebSocket 消息失败:", e3);
281469
+ return;
281470
+ }
281471
+ useCommentSocketStore.setState({ latestMessage: mess });
281472
+ switch (message2.type) {
281473
+ case "comment_delete":
281474
+ useCommentSocketStore.setState({ commentDeleteItem: message2.data });
281475
+ setTimeout(() => {
281476
+ useCommentSocketStore.setState({ commentDeleteItem: {} });
281477
+ }, 0);
281478
+ break;
281479
+ case "chat_forward":
281480
+ (_a2 = callbackRef.current) == null ? void 0 : _a2.call(callbackRef, message2.data);
281481
+ break;
281482
+ case "activity_config_change":
281483
+ useCommentSocketStore.setState({ activityConfigChange: message2.data });
281484
+ break;
281485
+ }
281486
+ }, []);
281487
+ const socketRef = reactExports.useRef(null);
281488
+ reactExports.useEffect(() => {
281489
+ if (!chat_url) {
281490
+ return;
281491
+ }
281492
+ if (socketRef.current) {
281493
+ socketRef.current.close();
281494
+ socketRef.current = null;
281495
+ }
281496
+ try {
281497
+ socketRef.current = new WebSocket(chat_url);
281498
+ socketRef.current.onopen = (event) => {
281499
+ if (liveId && socketRef.current) {
281500
+ try {
281501
+ const joinRoomMessage = JSON.stringify({
281502
+ type: "join_room",
281503
+ data: { room_id: liveId }
281504
+ });
281505
+ socketRef.current.send(joinRoomMessage);
281506
+ } catch (error2) {
281507
+ console.error("❌ WebSocket: 发送 join_room 失败:", error2);
281508
+ }
281509
+ }
281510
+ useCommentSocketStore.setState({ readyState: 1 });
281511
+ };
281512
+ socketRef.current.onclose = (event) => {
281513
+ useCommentSocketStore.setState({ readyState: 3 });
281514
+ };
281515
+ socketRef.current.onerror = (error2) => {
281516
+ console.error("❌ WebSocket: 连接错误:", error2);
281517
+ useCommentSocketStore.setState({ readyState: 3 });
281518
+ };
281519
+ socketRef.current.onmessage = (event) => {
281520
+ handleMessageChange(event);
281521
+ };
281522
+ } catch (error2) {
281523
+ console.error("❌ WebSocket: 创建连接失败:", error2);
281524
+ useCommentSocketStore.setState({ readyState: 3 });
281525
+ }
281526
+ return () => {
281527
+ if (socketRef.current) {
281528
+ socketRef.current.close();
281529
+ socketRef.current = null;
281530
+ }
281531
+ };
281532
+ }, [chat_url, liveId, handleMessageChange]);
281533
+ const fetChatUrl = reactExports.useCallback(
281534
+ async (id3) => {
281535
+ if (!id3) {
281536
+ return;
281537
+ }
281538
+ try {
281539
+ const res = await fetchLivePush(id3);
281540
+ if (!res) {
281541
+ console.error("❌ 获取直播推流配置失败");
281542
+ return;
281543
+ }
281544
+ let newChatUrl = res.chat_url || "";
281545
+ if (newChatUrl) {
281546
+ const userAgentParam = `equipment=${encodeURIComponent(navigator.userAgent)}`;
281547
+ newChatUrl += newChatUrl.includes("?") ? `&${userAgentParam}` : `?${userAgentParam}`;
281548
+ } else {
281549
+ console.error("❌ 未获取到有效的 chat_url");
281550
+ }
281551
+ useCommentSocketStore.setState({
281552
+ chat_url: newChatUrl,
281553
+ rtmUrl: res.rtm_push_url || "",
281554
+ webTransportUrl: res.web_transport_url || ""
281555
+ });
281556
+ } catch (error2) {
281557
+ console.error("❌ 获取直播推流配置失败:", error2);
281558
+ }
281559
+ },
281560
+ [fetchLivePush]
281561
+ );
281562
+ const setCallback = reactExports.useCallback((callback) => {
281563
+ callbackRef.current = callback;
281564
+ }, []);
281565
+ const sendMessage = reactExports.useCallback((message2) => {
281566
+ if (socketRef.current && socketRef.current.readyState === 1) {
281567
+ socketRef.current.send(message2);
281568
+ } else {
281569
+ console.error("useCommentSocket - 发送消息失败,WebSocket 未连接");
281570
+ }
281571
+ }, []);
281572
+ const disconnect = reactExports.useCallback(() => {
281573
+ if (socketRef.current) {
281574
+ socketRef.current.close();
281575
+ socketRef.current = null;
281576
+ useCommentSocketStore.setState({ readyState: 3 });
281577
+ }
281578
+ }, []);
281579
+ reactExports.useEffect(() => {
281580
+ useCommentSocketStore.setState({
281581
+ sendMessage,
281582
+ disconnect,
281583
+ fetChatUrl
281584
+ });
281585
+ }, [sendMessage, disconnect, fetChatUrl]);
281586
+ return { ...useCommentSocketStore.getState(), setCallback };
281587
+ }
280974
281588
  function getTargetElement(target, defaultElement) {
280975
281589
  if (!target) {
280976
281590
  return defaultElement;
@@ -288902,7 +289516,7 @@ const ChatComponent = () => {
288902
289516
  fetChatUrl,
288903
289517
  disconnect,
288904
289518
  setCallback
288905
- } = useCommentSocketStore();
289519
+ } = useCommentSocket();
288906
289520
  const [selectFilter, setSelectFilter] = reactExports.useState(1);
288907
289521
  const fetchInteractionList = async () => {
288908
289522
  const res = await request("/bis/interaction-list", {
@@ -288942,11 +289556,20 @@ const ChatComponent = () => {
288942
289556
  }
288943
289557
  };
288944
289558
  reactExports.useEffect(() => {
288945
- fetChatUrl(liveId);
289559
+ setCallback(handleMessage);
288946
289560
  return () => {
288947
- disconnect == null ? void 0 : disconnect();
289561
+ setCallback(() => {
289562
+ });
288948
289563
  };
288949
289564
  }, []);
289565
+ reactExports.useEffect(() => {
289566
+ if (liveId) {
289567
+ fetChatUrl(liveId);
289568
+ }
289569
+ return () => {
289570
+ disconnect == null ? void 0 : disconnect();
289571
+ };
289572
+ }, [liveId, fetChatUrl, disconnect]);
288950
289573
  const handleMessage = (message2) => {
288951
289574
  console.log("New message received:", message2);
288952
289575
  if (Object.keys(message2).length === 0)
@@ -288971,13 +289594,6 @@ const ChatComponent = () => {
288971
289594
  }
288972
289595
  }
288973
289596
  };
288974
- reactExports.useEffect(() => {
288975
- setCallback(handleMessage);
288976
- return () => {
288977
- setCallback(() => {
288978
- });
288979
- };
288980
- }, []);
288981
289597
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
288982
289598
  className: " h-full",
288983
289599
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
@@ -292200,618 +292816,6 @@ const RtcJoomRoom = reactExports.memo(({
292200
292816
  })
292201
292817
  });
292202
292818
  });
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
292819
  const CallHome$1 = () => {
292816
292820
  const audioContextRef = reactExports.useRef(null);
292817
292821
  const audioDestinationRef = reactExports.useRef(null);
@@ -292877,7 +292881,7 @@ const CallHome$1 = () => {
292877
292881
  rule: "sub"
292878
292882
  }), /* @__PURE__ */ jsxRuntimeExports.jsx(RightSidebar, {
292879
292883
  canvasSetting
292880
- }), (callConfig == null ? void 0 : callConfig.isCall) && /* @__PURE__ */ jsxRuntimeExports.jsx(MediaSettings, {})]
292884
+ })]
292881
292885
  })]
292882
292886
  }), (callCurrentUser == null ? void 0 : callCurrentUser.waiting_mode_state) === WaitingModeState.WAITING && /* @__PURE__ */ jsxRuntimeExports.jsx(LiveWaitingRoom, {
292883
292887
  hostName: callConfig.title
@@ -296185,13 +296189,13 @@ const CanvasUploadVideo = ({
296185
296189
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(Dragger$1, {
296186
296190
  ...props,
296187
296191
  children: videoUrl ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
296188
- className: "relative aspect-video flex items-center justify-center videoUploadWrap",
296192
+ className: "relative w-full aspect-video flex items-center justify-center videoUploadWrap",
296189
296193
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx("video", {
296190
296194
  src: videoUrl,
296191
296195
  autoPlay: !isVideoAutoPlay,
296192
- className: " aspect-video"
296196
+ className: "w-full"
296193
296197
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
296194
- className: " h-full absolute top-0 left-0 text-#fff bg-#0009 items-center justify-center uploadContent flex-col",
296198
+ className: "w-full h-full absolute top-0 left-0 text-#fff bg-#0009 items-center justify-center uploadContent flex-col",
296195
296199
  style: {
296196
296200
  display: "none"
296197
296201
  },
@@ -296335,7 +296339,7 @@ const CanvasUploadAudio = ({
296335
296339
  className: "mt-2",
296336
296340
  children: fileData.current.name
296337
296341
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
296338
- className: " h-full absolute top-0 left-0 text-#fff bg-#0009 items-center justify-center uploadContent flex-col",
296342
+ className: "w-full h-full absolute top-0 left-0 text-#fff bg-#0009 items-center justify-center uploadContent flex-col",
296339
296343
  style: {
296340
296344
  display: "none"
296341
296345
  },
@@ -305608,7 +305612,6 @@ const CallHome = () => {
305608
305612
  fabricInstance,
305609
305613
  updateCallConfig
305610
305614
  } = useCallStore();
305611
- console.log("重新渲染推流端");
305612
305615
  const pcRef = reactExports.useRef(null);
305613
305616
  const audioContextRef = reactExports.useRef(null);
305614
305617
  const audioDestinationRef = reactExports.useRef(null);
@@ -305773,16 +305776,6 @@ const CallHome = () => {
305773
305776
  newBackgroundAudioStreams.set(streamId, audioStream);
305774
305777
  audioStreamRef.current = newBackgroundAudioStreams;
305775
305778
  });
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
305779
  }, []);
305787
305780
  reactExports.useEffect(() => {
305788
305781
  const handleBeforeUnload = (e3) => {
@@ -305835,26 +305828,54 @@ const CallHome = () => {
305835
305828
  return;
305836
305829
  (_a3 = livePlayerRef.current) == null ? void 0 : _a3.canvasRequestRenderAll();
305837
305830
  }, [isSelectedId, isHoveredId]);
305838
- const sizeEl = useSdkStore((state) => state.callConfig.el);
305831
+ const {
305832
+ sizeEl,
305833
+ styleConfig
305834
+ } = useSdkStore((state) => ({
305835
+ sizeEl: state.callConfig.el,
305836
+ styleConfig: state.styleConfig
305837
+ }));
305839
305838
  const wapRef = reactExports.useRef(null);
305840
305839
  reactExports.useEffect(() => {
305841
- console.log("[livePlayer.设置视频容器高度]", sizeEl);
305842
305840
  if (!wapRef.current)
305843
305841
  return;
305844
- let el2;
305842
+ let el2 = null;
305845
305843
  if (typeof sizeEl === "string") {
305846
305844
  el2 = document.getElementById(sizeEl);
305847
- } else {
305845
+ if (!el2) {
305846
+ console.warn(`[ResizeObserver] 找不到 ID 为 "${sizeEl}" 的元素,`);
305847
+ }
305848
+ } else if (sizeEl instanceof HTMLElement) {
305848
305849
  el2 = sizeEl;
305850
+ } else {
305851
+ console.warn("[ResizeObserver] sizeEl 无效,");
305849
305852
  }
305850
- if (!el2)
305853
+ if (!el2) {
305854
+ console.error("[ResizeObserver] 无法获取要观察的元素");
305851
305855
  return;
305856
+ }
305857
+ console.log("[ResizeObserver] 开始观察元素:", el2);
305858
+ const updateHeight = () => {
305859
+ if (wapRef.current) {
305860
+ const newHeight = el2.clientHeight - 60;
305861
+ wapRef.current.style.height = newHeight + "px";
305862
+ wapRef.current.style.minHeight = "770px";
305863
+ console.log("[ResizeObserver] 更新高度:", newHeight);
305864
+ }
305865
+ };
305852
305866
  const resizeObserver2 = new ResizeObserver(() => {
305853
- wapRef.current.style.height = (el2 == null ? void 0 : el2.clientHeight) - 60 + "px";
305867
+ updateHeight();
305854
305868
  });
305855
305869
  resizeObserver2.observe(el2);
305870
+ const handleWindowResize = () => {
305871
+ updateHeight();
305872
+ };
305873
+ window.addEventListener("resize", handleWindowResize);
305874
+ updateHeight();
305856
305875
  return () => {
305876
+ console.log("[ResizeObserver] 停止观察元素:", el2);
305857
305877
  resizeObserver2.disconnect();
305878
+ window.removeEventListener("resize", handleWindowResize);
305858
305879
  };
305859
305880
  }, [sizeEl]);
305860
305881
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(ConfigProvider$1, {
@@ -305869,7 +305890,7 @@ const CallHome = () => {
305869
305890
  }
305870
305891
  },
305871
305892
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(RtcJoomRoom, {}), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
305872
- className: "h-full bg-#0e131c min-w-[1500px] min-h-[770px] overflow-auto",
305893
+ className: `h-full bg-#0e131c min-w-[${styleConfig.minWidth}] min-h-[${styleConfig.minHeight}] overflow-auto`,
305873
305894
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(Head$1, {
305874
305895
  canvasSetting,
305875
305896
  setCanvasSetting,
@@ -305880,7 +305901,7 @@ const CallHome = () => {
305880
305901
  audioDestinationRef
305881
305902
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
305882
305903
  ref: wapRef,
305883
- className: "h-[calc(100vh-60px)] relative flex mt-1 gap-1 ",
305904
+ className: "h-[calc(100%-60px)] relative flex mt-1 gap-1 ",
305884
305905
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(LeftSidebar, {
305885
305906
  onSceneClick: handleSceneClick,
305886
305907
  currentScene,