@vivix-ai/ivi-frontend-sdk 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +42 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +42 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3828,6 +3828,19 @@ function detectMediaVolumeType(source) {
|
|
|
3828
3828
|
if (!url) return null;
|
|
3829
3829
|
return isM3u8Url(url) ? "hls" : "video";
|
|
3830
3830
|
}
|
|
3831
|
+
function getSourceRenderKey(sourceId, source) {
|
|
3832
|
+
const trtc = getTrtcPlayback(source.playback);
|
|
3833
|
+
if (!trtc) {
|
|
3834
|
+
return sourceId;
|
|
3835
|
+
}
|
|
3836
|
+
return [
|
|
3837
|
+
"trtc",
|
|
3838
|
+
trtc.app_id ?? "",
|
|
3839
|
+
trtc.room_id ?? "",
|
|
3840
|
+
trtc.user_id ?? "",
|
|
3841
|
+
trtc.user_sig ?? ""
|
|
3842
|
+
].join(":");
|
|
3843
|
+
}
|
|
3831
3844
|
function TrackSlotMediaContent(props) {
|
|
3832
3845
|
const {
|
|
3833
3846
|
slot,
|
|
@@ -3865,7 +3878,7 @@ function TrackSlotMediaContent(props) {
|
|
|
3865
3878
|
IVITrtcPlayer,
|
|
3866
3879
|
{
|
|
3867
3880
|
trtc,
|
|
3868
|
-
sourceId:
|
|
3881
|
+
sourceId: slotSourceId,
|
|
3869
3882
|
runtime,
|
|
3870
3883
|
...trtcPlayerProps,
|
|
3871
3884
|
muted: trtcMuted,
|
|
@@ -4020,26 +4033,35 @@ function SlotVideo(props) {
|
|
|
4020
4033
|
// src/react/internal/use-multi-preload-sources.ts
|
|
4021
4034
|
function useMultiPreloadSources(sources, activeSourceId) {
|
|
4022
4035
|
return react.useMemo(() => {
|
|
4023
|
-
|
|
4024
|
-
for (const [id, runtimeSource] of sources) {
|
|
4025
|
-
const isActive = id === activeSourceId;
|
|
4026
|
-
const shouldMount = Boolean(runtimeSource.preload) || isActive;
|
|
4027
|
-
if (!shouldMount) {
|
|
4028
|
-
continue;
|
|
4029
|
-
}
|
|
4030
|
-
const ready = toReadyRuntimeSource(runtimeSource);
|
|
4031
|
-
if (!ready) {
|
|
4032
|
-
continue;
|
|
4033
|
-
}
|
|
4034
|
-
entries.push({
|
|
4035
|
-
sourceId: id,
|
|
4036
|
-
source: ready,
|
|
4037
|
-
isActive
|
|
4038
|
-
});
|
|
4039
|
-
}
|
|
4040
|
-
return entries;
|
|
4036
|
+
return buildPreloadSourceEntries(sources, activeSourceId);
|
|
4041
4037
|
}, [sources, activeSourceId]);
|
|
4042
4038
|
}
|
|
4039
|
+
function buildPreloadSourceEntries(sources, activeSourceId) {
|
|
4040
|
+
const entriesByRenderKey = /* @__PURE__ */ new Map();
|
|
4041
|
+
for (const [id, runtimeSource] of sources) {
|
|
4042
|
+
const isActive = id === activeSourceId;
|
|
4043
|
+
const shouldMount = Boolean(runtimeSource.preload) || isActive;
|
|
4044
|
+
if (!shouldMount) {
|
|
4045
|
+
continue;
|
|
4046
|
+
}
|
|
4047
|
+
const ready = toReadyRuntimeSource(runtimeSource);
|
|
4048
|
+
if (!ready) {
|
|
4049
|
+
continue;
|
|
4050
|
+
}
|
|
4051
|
+
const renderKey = getSourceRenderKey(id, ready);
|
|
4052
|
+
const entry = {
|
|
4053
|
+
sourceId: id,
|
|
4054
|
+
renderKey,
|
|
4055
|
+
source: ready,
|
|
4056
|
+
isActive
|
|
4057
|
+
};
|
|
4058
|
+
const previous = entriesByRenderKey.get(renderKey);
|
|
4059
|
+
if (!previous || !previous.isActive && isActive) {
|
|
4060
|
+
entriesByRenderKey.set(renderKey, entry);
|
|
4061
|
+
}
|
|
4062
|
+
}
|
|
4063
|
+
return Array.from(entriesByRenderKey.values());
|
|
4064
|
+
}
|
|
4043
4065
|
function IVITrackSlot(props) {
|
|
4044
4066
|
const {
|
|
4045
4067
|
slot,
|
|
@@ -4129,7 +4151,7 @@ function IVITrackSlot(props) {
|
|
|
4129
4151
|
}
|
|
4130
4152
|
) })
|
|
4131
4153
|
},
|
|
4132
|
-
entry.
|
|
4154
|
+
entry.renderKey
|
|
4133
4155
|
);
|
|
4134
4156
|
}),
|
|
4135
4157
|
showSubtitle && activeSource && supportsSubtitleOverlay(activeSource) && /* @__PURE__ */ jsxRuntime.jsx("div", { style: SUBTITLE_OVERLAY_STYLE, children: /* @__PURE__ */ jsxRuntime.jsx(
|