@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 +41 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +41 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -1105,6 +1105,8 @@ var ConversationManager = class {
|
|
|
1105
1105
|
|
|
1106
1106
|
// src/runtime/managers/trtc-source-manager.ts
|
|
1107
1107
|
var TAG = "[IVI-TRTC]";
|
|
1108
|
+
var TRTC_VIEW_ATTR = "data-ivi-trtc-view";
|
|
1109
|
+
var TRTC_MEDIA_STYLE_ID = "ivi-trtc-media-style";
|
|
1108
1110
|
var DEFAULT_DENOISER_OPTIONS = {
|
|
1109
1111
|
enabled: true,
|
|
1110
1112
|
mode: "normal"
|
|
@@ -1266,6 +1268,8 @@ var TrtcSourceManager = class {
|
|
|
1266
1268
|
if (!session) {
|
|
1267
1269
|
throw new Error(`TRTC source session not found: ${sourceId}`);
|
|
1268
1270
|
}
|
|
1271
|
+
ensureTrtcMediaStyleSheet();
|
|
1272
|
+
container.setAttribute(TRTC_VIEW_ATTR, "");
|
|
1269
1273
|
session.views.set(viewId, {
|
|
1270
1274
|
sourceId,
|
|
1271
1275
|
container,
|
|
@@ -1288,6 +1292,7 @@ var TrtcSourceManager = class {
|
|
|
1288
1292
|
}
|
|
1289
1293
|
const binding = session.views.get(viewId);
|
|
1290
1294
|
if (binding?.sourceId === sourceId) {
|
|
1295
|
+
binding.container.removeAttribute(TRTC_VIEW_ATTR);
|
|
1291
1296
|
session.views.delete(viewId);
|
|
1292
1297
|
}
|
|
1293
1298
|
void this.applyAudioPolicy(session);
|
|
@@ -1309,6 +1314,7 @@ var TrtcSourceManager = class {
|
|
|
1309
1314
|
this.sourceSessionKeys.delete(sourceId);
|
|
1310
1315
|
session.views.forEach((binding, viewId) => {
|
|
1311
1316
|
if (binding.sourceId === sourceId) {
|
|
1317
|
+
binding.container.removeAttribute(TRTC_VIEW_ATTR);
|
|
1312
1318
|
session.views.delete(viewId);
|
|
1313
1319
|
}
|
|
1314
1320
|
});
|
|
@@ -1628,6 +1634,38 @@ var TrtcSourceManager = class {
|
|
|
1628
1634
|
this.onTrtcEvent?.(event);
|
|
1629
1635
|
}
|
|
1630
1636
|
};
|
|
1637
|
+
function ensureTrtcMediaStyleSheet() {
|
|
1638
|
+
if (typeof document === "undefined") {
|
|
1639
|
+
return;
|
|
1640
|
+
}
|
|
1641
|
+
if (document.getElementById(TRTC_MEDIA_STYLE_ID)) {
|
|
1642
|
+
return;
|
|
1643
|
+
}
|
|
1644
|
+
const style = document.createElement("style");
|
|
1645
|
+
style.id = TRTC_MEDIA_STYLE_ID;
|
|
1646
|
+
style.textContent = `
|
|
1647
|
+
[${TRTC_VIEW_ATTR}] [id^="player_"],
|
|
1648
|
+
[${TRTC_VIEW_ATTR}] [id^="video_"],
|
|
1649
|
+
[${TRTC_VIEW_ATTR}] [id^="audio_"],
|
|
1650
|
+
[${TRTC_VIEW_ATTR}] video,
|
|
1651
|
+
[${TRTC_VIEW_ATTR}] canvas {
|
|
1652
|
+
width: 100% !important;
|
|
1653
|
+
height: 100% !important;
|
|
1654
|
+
max-width: 100% !important;
|
|
1655
|
+
max-height: 100% !important;
|
|
1656
|
+
background: transparent !important;
|
|
1657
|
+
background-color: transparent !important;
|
|
1658
|
+
background-image: none !important;
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
[${TRTC_VIEW_ATTR}] video,
|
|
1662
|
+
[${TRTC_VIEW_ATTR}] canvas {
|
|
1663
|
+
object-fit: contain !important;
|
|
1664
|
+
display: block !important;
|
|
1665
|
+
}
|
|
1666
|
+
`;
|
|
1667
|
+
document.head.appendChild(style);
|
|
1668
|
+
}
|
|
1631
1669
|
function isRuntimeTrtcSource(source) {
|
|
1632
1670
|
return source.status === "ready" && source.playback?.type === "trtc" && typeof source.playback.trtc === "object" && source.playback.trtc !== null;
|
|
1633
1671
|
}
|
|
@@ -1719,6 +1757,9 @@ function enforceContainMedia(container) {
|
|
|
1719
1757
|
element.style.setProperty("max-height", "100%", "important");
|
|
1720
1758
|
element.style.setProperty("object-fit", "contain", "important");
|
|
1721
1759
|
element.style.setProperty("display", "block", "important");
|
|
1760
|
+
element.style.setProperty("background", "transparent", "important");
|
|
1761
|
+
element.style.setProperty("background-color", "transparent", "important");
|
|
1762
|
+
element.style.setProperty("background-image", "none", "important");
|
|
1722
1763
|
});
|
|
1723
1764
|
}
|
|
1724
1765
|
|
|
@@ -3616,7 +3657,6 @@ function IVITrtcPlayer(props) {
|
|
|
3616
3657
|
height: "100%",
|
|
3617
3658
|
minWidth: 0,
|
|
3618
3659
|
minHeight: 0,
|
|
3619
|
-
backgroundColor: "#000",
|
|
3620
3660
|
position: "relative",
|
|
3621
3661
|
...style
|
|
3622
3662
|
},
|