mediasfu-vue 1.1.3 → 1.2.0
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/CHANGELOG.md +6 -0
- package/README.md +14 -0
- package/dist/index.cjs +123 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +124 -41
- package/dist/index.js.map +1 -1
- package/dist/mediasfu-vue.css +10 -10
- package/package.json +2 -2
- package/src/components/backgroundComponents/BackgroundModal.vue +55 -25
- package/src/modern/modal_components/ModernBackgroundModal.vue +86 -33
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.2.0 — 2026-09-21
|
|
4
|
+
|
|
5
|
+
- Added person-aware background blur to the classic and modern background modals.
|
|
6
|
+
- Uses the shared compositor and stable `"blur"` state so modal, hybrid, and headless integrations follow one virtual-background contract.
|
|
7
|
+
- Requires `mediasfu-shared` 1.2.3 or later for blur helpers and consume-socket lifecycle cleanup.
|
|
8
|
+
|
|
3
9
|
## 1.1.3 — 2026-09-16
|
|
4
10
|
|
|
5
11
|
- Requires `mediasfu-shared` 1.2.2 or later. That release reports the room layout to the recording service as soon as a recording starts, instead of waiting for the next participant or screen change.
|
package/README.md
CHANGED
|
@@ -326,6 +326,20 @@ camera media from `useMediasfuHeadless().localVideo`; it resolves the active
|
|
|
326
326
|
processed/virtual stream before the raw camera, so self-view matches the stream
|
|
327
327
|
published to everyone else.
|
|
328
328
|
|
|
329
|
+
The classic and modern background modals include **Blur** alongside image
|
|
330
|
+
backgrounds. Fully custom web UIs can use the same room lifecycle directly:
|
|
331
|
+
|
|
332
|
+
```ts
|
|
333
|
+
import { applyBackgroundBlur, clearVirtualBackground } from 'mediasfu-shared';
|
|
334
|
+
|
|
335
|
+
await applyBackgroundBlur({ parameters: latestRoomParameters, blurPixels: 16 });
|
|
336
|
+
await clearVirtualBackground({ parameters: latestRoomParameters });
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
Turn the camera on before applying an effect. Keep the parameter publication
|
|
340
|
+
current and render the SDK-resolved local stream; do not build a second canvas
|
|
341
|
+
pipeline or select the raw camera stream yourself.
|
|
342
|
+
|
|
329
343
|
Reuse `ModernBreakoutRoomsModal` with the same live room bag when you want the
|
|
330
344
|
built-in planner. Save assignments before Start and show action errors in your
|
|
331
345
|
page. Filtering tiles is not a breakout transition: the SDK must update room
|
package/dist/index.cjs
CHANGED
|
@@ -17800,6 +17800,36 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
|
|
|
17800
17800
|
});
|
|
17801
17801
|
container.appendChild(img);
|
|
17802
17802
|
});
|
|
17803
|
+
const blurBackground = document.createElement("div");
|
|
17804
|
+
blurBackground.classList.add("img-thumbnail", "m-1", "d-flex", "align-items-center", "justify-content-center");
|
|
17805
|
+
blurBackground.setAttribute("role", "button");
|
|
17806
|
+
blurBackground.setAttribute("aria-label", "Blur background");
|
|
17807
|
+
blurBackground.style.width = "68px";
|
|
17808
|
+
blurBackground.style.minHeight = "52px";
|
|
17809
|
+
blurBackground.style.cursor = "pointer";
|
|
17810
|
+
blurBackground.style.background = "linear-gradient(135deg, rgba(96,165,250,.45), rgba(15,23,42,.92))";
|
|
17811
|
+
blurBackground.style.border = "1px solid rgba(148, 163, 184, 0.28)";
|
|
17812
|
+
blurBackground.style.borderRadius = "10px";
|
|
17813
|
+
blurBackground.innerHTML = '<span style="color:#e2e8f0; font-weight:600;">Blur</span>';
|
|
17814
|
+
blurBackground.addEventListener("click", () => {
|
|
17815
|
+
selectedImage.value = mediasfuShared.VIRTUAL_BACKGROUND_BLUR;
|
|
17816
|
+
customImage.value = "";
|
|
17817
|
+
props.parameters.updateSelectedImage?.(mediasfuShared.VIRTUAL_BACKGROUND_BLUR);
|
|
17818
|
+
props.parameters.updateCustomImage?.("");
|
|
17819
|
+
clearCanvas();
|
|
17820
|
+
const canvas = backgroundCanvasRef.value;
|
|
17821
|
+
const context = canvas?.getContext("2d");
|
|
17822
|
+
if (canvas && context) {
|
|
17823
|
+
context.fillStyle = "#1e293b";
|
|
17824
|
+
context.fillRect(0, 0, canvas.width, canvas.height);
|
|
17825
|
+
context.fillStyle = "#e2e8f0";
|
|
17826
|
+
context.font = "600 26px Arial";
|
|
17827
|
+
context.textAlign = "center";
|
|
17828
|
+
context.textBaseline = "middle";
|
|
17829
|
+
context.fillText("Blur", canvas.width / 2, canvas.height / 2);
|
|
17830
|
+
}
|
|
17831
|
+
});
|
|
17832
|
+
container.appendChild(blurBackground);
|
|
17803
17833
|
const noBackground = document.createElement("div");
|
|
17804
17834
|
noBackground.classList.add("img-thumbnail", "m-1", "d-flex", "align-items-center", "justify-content-center");
|
|
17805
17835
|
noBackground.style.width = "68px";
|
|
@@ -17940,10 +17970,11 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
|
|
|
17940
17970
|
const selfieSegmentationPreview = async (doSegmentation) => {
|
|
17941
17971
|
const refVideo = captureVideoRef.value;
|
|
17942
17972
|
const previewVideo = videoPreviewRef.value;
|
|
17973
|
+
const useBlur = mediasfuShared.isVirtualBackgroundBlur(selectedImage.value);
|
|
17943
17974
|
const virtualImage = new Image();
|
|
17944
17975
|
virtualImage.crossOrigin = "anonymous";
|
|
17945
|
-
virtualImage.src = selectedImage.value || "";
|
|
17946
|
-
if (doSegmentation && selectedImage.value) {
|
|
17976
|
+
virtualImage.src = useBlur ? "" : selectedImage.value || "";
|
|
17977
|
+
if (doSegmentation && selectedImage.value && !useBlur) {
|
|
17947
17978
|
await new Promise((resolve) => {
|
|
17948
17979
|
if (virtualImage.complete && virtualImage.naturalWidth > 0) {
|
|
17949
17980
|
resolve();
|
|
@@ -17976,23 +18007,18 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
|
|
|
17976
18007
|
};
|
|
17977
18008
|
const onResults = (results) => {
|
|
17978
18009
|
try {
|
|
17979
|
-
if (!pauseSegmentation.value && mediaCanvas && mediaCanvas.width > 0 && mediaCanvas.height > 0 && virtualImage && virtualImage.width > 0 && virtualImage.height > 0) {
|
|
17980
|
-
ctx?.save();
|
|
17981
|
-
ctx?.clearRect(0, 0, mediaCanvas.width, mediaCanvas.height);
|
|
17982
|
-
if (ctx) ctx.globalCompositeOperation = "source-over";
|
|
17983
|
-
ctx?.drawImage(results.segmentationMask, 0, 0, mediaCanvas.width, mediaCanvas.height);
|
|
18010
|
+
if (!pauseSegmentation.value && mediaCanvas && mediaCanvas.width > 0 && mediaCanvas.height > 0 && (useBlur || virtualImage && virtualImage.width > 0 && virtualImage.height > 0)) {
|
|
17984
18011
|
if (ctx) {
|
|
17985
|
-
|
|
17986
|
-
|
|
17987
|
-
|
|
17988
|
-
|
|
17989
|
-
|
|
17990
|
-
|
|
17991
|
-
|
|
17992
|
-
|
|
17993
|
-
|
|
17994
|
-
|
|
17995
|
-
ctx.restore();
|
|
18012
|
+
mediasfuShared.compositeVirtualBackgroundFrame({
|
|
18013
|
+
ctx,
|
|
18014
|
+
segmentationMask: results.segmentationMask,
|
|
18015
|
+
sourceImage: results.image,
|
|
18016
|
+
backgroundImage: useBlur ? null : virtualImage,
|
|
18017
|
+
width: mediaCanvas.width,
|
|
18018
|
+
height: mediaCanvas.height,
|
|
18019
|
+
repeatPattern: repeatMode,
|
|
18020
|
+
blurFallbackPixels: useBlur ? mediasfuShared.DEFAULT_BACKGROUND_BLUR_PIXELS : 0
|
|
18021
|
+
});
|
|
17996
18022
|
markFirstFrameRendered();
|
|
17997
18023
|
}
|
|
17998
18024
|
}
|
|
@@ -18157,7 +18183,7 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
|
|
|
18157
18183
|
}
|
|
18158
18184
|
}
|
|
18159
18185
|
try {
|
|
18160
|
-
if (virtualImage.width < mediaCanvas.width || virtualImage.height < mediaCanvas.height) {
|
|
18186
|
+
if (!useBlur && (virtualImage.width < mediaCanvas.width || virtualImage.height < mediaCanvas.height)) {
|
|
18161
18187
|
repeatMode = "repeat";
|
|
18162
18188
|
}
|
|
18163
18189
|
} catch {
|
|
@@ -18327,8 +18353,10 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
|
|
|
18327
18353
|
}
|
|
18328
18354
|
}
|
|
18329
18355
|
renderDefaultImages();
|
|
18330
|
-
if (selectedImage.value) {
|
|
18356
|
+
if (selectedImage.value && !mediasfuShared.isVirtualBackgroundBlur(selectedImage.value)) {
|
|
18331
18357
|
await loadImageToCanvas(selectedImage.value, selectedImage.value);
|
|
18358
|
+
} else if (mediasfuShared.isVirtualBackgroundBlur(selectedImage.value)) {
|
|
18359
|
+
renderDefaultImages();
|
|
18332
18360
|
} else {
|
|
18333
18361
|
clearCanvas();
|
|
18334
18362
|
}
|
|
@@ -18825,7 +18853,7 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
|
|
|
18825
18853
|
};
|
|
18826
18854
|
}
|
|
18827
18855
|
});
|
|
18828
|
-
const BackgroundModal = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__scopeId", "data-v-
|
|
18856
|
+
const BackgroundModal = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__scopeId", "data-v-b065eaa4"]]);
|
|
18829
18857
|
const _hoisted_1$e = { class: "card-header" };
|
|
18830
18858
|
const _hoisted_2$b = { class: "room-title" };
|
|
18831
18859
|
const _hoisted_3$a = { class: "room-actions" };
|
|
@@ -45064,6 +45092,31 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
45064
45092
|
clearCanvas();
|
|
45065
45093
|
hideLoading();
|
|
45066
45094
|
};
|
|
45095
|
+
const handleBlurBackground = () => {
|
|
45096
|
+
selectedImage.value = mediasfuShared.VIRTUAL_BACKGROUND_BLUR;
|
|
45097
|
+
customImage.value = "";
|
|
45098
|
+
props.parameters.updateSelectedImage?.(mediasfuShared.VIRTUAL_BACKGROUND_BLUR);
|
|
45099
|
+
props.parameters.updateCustomImage?.("");
|
|
45100
|
+
const canvas = backgroundCanvasRef.value;
|
|
45101
|
+
const ctx = canvas?.getContext("2d");
|
|
45102
|
+
if (canvas && ctx) {
|
|
45103
|
+
canvas.width = 640;
|
|
45104
|
+
canvas.height = 360;
|
|
45105
|
+
const gradient = ctx.createLinearGradient(0, 0, canvas.width, canvas.height);
|
|
45106
|
+
gradient.addColorStop(0, "#334155");
|
|
45107
|
+
gradient.addColorStop(1, "#0f172a");
|
|
45108
|
+
ctx.fillStyle = gradient;
|
|
45109
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
45110
|
+
ctx.fillStyle = "#e2e8f0";
|
|
45111
|
+
ctx.font = "600 26px Arial";
|
|
45112
|
+
ctx.textAlign = "center";
|
|
45113
|
+
ctx.textBaseline = "middle";
|
|
45114
|
+
ctx.fillText("Blur", canvas.width / 2, canvas.height / 2);
|
|
45115
|
+
}
|
|
45116
|
+
showPreviewVideo.value = false;
|
|
45117
|
+
showBackgroundCanvas.value = true;
|
|
45118
|
+
resetActionButtons();
|
|
45119
|
+
};
|
|
45067
45120
|
const chooseResolutionSource = (entry) => {
|
|
45068
45121
|
const parameters = getCurrentParameters();
|
|
45069
45122
|
if (parameters.targetResolution === "fhd" || parameters.targetResolution === "qhd") {
|
|
@@ -45178,10 +45231,11 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
45178
45231
|
if (!mainCanvas || !refVideo || !previewVideo) {
|
|
45179
45232
|
return;
|
|
45180
45233
|
}
|
|
45234
|
+
const useBlur = mediasfuShared.isVirtualBackgroundBlur(selectedImage.value);
|
|
45181
45235
|
const virtualImage = new Image();
|
|
45182
45236
|
virtualImage.crossOrigin = "anonymous";
|
|
45183
|
-
virtualImage.src = selectedImage.value || "";
|
|
45184
|
-
if (doSegmentation && selectedImage.value) {
|
|
45237
|
+
virtualImage.src = useBlur ? "" : selectedImage.value || "";
|
|
45238
|
+
if (doSegmentation && selectedImage.value && !useBlur) {
|
|
45185
45239
|
await new Promise((resolve) => {
|
|
45186
45240
|
if (virtualImage.complete && virtualImage.naturalWidth > 0) {
|
|
45187
45241
|
resolve();
|
|
@@ -45209,22 +45263,19 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
45209
45263
|
};
|
|
45210
45264
|
const onResults = (results) => {
|
|
45211
45265
|
try {
|
|
45212
|
-
if (pauseSegmentation.value || !ctx || mediaCanvas.width <= 0 || mediaCanvas.height <= 0 || virtualImage.width <= 0 || virtualImage.height <= 0) {
|
|
45266
|
+
if (pauseSegmentation.value || !ctx || mediaCanvas.width <= 0 || mediaCanvas.height <= 0 || !useBlur && (virtualImage.width <= 0 || virtualImage.height <= 0)) {
|
|
45213
45267
|
return;
|
|
45214
45268
|
}
|
|
45215
|
-
|
|
45216
|
-
|
|
45217
|
-
|
|
45218
|
-
|
|
45219
|
-
|
|
45220
|
-
|
|
45221
|
-
|
|
45222
|
-
|
|
45223
|
-
|
|
45224
|
-
|
|
45225
|
-
}
|
|
45226
|
-
ctx.fillRect(0, 0, mediaCanvas.width, mediaCanvas.height);
|
|
45227
|
-
ctx.restore();
|
|
45269
|
+
mediasfuShared.compositeVirtualBackgroundFrame({
|
|
45270
|
+
ctx,
|
|
45271
|
+
segmentationMask: results.segmentationMask,
|
|
45272
|
+
sourceImage: results.image,
|
|
45273
|
+
backgroundImage: useBlur ? null : virtualImage,
|
|
45274
|
+
width: mediaCanvas.width,
|
|
45275
|
+
height: mediaCanvas.height,
|
|
45276
|
+
repeatPattern: repeatMode,
|
|
45277
|
+
blurFallbackPixels: useBlur ? mediasfuShared.DEFAULT_BACKGROUND_BLUR_PIXELS : 0
|
|
45278
|
+
});
|
|
45228
45279
|
markFirstFrameRendered();
|
|
45229
45280
|
} catch (error) {
|
|
45230
45281
|
console.log("Error applying background:", error);
|
|
@@ -45373,7 +45424,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
45373
45424
|
}
|
|
45374
45425
|
}
|
|
45375
45426
|
try {
|
|
45376
|
-
if (virtualImage.width < mediaCanvas.width || virtualImage.height < mediaCanvas.height) {
|
|
45427
|
+
if (!useBlur && (virtualImage.width < mediaCanvas.width || virtualImage.height < mediaCanvas.height)) {
|
|
45377
45428
|
repeatMode = "repeat";
|
|
45378
45429
|
}
|
|
45379
45430
|
} catch {
|
|
@@ -45641,8 +45692,10 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
45641
45692
|
console.log("Error preloading model:");
|
|
45642
45693
|
}
|
|
45643
45694
|
}
|
|
45644
|
-
if (selectedImage.value) {
|
|
45695
|
+
if (selectedImage.value && !mediasfuShared.isVirtualBackgroundBlur(selectedImage.value)) {
|
|
45645
45696
|
await loadImageToCanvas(selectedImage.value, selectedImage.value);
|
|
45697
|
+
} else if (mediasfuShared.isVirtualBackgroundBlur(selectedImage.value)) {
|
|
45698
|
+
handleBlurBackground();
|
|
45646
45699
|
} else {
|
|
45647
45700
|
clearCanvas();
|
|
45648
45701
|
}
|
|
@@ -46211,6 +46264,36 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
46211
46264
|
]
|
|
46212
46265
|
);
|
|
46213
46266
|
});
|
|
46267
|
+
nodes.push(
|
|
46268
|
+
vue.h(
|
|
46269
|
+
"button",
|
|
46270
|
+
{
|
|
46271
|
+
type: "button",
|
|
46272
|
+
"aria-label": "Blur background",
|
|
46273
|
+
style: thumbnailButtonStyle(mediasfuShared.isVirtualBackgroundBlur(selectedImage.value), true),
|
|
46274
|
+
onClick: handleBlurBackground
|
|
46275
|
+
},
|
|
46276
|
+
vue.h(
|
|
46277
|
+
"span",
|
|
46278
|
+
{
|
|
46279
|
+
style: {
|
|
46280
|
+
display: "flex",
|
|
46281
|
+
alignItems: "center",
|
|
46282
|
+
justifyContent: "center",
|
|
46283
|
+
width: "100%",
|
|
46284
|
+
height: "100%",
|
|
46285
|
+
fontFamily: "var(--ms-modern-font-family)",
|
|
46286
|
+
fontSize: "0.85rem",
|
|
46287
|
+
fontWeight: 600,
|
|
46288
|
+
color: "var(--ms-modern-text-primary)",
|
|
46289
|
+
backdropFilter: "blur(10px)",
|
|
46290
|
+
background: "linear-gradient(135deg, rgba(96,165,250,.35), rgba(15,23,42,.8))"
|
|
46291
|
+
}
|
|
46292
|
+
},
|
|
46293
|
+
"Blur"
|
|
46294
|
+
)
|
|
46295
|
+
)
|
|
46296
|
+
);
|
|
46214
46297
|
nodes.push(
|
|
46215
46298
|
vue.h(
|
|
46216
46299
|
"button",
|
|
@@ -46397,7 +46480,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
46397
46480
|
};
|
|
46398
46481
|
}
|
|
46399
46482
|
});
|
|
46400
|
-
const ModernBackgroundModal = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-
|
|
46483
|
+
const ModernBackgroundModal = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-e7acacc7"]]);
|
|
46401
46484
|
const panelGradientBackground$1 = "linear-gradient(180deg, var(--ms-modern-panel-surface-elevated) 0%, var(--ms-modern-panel-surface) 100%)";
|
|
46402
46485
|
const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
46403
46486
|
__name: "ModernConfirmHereModal",
|