mediasfu-vue 1.4.1 → 1.5.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 +13 -0
- package/dist/index.cjs +93 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +63 -29
- package/dist/index.js.map +1 -1
- package/dist/mediasfu-vue.css +93 -93
- package/dist/types/index.d.ts +2 -0
- package/package.json +3 -2
- package/src/components/backgroundComponents/BackgroundModal.vue +9 -12
- package/src/components/mediasfuComponents/MediasfuGeneric.vue +7 -0
- package/src/index.ts +21 -0
- package/src/modern/modal_components/ModernBackgroundModal.vue +149 -150
- package/src/utils/mediasfuRooms.ts +41 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.5.0 — 2026-11-12
|
|
4
|
+
|
|
5
|
+
- Requires `mediasfu-shared` 1.5.0 or later.
|
|
6
|
+
- **Joined from another tab or device.** When the same person joins the room again elsewhere, this window now shows "You joined from another tab or device." with a **Use this one** button instead of a generic disconnect, and never rejoins on its own. The disconnect that follows shows no extra alert and no redirect. **Use this one** reloads the page; to show your own UI, listen for the cancelable `mediasfu:session-replaced` window event and call `preventDefault()` (its `detail` has `message` and `useThisOne()`).
|
|
7
|
+
- **Rejoin after a reload.** `createRoomOnMediaSFU` and `joinRoomOnMediaSFU` remember the room credential for this tab (24 hours, per room and name), so a reload rejoins as the same participant instead of failing with "Name is already taken".
|
|
8
|
+
- New exports from `mediasfu-shared`: `sessionReplaced`, `wasSessionReplaced`, `clearSessionReplaced`, `SESSION_REPLACED_MESSAGE`, `SESSION_REPLACED_EVENT`, `rememberRejoinCredential`, `readRejoinCredential`, `readRejoinCredentialAsync`, `forgetRejoinCredential`, `setRejoinCredentialStorage`, `createMemoryRejoinCredentialStorage`.
|
|
9
|
+
|
|
10
|
+
## 1.4.2 — 2026-10-30
|
|
11
|
+
|
|
12
|
+
- Requires `mediasfu-shared` 1.4.2 or later.
|
|
13
|
+
- **Background blur and virtual backgrounds on phones.** On phones held upright (Android Chrome, iOS Safari) the processed camera was sized from the track settings, which report landscape, so viewers saw the person stretched sideways. The processed video now follows the frames the camera actually delivers, including when the phone is turned. The segmentation model follows the frame shape.
|
|
14
|
+
- **Softer edges around the person.** The mask is smoothed and lightly feathered, and the blurred background is drawn in place rather than as an enlarged copy, which removes the hard outline around head and hands. Browsers without canvas `filter` support (some iOS Safari versions) now get a real blur instead of an unblurred background.
|
|
15
|
+
|
|
3
16
|
## 1.4.1 — 2026-10-27
|
|
4
17
|
|
|
5
18
|
- Requires `mediasfu-shared` 1.4.1 or later.
|
package/dist/index.cjs
CHANGED
|
@@ -101,6 +101,17 @@ async function waitForRoomAdmission(options) {
|
|
|
101
101
|
}
|
|
102
102
|
return finish({ status: "timeout", error: "The host did not let you in within 30 minutes." });
|
|
103
103
|
}
|
|
104
|
+
const rememberCredential = (data, userName, meetingID) => {
|
|
105
|
+
if (data?.secret && (data?.roomName || meetingID)) {
|
|
106
|
+
mediasfuShared.rememberRejoinCredential({
|
|
107
|
+
roomName: data.roomName || meetingID,
|
|
108
|
+
userName: data.userName || userName || "",
|
|
109
|
+
secret: data.secret,
|
|
110
|
+
link: data.link,
|
|
111
|
+
publicURL: data.publicURL
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
};
|
|
104
115
|
const isCredentialInvalid = (apiUserName, apiKey) => {
|
|
105
116
|
return !apiUserName || !apiKey || apiUserName === "yourAPIUSERNAME" || apiKey === "yourAPIKEY" || apiKey.length !== 64 || apiUserName.length < 6;
|
|
106
117
|
};
|
|
@@ -183,6 +194,7 @@ const createRoomOnMediaSFU = async ({
|
|
|
183
194
|
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
184
195
|
}
|
|
185
196
|
const data = await response.json();
|
|
197
|
+
rememberCredential(data, payload.userName);
|
|
186
198
|
return { data, success: true };
|
|
187
199
|
} catch (error) {
|
|
188
200
|
const message = error.message ?? "unknown error";
|
|
@@ -219,15 +231,34 @@ const joinRoomOnMediaSFU = async ({
|
|
|
219
231
|
return { data: { error: "Invalid credentials" }, success: false };
|
|
220
232
|
}
|
|
221
233
|
const finalLink = resolveRoomApiLink(localLink, "joinRoom");
|
|
234
|
+
const join = payload;
|
|
235
|
+
const stored = join?.action === "join" ? await mediasfuShared.readRejoinCredentialAsync(join.meetingID, join.userName) : null;
|
|
236
|
+
const body = stored && !join.rejoinSecret ? { ...join, rejoinSecret: stored.secret } : payload;
|
|
222
237
|
const response = await fetch(finalLink, {
|
|
223
238
|
method: "POST",
|
|
224
239
|
headers: {
|
|
225
240
|
"Content-Type": "application/json",
|
|
226
241
|
Authorization: `Bearer ${apiUserName}:${apiKey}`
|
|
227
242
|
},
|
|
228
|
-
body: JSON.stringify(
|
|
243
|
+
body: JSON.stringify(body)
|
|
229
244
|
});
|
|
230
245
|
if (!response.ok) {
|
|
246
|
+
if (stored) {
|
|
247
|
+
const refusal = await response.text().catch(() => "");
|
|
248
|
+
if (/already taken/i.test(refusal)) {
|
|
249
|
+
return {
|
|
250
|
+
data: {
|
|
251
|
+
message: "Room joined successfully",
|
|
252
|
+
roomName: stored.roomName,
|
|
253
|
+
publicURL: stored.publicURL || stored.link || "",
|
|
254
|
+
link: stored.link || "",
|
|
255
|
+
secret: stored.secret,
|
|
256
|
+
success: true
|
|
257
|
+
},
|
|
258
|
+
success: true
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
}
|
|
231
262
|
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
232
263
|
}
|
|
233
264
|
let data = await response.json();
|
|
@@ -245,6 +276,7 @@ const joinRoomOnMediaSFU = async ({
|
|
|
245
276
|
}
|
|
246
277
|
data = { ...data, ...admission.data, waiting: false, message: "Room joined successfully", success: true };
|
|
247
278
|
}
|
|
279
|
+
rememberCredential(data, payload.userName, payload.meetingID);
|
|
248
280
|
return { data, success: true };
|
|
249
281
|
} catch (error) {
|
|
250
282
|
const reason = error.message ?? "unknown error";
|
|
@@ -19996,8 +20028,7 @@ const _sfc_main$Z = /* @__PURE__ */ vue.defineComponent({
|
|
|
19996
20028
|
}
|
|
19997
20029
|
if (!mainCanvas || !refVideo || !previewVideo) return;
|
|
19998
20030
|
const mediaCanvas = mainCanvas;
|
|
19999
|
-
mediaCanvas
|
|
20000
|
-
mediaCanvas.height = refVideo.videoHeight;
|
|
20031
|
+
mediasfuShared.syncVirtualBackgroundCanvasSize(mediaCanvas, refVideo);
|
|
20001
20032
|
let ctx = mediaCanvas.getContext("2d");
|
|
20002
20033
|
let repeatMode = "no-repeat";
|
|
20003
20034
|
let firstFrameResolved = !doSegmentation;
|
|
@@ -20013,6 +20044,8 @@ const _sfc_main$Z = /* @__PURE__ */ vue.defineComponent({
|
|
|
20013
20044
|
};
|
|
20014
20045
|
const onResults = (results) => {
|
|
20015
20046
|
try {
|
|
20047
|
+
mediasfuShared.syncVirtualBackgroundCanvasSize(mediaCanvas, results.image, refVideo);
|
|
20048
|
+
mediasfuShared.updateSegmentationModelForFrame(selfieSegmentation.value, mediaCanvas.width, mediaCanvas.height);
|
|
20016
20049
|
if (!pauseSegmentation.value && mediaCanvas && mediaCanvas.width > 0 && mediaCanvas.height > 0 && (useBlur || virtualImage && virtualImage.width > 0 && virtualImage.height > 0)) {
|
|
20017
20050
|
if (ctx) {
|
|
20018
20051
|
mediasfuShared.compositeVirtualBackgroundFrame({
|
|
@@ -20118,11 +20151,7 @@ const _sfc_main$Z = /* @__PURE__ */ vue.defineComponent({
|
|
|
20118
20151
|
refVideo.play().catch(() => {
|
|
20119
20152
|
});
|
|
20120
20153
|
}
|
|
20121
|
-
|
|
20122
|
-
refVideo.width = currentSegmentVideo?.getVideoTracks()[0]?.getSettings().width || 0;
|
|
20123
|
-
refVideo.height = currentSegmentVideo?.getVideoTracks()[0]?.getSettings().height || 0;
|
|
20124
|
-
mediaCanvas.width = refVideo.width;
|
|
20125
|
-
mediaCanvas.height = refVideo.height;
|
|
20154
|
+
mediasfuShared.syncVirtualBackgroundCanvasSize(mediaCanvas, refVideo);
|
|
20126
20155
|
ctx = mediaCanvas.getContext("2d");
|
|
20127
20156
|
try {
|
|
20128
20157
|
if (doSegmentation) {
|
|
@@ -20171,11 +20200,7 @@ const _sfc_main$Z = /* @__PURE__ */ vue.defineComponent({
|
|
|
20171
20200
|
}
|
|
20172
20201
|
}
|
|
20173
20202
|
}
|
|
20174
|
-
|
|
20175
|
-
refVideo.width = currentSegmentVideo?.getVideoTracks()[0]?.getSettings().width || 0;
|
|
20176
|
-
refVideo.height = currentSegmentVideo?.getVideoTracks()[0]?.getSettings().height || 0;
|
|
20177
|
-
mediaCanvas.width = refVideo.width;
|
|
20178
|
-
mediaCanvas.height = refVideo.height;
|
|
20203
|
+
mediasfuShared.syncVirtualBackgroundCanvasSize(mediaCanvas, refVideo);
|
|
20179
20204
|
ctx = mediaCanvas.getContext("2d");
|
|
20180
20205
|
try {
|
|
20181
20206
|
if (doSegmentation) {
|
|
@@ -20857,7 +20882,7 @@ const _sfc_main$Z = /* @__PURE__ */ vue.defineComponent({
|
|
|
20857
20882
|
};
|
|
20858
20883
|
}
|
|
20859
20884
|
});
|
|
20860
|
-
const BackgroundModal = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__scopeId", "data-v-
|
|
20885
|
+
const BackgroundModal = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__scopeId", "data-v-8a978fbd"]]);
|
|
20861
20886
|
const _hoisted_1$f = { class: "card-header" };
|
|
20862
20887
|
const _hoisted_2$c = { class: "room-title" };
|
|
20863
20888
|
const _hoisted_3$b = { class: "room-actions" };
|
|
@@ -42505,6 +42530,9 @@ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
|
|
|
42505
42530
|
const socketAlt = props.connectMediaSFU && localSocket.value && localSocket.value.id ? localSocket.value : socketDefault;
|
|
42506
42531
|
if (socketDefault.id) {
|
|
42507
42532
|
if (!skipSockets) {
|
|
42533
|
+
socketDefault.on("session-replaced", async (data) => {
|
|
42534
|
+
await mediasfuShared.sessionReplaced({ data, showAlert });
|
|
42535
|
+
});
|
|
42508
42536
|
socketDefault.on("disconnect", async () => {
|
|
42509
42537
|
await mediasfuShared.disconnect({
|
|
42510
42538
|
showAlert,
|
|
@@ -43855,7 +43883,7 @@ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
|
|
|
43855
43883
|
};
|
|
43856
43884
|
}
|
|
43857
43885
|
});
|
|
43858
|
-
const MediasfuGeneric = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-
|
|
43886
|
+
const MediasfuGeneric = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-ed81067d"]]);
|
|
43859
43887
|
const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
|
|
43860
43888
|
__name: "MediasfuBroadcast",
|
|
43861
43889
|
props: {
|
|
@@ -47800,8 +47828,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
47800
47828
|
});
|
|
47801
47829
|
}
|
|
47802
47830
|
const mediaCanvas = mainCanvas;
|
|
47803
|
-
mediaCanvas
|
|
47804
|
-
mediaCanvas.height = refVideo.videoHeight;
|
|
47831
|
+
mediasfuShared.syncVirtualBackgroundCanvasSize(mediaCanvas, refVideo);
|
|
47805
47832
|
const ctx = mediaCanvas.getContext("2d");
|
|
47806
47833
|
let repeatMode = "no-repeat";
|
|
47807
47834
|
let firstFrameResolved = !doSegmentation;
|
|
@@ -47817,6 +47844,8 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
47817
47844
|
};
|
|
47818
47845
|
const onResults = (results) => {
|
|
47819
47846
|
try {
|
|
47847
|
+
mediasfuShared.syncVirtualBackgroundCanvasSize(mediaCanvas, results.image, refVideo);
|
|
47848
|
+
mediasfuShared.updateSegmentationModelForFrame(selfieSegmentation.value, mediaCanvas.width, mediaCanvas.height);
|
|
47820
47849
|
if (pauseSegmentation.value || !ctx || mediaCanvas.width <= 0 || mediaCanvas.height <= 0 || !useBlur && (virtualImage.width <= 0 || virtualImage.height <= 0)) {
|
|
47821
47850
|
return;
|
|
47822
47851
|
}
|
|
@@ -47920,10 +47949,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
47920
47949
|
if (refVideo.paused) {
|
|
47921
47950
|
void refVideo.play().catch(() => void 0);
|
|
47922
47951
|
}
|
|
47923
|
-
|
|
47924
|
-
refVideo.height = segmentVideo.value?.getVideoTracks()[0]?.getSettings().height || 0;
|
|
47925
|
-
mediaCanvas.width = refVideo.width;
|
|
47926
|
-
mediaCanvas.height = refVideo.height;
|
|
47952
|
+
mediasfuShared.syncVirtualBackgroundCanvasSize(mediaCanvas, refVideo);
|
|
47927
47953
|
try {
|
|
47928
47954
|
if (doSegmentation) {
|
|
47929
47955
|
await segmentImage(refVideo);
|
|
@@ -47962,10 +47988,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
47962
47988
|
void refVideo.play().catch(() => void 0);
|
|
47963
47989
|
}
|
|
47964
47990
|
}
|
|
47965
|
-
|
|
47966
|
-
refVideo.height = segmentVideo.value?.getVideoTracks()[0]?.getSettings().height || 0;
|
|
47967
|
-
mediaCanvas.width = refVideo.width;
|
|
47968
|
-
mediaCanvas.height = refVideo.height;
|
|
47991
|
+
mediasfuShared.syncVirtualBackgroundCanvasSize(mediaCanvas, refVideo);
|
|
47969
47992
|
try {
|
|
47970
47993
|
if (doSegmentation) {
|
|
47971
47994
|
await segmentImage(refVideo);
|
|
@@ -49032,7 +49055,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
49032
49055
|
};
|
|
49033
49056
|
}
|
|
49034
49057
|
});
|
|
49035
|
-
const ModernBackgroundModal = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-
|
|
49058
|
+
const ModernBackgroundModal = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-a2fde8df"]]);
|
|
49036
49059
|
const panelGradientBackground$1 = "linear-gradient(180deg, var(--ms-modern-panel-surface-elevated) 0%, var(--ms-modern-panel-surface) 100%)";
|
|
49037
49060
|
const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
49038
49061
|
__name: "ModernConfirmHereModal",
|
|
@@ -50372,6 +50395,14 @@ Object.defineProperty(exports, "MediaSocketConnectError", {
|
|
|
50372
50395
|
enumerable: true,
|
|
50373
50396
|
get: () => mediasfuShared.MediaSocketConnectError
|
|
50374
50397
|
});
|
|
50398
|
+
Object.defineProperty(exports, "SESSION_REPLACED_EVENT", {
|
|
50399
|
+
enumerable: true,
|
|
50400
|
+
get: () => mediasfuShared.SESSION_REPLACED_EVENT
|
|
50401
|
+
});
|
|
50402
|
+
Object.defineProperty(exports, "SESSION_REPLACED_MESSAGE", {
|
|
50403
|
+
enumerable: true,
|
|
50404
|
+
get: () => mediasfuShared.SESSION_REPLACED_MESSAGE
|
|
50405
|
+
});
|
|
50375
50406
|
Object.defineProperty(exports, "SUPPORTED_LANGUAGE_CODES", {
|
|
50376
50407
|
enumerable: true,
|
|
50377
50408
|
get: () => mediasfuShared.SUPPORTED_LANGUAGE_CODES
|
|
@@ -50404,6 +50435,10 @@ Object.defineProperty(exports, "checkResumeState", {
|
|
|
50404
50435
|
enumerable: true,
|
|
50405
50436
|
get: () => mediasfuShared.checkResumeState
|
|
50406
50437
|
});
|
|
50438
|
+
Object.defineProperty(exports, "clearSessionReplaced", {
|
|
50439
|
+
enumerable: true,
|
|
50440
|
+
get: () => mediasfuShared.clearSessionReplaced
|
|
50441
|
+
});
|
|
50407
50442
|
Object.defineProperty(exports, "clickAudio", {
|
|
50408
50443
|
enumerable: true,
|
|
50409
50444
|
get: () => mediasfuShared.clickAudio
|
|
@@ -50432,6 +50467,10 @@ Object.defineProperty(exports, "createDeviceClient", {
|
|
|
50432
50467
|
enumerable: true,
|
|
50433
50468
|
get: () => mediasfuShared.createDeviceClient
|
|
50434
50469
|
});
|
|
50470
|
+
Object.defineProperty(exports, "createMemoryRejoinCredentialStorage", {
|
|
50471
|
+
enumerable: true,
|
|
50472
|
+
get: () => mediasfuShared.createMemoryRejoinCredentialStorage
|
|
50473
|
+
});
|
|
50435
50474
|
Object.defineProperty(exports, "describeMediaSocketError", {
|
|
50436
50475
|
enumerable: true,
|
|
50437
50476
|
get: () => mediasfuShared.describeMediaSocketError
|
|
@@ -50452,6 +50491,10 @@ Object.defineProperty(exports, "focusPanelists", {
|
|
|
50452
50491
|
enumerable: true,
|
|
50453
50492
|
get: () => mediasfuShared.focusPanelists
|
|
50454
50493
|
});
|
|
50494
|
+
Object.defineProperty(exports, "forgetRejoinCredential", {
|
|
50495
|
+
enumerable: true,
|
|
50496
|
+
get: () => mediasfuShared.forgetRejoinCredential
|
|
50497
|
+
});
|
|
50455
50498
|
Object.defineProperty(exports, "getAvailableVoices", {
|
|
50456
50499
|
enumerable: true,
|
|
50457
50500
|
get: () => mediasfuShared.getAvailableVoices
|
|
@@ -50564,6 +50607,14 @@ Object.defineProperty(exports, "pruneExpiredSubtitles", {
|
|
|
50564
50607
|
enumerable: true,
|
|
50565
50608
|
get: () => mediasfuShared.pruneExpiredSubtitles
|
|
50566
50609
|
});
|
|
50610
|
+
Object.defineProperty(exports, "readRejoinCredential", {
|
|
50611
|
+
enumerable: true,
|
|
50612
|
+
get: () => mediasfuShared.readRejoinCredential
|
|
50613
|
+
});
|
|
50614
|
+
Object.defineProperty(exports, "readRejoinCredentialAsync", {
|
|
50615
|
+
enumerable: true,
|
|
50616
|
+
get: () => mediasfuShared.readRejoinCredentialAsync
|
|
50617
|
+
});
|
|
50567
50618
|
Object.defineProperty(exports, "recordPauseTimer", {
|
|
50568
50619
|
enumerable: true,
|
|
50569
50620
|
get: () => mediasfuShared.recordPauseTimer
|
|
@@ -50580,10 +50631,22 @@ Object.defineProperty(exports, "recordUpdateTimer", {
|
|
|
50580
50631
|
enumerable: true,
|
|
50581
50632
|
get: () => mediasfuShared.recordUpdateTimer
|
|
50582
50633
|
});
|
|
50634
|
+
Object.defineProperty(exports, "rememberRejoinCredential", {
|
|
50635
|
+
enumerable: true,
|
|
50636
|
+
get: () => mediasfuShared.rememberRejoinCredential
|
|
50637
|
+
});
|
|
50583
50638
|
Object.defineProperty(exports, "removePanelist", {
|
|
50584
50639
|
enumerable: true,
|
|
50585
50640
|
get: () => mediasfuShared.removePanelist
|
|
50586
50641
|
});
|
|
50642
|
+
Object.defineProperty(exports, "sessionReplaced", {
|
|
50643
|
+
enumerable: true,
|
|
50644
|
+
get: () => mediasfuShared.sessionReplaced
|
|
50645
|
+
});
|
|
50646
|
+
Object.defineProperty(exports, "setRejoinCredentialStorage", {
|
|
50647
|
+
enumerable: true,
|
|
50648
|
+
get: () => mediasfuShared.setRejoinCredentialStorage
|
|
50649
|
+
});
|
|
50587
50650
|
Object.defineProperty(exports, "setScreenAudioVolume", {
|
|
50588
50651
|
enumerable: true,
|
|
50589
50652
|
get: () => mediasfuShared.setScreenAudioVolume
|
|
@@ -50672,6 +50735,10 @@ Object.defineProperty(exports, "updateRecording", {
|
|
|
50672
50735
|
enumerable: true,
|
|
50673
50736
|
get: () => mediasfuShared.updateRecording
|
|
50674
50737
|
});
|
|
50738
|
+
Object.defineProperty(exports, "wasSessionReplaced", {
|
|
50739
|
+
enumerable: true,
|
|
50740
|
+
get: () => mediasfuShared.wasSessionReplaced
|
|
50741
|
+
});
|
|
50675
50742
|
exports.AUTO_DETECT_LANGUAGES = AUTO_DETECT_LANGUAGES;
|
|
50676
50743
|
exports.AdvancedPanelComponent = _sfc_main$1t;
|
|
50677
50744
|
exports.AlertComponent = ClassicAlertComponent;
|