@vivix-ai/ivi-frontend-sdk 0.3.7 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1107,6 +1107,8 @@ var ConversationManager = class {
1107
1107
 
1108
1108
  // src/runtime/managers/trtc-source-manager.ts
1109
1109
  var TAG = "[IVI-TRTC]";
1110
+ var TRTC_VIEW_ATTR = "data-ivi-trtc-view";
1111
+ var TRTC_MEDIA_STYLE_ID = "ivi-trtc-media-style";
1110
1112
  var DEFAULT_DENOISER_OPTIONS = {
1111
1113
  enabled: true,
1112
1114
  mode: "normal"
@@ -1268,6 +1270,8 @@ var TrtcSourceManager = class {
1268
1270
  if (!session) {
1269
1271
  throw new Error(`TRTC source session not found: ${sourceId}`);
1270
1272
  }
1273
+ ensureTrtcMediaStyleSheet();
1274
+ container.setAttribute(TRTC_VIEW_ATTR, "");
1271
1275
  session.views.set(viewId, {
1272
1276
  sourceId,
1273
1277
  container,
@@ -1290,6 +1294,7 @@ var TrtcSourceManager = class {
1290
1294
  }
1291
1295
  const binding = session.views.get(viewId);
1292
1296
  if (binding?.sourceId === sourceId) {
1297
+ binding.container.removeAttribute(TRTC_VIEW_ATTR);
1293
1298
  session.views.delete(viewId);
1294
1299
  }
1295
1300
  void this.applyAudioPolicy(session);
@@ -1311,6 +1316,7 @@ var TrtcSourceManager = class {
1311
1316
  this.sourceSessionKeys.delete(sourceId);
1312
1317
  session.views.forEach((binding, viewId) => {
1313
1318
  if (binding.sourceId === sourceId) {
1319
+ binding.container.removeAttribute(TRTC_VIEW_ATTR);
1314
1320
  session.views.delete(viewId);
1315
1321
  }
1316
1322
  });
@@ -1630,6 +1636,38 @@ var TrtcSourceManager = class {
1630
1636
  this.onTrtcEvent?.(event);
1631
1637
  }
1632
1638
  };
1639
+ function ensureTrtcMediaStyleSheet() {
1640
+ if (typeof document === "undefined") {
1641
+ return;
1642
+ }
1643
+ if (document.getElementById(TRTC_MEDIA_STYLE_ID)) {
1644
+ return;
1645
+ }
1646
+ const style = document.createElement("style");
1647
+ style.id = TRTC_MEDIA_STYLE_ID;
1648
+ style.textContent = `
1649
+ [${TRTC_VIEW_ATTR}] [id^="player_"],
1650
+ [${TRTC_VIEW_ATTR}] [id^="video_"],
1651
+ [${TRTC_VIEW_ATTR}] [id^="audio_"],
1652
+ [${TRTC_VIEW_ATTR}] video,
1653
+ [${TRTC_VIEW_ATTR}] canvas {
1654
+ width: 100% !important;
1655
+ height: 100% !important;
1656
+ max-width: 100% !important;
1657
+ max-height: 100% !important;
1658
+ background: transparent !important;
1659
+ background-color: transparent !important;
1660
+ background-image: none !important;
1661
+ }
1662
+
1663
+ [${TRTC_VIEW_ATTR}] video,
1664
+ [${TRTC_VIEW_ATTR}] canvas {
1665
+ object-fit: contain !important;
1666
+ display: block !important;
1667
+ }
1668
+ `;
1669
+ document.head.appendChild(style);
1670
+ }
1633
1671
  function isRuntimeTrtcSource(source) {
1634
1672
  return source.status === "ready" && source.playback?.type === "trtc" && typeof source.playback.trtc === "object" && source.playback.trtc !== null;
1635
1673
  }
@@ -1721,6 +1759,9 @@ function enforceContainMedia(container) {
1721
1759
  element.style.setProperty("max-height", "100%", "important");
1722
1760
  element.style.setProperty("object-fit", "contain", "important");
1723
1761
  element.style.setProperty("display", "block", "important");
1762
+ element.style.setProperty("background", "transparent", "important");
1763
+ element.style.setProperty("background-color", "transparent", "important");
1764
+ element.style.setProperty("background-image", "none", "important");
1724
1765
  });
1725
1766
  }
1726
1767
 
@@ -3618,7 +3659,6 @@ function IVITrtcPlayer(props) {
3618
3659
  height: "100%",
3619
3660
  minWidth: 0,
3620
3661
  minHeight: 0,
3621
- backgroundColor: "#000",
3622
3662
  position: "relative",
3623
3663
  ...style
3624
3664
  },