mediasfu-vue 1.3.0 → 1.3.2

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 CHANGED
@@ -1,12 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.3.2 — 2026-10-18
4
+
5
+ - **Readable names on camera-off tiles.** Grid tiles for members with no camera or microphone (mini cards) now show the member's `displayName`, like video and audio cards already do, falling back to the member name. A room creator who set a display name no longer appears to others as their user name.
6
+
7
+ ## 1.3.1 — 2026-10-14
8
+
9
+ - Requires `mediasfu-shared` 1.3.2 or later.
10
+ - **Unmute in audio-only rooms.** The microphone could not be turned on in rooms created with `mediaType: "audio"` (it showed a camera message). Audio-only rooms now only block cameras.
11
+ - **Readable names.** Video and audio cards, participant lists and the join notice show a member's `displayName` when the room has one, falling back to the member name.
12
+ - **Waiting rooms for API rooms** in the room helper (`utils/mediasfuRooms.ts`): a guest waits until the host lets them in.
13
+ - New room-create options: `region` (`asia`, `europe`, `us`, `general`), `regionStrict` (refuse instead of placing the room in another region) and `waitRoom`. Servers that do not support them ignore them.
14
+
3
15
  ## 1.3.0 — 2026-10-09
4
16
 
5
17
  - **Screen-share audio.** Sharing a tab or screen in a Chromium desktop browser now offers **Screen + audio** or **Screen only**. The audio is published as its own track, pauses and stops with the share, and never marks the sharer as speaking. Listeners hear it with a "*name* · Screen audio" card they can mute for themselves. Configure with the `screenAudioMode` (`ask`, `always`, `never`), `screenAudioEnabled` and `screenAudioPrompt` props, or `updateScreenAudioMode` / `updateScreenAudioEnabled` on the room parameters; new exports include `ScreenAudioPrompt`, `promptScreenAudioChoice`, `ScreenAudioPlayer`, `connectSendTransportScreenAudio`, `toggleScreenAudio` and `setScreenAudioVolume`. Media servers without screen-audio support keep video-only sharing.
6
18
  - **Consumer backup preference.** When a busy consuming node has a connected backup, new streams are taken from the backup when it announces them within 1.5 seconds; otherwise from the busy node as before.
7
19
  - **Clear connection errors.** Join pages explain why a room could not be joined (credentials refused, no meeting minutes, offline, server unreachable) instead of a generic message. `connectSocket` rejects with `MediaSocketConnectError` (`phase`, `elapsedMs`, `online`, `reason`, `stage`, `retryable`), and `describeMediaSocketError` returns a user-facing sentence. A refused credential is not retried in a loop, and network failures no longer count toward the join attempt limit.
20
+ - **No more silent microphones from a send-transport race.** When the microphone and camera start together (or a toggle overlaps a rejoin), only one send transport is created per connection; later requests wait for it and send their media on it. Previously the second request replaced the first on the media server and that participant's audio could be lost. Two produces of the same kind at the same moment now share one producer.
8
21
  - Audio-only players are removed when their producer closes, so a rejoin never leaves a second player behind.
9
22
  - Requires `mediasfu-shared` 1.3.0 or later.
23
+ - **A refused reconnect is final.** When a media server refuses a reconnect for good (the room ended, the credentials were replaced, no meeting minutes), the SDK closes that socket instead of letting Socket.IO retry it for as long as the page stays open. Temporary refusals still retry.
10
24
 
11
25
  ## 1.2.2 — 2026-09-30
12
26
 
package/dist/index.cjs CHANGED
@@ -6,6 +6,101 @@ const vueFontawesome = require("@fortawesome/vue-fontawesome");
6
6
  const freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
7
7
  const freeBrandsSvgIcons = require("@fortawesome/free-brands-svg-icons");
8
8
  const SelfieSegmentationModule = require("@mediapipe/selfie_segmentation");
9
+ const WAITING_ROOM_DECLINED_MESSAGE = "The host didn't let you in.";
10
+ const WAITING_ROOM_ENDED_MESSAGE = "This room has ended.";
11
+ const WAITING_ROOM_UNSUPPORTED_MESSAGE = "This server does not support waiting rooms for API guests yet.";
12
+ const defaultSleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
13
+ function announce(status, roomName) {
14
+ try {
15
+ if (typeof window !== "undefined" && typeof window.dispatchEvent === "function" && typeof CustomEvent === "function") {
16
+ window.dispatchEvent(new CustomEvent("mediasfu:waiting-room", { detail: { status, roomName } }));
17
+ }
18
+ } catch {
19
+ }
20
+ }
21
+ async function waitForRoomAdmission(options) {
22
+ const {
23
+ roomName,
24
+ userName,
25
+ secret,
26
+ apiUserName,
27
+ apiKey,
28
+ endpoint,
29
+ intervalMs = 3e3,
30
+ timeoutMs = 30 * 60 * 1e3,
31
+ signal,
32
+ onStatus
33
+ } = options;
34
+ const doFetch = options.fetchImpl || fetch;
35
+ const sleep = options.sleep || defaultSleep;
36
+ const now = options.now || Date.now;
37
+ const interval = Math.max(1e3, intervalMs);
38
+ const deadline = now() + timeoutMs;
39
+ let cancelled = false;
40
+ const onCancel = () => {
41
+ cancelled = true;
42
+ };
43
+ const hasWindow = typeof window !== "undefined" && typeof window.addEventListener === "function";
44
+ if (hasWindow) window.addEventListener("mediasfu:waiting-room-cancel", onCancel);
45
+ const report = (status) => {
46
+ announce(status, roomName);
47
+ try {
48
+ onStatus?.(status);
49
+ } catch {
50
+ }
51
+ };
52
+ const finish = (result) => {
53
+ if (hasWindow) window.removeEventListener("mediasfu:waiting-room-cancel", onCancel);
54
+ report(result.status);
55
+ return result;
56
+ };
57
+ report("waiting");
58
+ let failures = 0;
59
+ while (now() < deadline) {
60
+ if (cancelled || signal?.aborted) return finish({ status: "cancelled", error: "Stopped waiting for the host." });
61
+ await sleep(interval);
62
+ if (cancelled || signal?.aborted) return finish({ status: "cancelled", error: "Stopped waiting for the host." });
63
+ let httpStatus = 0;
64
+ let body = {};
65
+ try {
66
+ const response = await doFetch(endpoint, {
67
+ method: "POST",
68
+ headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiUserName}:${apiKey}` },
69
+ body: JSON.stringify({ action: "waitStatus", meetingID: roomName, userName, secret })
70
+ });
71
+ httpStatus = response.status;
72
+ body = await response.json().catch(() => ({})) || {};
73
+ } catch {
74
+ failures += 1;
75
+ if (failures >= 10) return finish({ status: "error", error: "Lost contact with the server while waiting for the host." });
76
+ continue;
77
+ }
78
+ const status = String(body.status || "");
79
+ if (status === "admitted" && typeof body.link === "string" && body.link) {
80
+ return finish({
81
+ status: "admitted",
82
+ data: {
83
+ roomName: String(body.roomName || roomName),
84
+ userName,
85
+ secret: String(body.secret || secret),
86
+ link: body.link,
87
+ publicURL: String(body.publicURL || "")
88
+ }
89
+ });
90
+ }
91
+ if (status === "declined" || httpStatus === 403) return finish({ status: "declined", error: WAITING_ROOM_DECLINED_MESSAGE });
92
+ if (status === "ended" || httpStatus === 410) return finish({ status: "ended", error: WAITING_ROOM_ENDED_MESSAGE });
93
+ if (httpStatus === 400) return finish({ status: "error", error: WAITING_ROOM_UNSUPPORTED_MESSAGE });
94
+ if (httpStatus === 401) return finish({ status: "error", error: String(body.error || "These room credentials are no longer valid.") });
95
+ if (status === "waiting" && httpStatus >= 200 && httpStatus < 300) {
96
+ failures = 0;
97
+ continue;
98
+ }
99
+ failures += 1;
100
+ if (failures >= 10) return finish({ status: "error", error: String(body.error || "The server could not tell whether the host let you in.") });
101
+ }
102
+ return finish({ status: "timeout", error: "The host did not let you in within 30 minutes." });
103
+ }
9
104
  const isCredentialInvalid = (apiUserName, apiKey) => {
10
105
  return !apiUserName || !apiKey || apiUserName === "yourAPIUSERNAME" || apiKey === "yourAPIKEY" || apiKey.length !== 64 || apiUserName.length < 6;
11
106
  };
@@ -135,7 +230,21 @@ const joinRoomOnMediaSFU = async ({
135
230
  if (!response.ok) {
136
231
  throw new Error(`HTTP error! Status: ${response.status}`);
137
232
  }
138
- const data = await response.json();
233
+ let data = await response.json();
234
+ if (data?.waiting === true && data?.secret) {
235
+ const admission = await waitForRoomAdmission({
236
+ roomName: data.roomName || payload.meetingID,
237
+ userName: data.userName || payload.userName,
238
+ secret: data.secret,
239
+ apiUserName,
240
+ apiKey,
241
+ endpoint: finalLink
242
+ });
243
+ if (admission.status !== "admitted" || !admission.data) {
244
+ return { data: { error: admission.error || WAITING_ROOM_DECLINED_MESSAGE }, success: false };
245
+ }
246
+ data = { ...data, ...admission.data, waiting: false, message: "Room joined successfully", success: true };
247
+ }
139
248
  return { data, success: true };
140
249
  } catch (error) {
141
250
  const reason = error.message ?? "unknown error";
@@ -1362,7 +1471,7 @@ const _sfc_main$1Q = /* @__PURE__ */ vue.defineComponent({
1362
1471
  vue.createElementVNode("div", { style: nameColumnStyle }, [
1363
1472
  vue.createElementVNode("span", {
1364
1473
  style: vue.normalizeStyle({ ...nameTextStyle, color: __props.textColor })
1365
- }, vue.toDisplayString(__props.participant?.name), 5)
1474
+ }, vue.toDisplayString(__props.participant?.displayName || __props.participant?.name), 5)
1366
1475
  ]),
1367
1476
  showWaveformState.value ? (vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({ key: 0 }, waveformContainerRestAttrs.value, {
1368
1477
  class: waveformContainerClassNames.value,
@@ -2257,7 +2366,7 @@ const _sfc_main$1O = /* @__PURE__ */ vue.defineComponent({
2257
2366
  vue.createElementVNode("p", vue.mergeProps(nameTextRestAttrs.value, {
2258
2367
  class: nameTextClassNames.value,
2259
2368
  style: nameTextMergedStyle.value
2260
- }), vue.toDisplayString(__props.name), 17)
2369
+ }), vue.toDisplayString(__props.participant?.displayName || __props.name), 17)
2261
2370
  ], 16),
2262
2371
  showWaveformState.value ? (vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({ key: 0 }, waveformContainerRestAttrs.value, {
2263
2372
  class: waveformContainerClassNames.value,
@@ -2415,7 +2524,7 @@ async function addVideosGrid({
2415
2524
  const miniCardComponent2 = customMiniCard ? {
2416
2525
  component: customMiniCard,
2417
2526
  props: {
2418
- initials: participant.name,
2527
+ initials: participant.displayName?.trim() || participant.name,
2419
2528
  fontSize: 20,
2420
2529
  customStyle: {
2421
2530
  backgroundColor: "transparent",
@@ -2426,7 +2535,7 @@ async function addVideosGrid({
2426
2535
  } : {
2427
2536
  component: MiniCardComponentOverride,
2428
2537
  props: {
2429
- initials: participant.name,
2538
+ initials: participant.displayName?.trim() || participant.name,
2430
2539
  fontSize: 20,
2431
2540
  customStyle: {
2432
2541
  backgroundColor: "transparent",
@@ -2628,7 +2737,7 @@ async function addVideosGrid({
2628
2737
  const miniCardComponent2 = customMiniCard ? {
2629
2738
  component: customMiniCard,
2630
2739
  props: {
2631
- initials: participant.name,
2740
+ initials: participant.displayName?.trim() || participant.name,
2632
2741
  fontSize: 20,
2633
2742
  customStyle: {
2634
2743
  backgroundColor: "transparent",
@@ -2639,7 +2748,7 @@ async function addVideosGrid({
2639
2748
  } : {
2640
2749
  component: MiniCardComponentOverride,
2641
2750
  props: {
2642
- initials: participant.name,
2751
+ initials: participant.displayName?.trim() || participant.name,
2643
2752
  fontSize: 20,
2644
2753
  customStyle: {
2645
2754
  backgroundColor: "transparent",
@@ -11141,7 +11250,7 @@ const _sfc_main$1k = /* @__PURE__ */ vue.defineComponent({
11141
11250
  return (_ctx, _cache) => {
11142
11251
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$p, [
11143
11252
  vue.createElementVNode("div", _hoisted_2$k, [
11144
- vue.createElementVNode("p", _hoisted_3$h, vue.toDisplayString(__props.participant.islevel === "2" ? `${__props.participant.name} (host)` : __props.participant.name), 1)
11253
+ vue.createElementVNode("p", _hoisted_3$h, vue.toDisplayString(__props.participant.islevel === "2" ? `${__props.participant.displayName || __props.participant.name} (host)` : __props.participant.displayName || __props.participant.name), 1)
11145
11254
  ]),
11146
11255
  !__props.isBroadcast ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
11147
11256
  vue.createElementVNode("div", _hoisted_4$g, [
@@ -11289,12 +11398,12 @@ const _sfc_main$1i = /* @__PURE__ */ vue.defineComponent({
11289
11398
  const props = __props;
11290
11399
  const displayName = vue.computed(() => {
11291
11400
  if (props.participant.islevel === "2") {
11292
- return props.participant.name === props.member ? `${props.participant.name} (you)` : `${props.participant.name} (host)`;
11401
+ return props.participant.name === props.member ? `${props.participant.displayName || props.participant.name} (you)` : `${props.participant.displayName || props.participant.name} (host)`;
11293
11402
  } else {
11294
11403
  if (props.participant.name === props.member) {
11295
- return `${props.participant.name} (you)`;
11404
+ return `${props.participant.displayName || props.participant.name} (you)`;
11296
11405
  }
11297
- return props.coHost === props.participant.name ? `${props.participant.name} (co-host)` : props.participant.name;
11406
+ return props.coHost === props.participant.name ? `${props.participant.displayName || props.participant.name} (co-host)` : props.participant.displayName || props.participant.name;
11298
11407
  }
11299
11408
  });
11300
11409
  const styles = {
@@ -12675,7 +12784,7 @@ const _sfc_main$1e = /* @__PURE__ */ vue.defineComponent({
12675
12784
  voicesLoading.value = true;
12676
12785
  voicesFetchedForKey.value = requestKey;
12677
12786
  try {
12678
- const response = await mediasfuShared.fetchVoicesViaSocket(socket, provider, outputLanguage);
12787
+ const response = await mediasfuShared.fetchVoicesViaSocket(socket, provider, outputLanguage, currentParams.value.roomName);
12679
12788
  if (voicesFetchedForKey.value !== requestKey) {
12680
12789
  return;
12681
12790
  }
@@ -13233,7 +13342,7 @@ const _sfc_main$1e = /* @__PURE__ */ vue.defineComponent({
13233
13342
  };
13234
13343
  }
13235
13344
  });
13236
- const TranslationSettingsModal = /* @__PURE__ */ _export_sfc(_sfc_main$1e, [["__scopeId", "data-v-18261553"]]);
13345
+ const TranslationSettingsModal = /* @__PURE__ */ _export_sfc(_sfc_main$1e, [["__scopeId", "data-v-fac1f89b"]]);
13237
13346
  const _hoisted_1$l = { style: {
13238
13347
  display: "flex",
13239
13348
  flexDirection: "row",
@@ -30088,7 +30197,7 @@ const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
30088
30197
  return allParticipants.value;
30089
30198
  }
30090
30199
  return allParticipants.value.filter(
30091
- (participant) => participant.name?.toLowerCase().includes(trimmedQuery)
30200
+ (participant) => participant.name?.toLowerCase().includes(trimmedQuery) || participant.displayName?.toLowerCase().includes(trimmedQuery)
30092
30201
  );
30093
30202
  });
30094
30203
  const isBroadcastEvent = vue.computed(() => currentParameters.value?.eventType === "broadcast");
@@ -30345,7 +30454,7 @@ const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
30345
30454
  fontSize: "0.84rem",
30346
30455
  flexShrink: 0
30347
30456
  }
30348
- }, getParticipantInitials(participant.name)),
30457
+ }, getParticipantInitials(participant.displayName || participant.name)),
30349
30458
  vue.h("div", {
30350
30459
  style: {
30351
30460
  minWidth: 0,
@@ -30368,7 +30477,7 @@ const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
30368
30477
  fontSize: "0.92rem",
30369
30478
  overflowWrap: "anywhere"
30370
30479
  }
30371
- }, isHostParticipant(participant) ? `${participant.name} (host)` : participant.name),
30480
+ }, isHostParticipant(participant) ? `${participant.displayName || participant.name} (host)` : participant.displayName || participant.name),
30372
30481
  isHostParticipant(participant) ? vue.h(vueFontawesome.FontAwesomeIcon, {
30373
30482
  icon: freeSolidSvgIcons.faCrown,
30374
30483
  style: { color: "#f59e0b", fontSize: "0.82rem" }
@@ -30575,7 +30684,7 @@ const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
30575
30684
  };
30576
30685
  }
30577
30686
  });
30578
- const ModernParticipantsModal = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-2666cee5"]]);
30687
+ const ModernParticipantsModal = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-9f18fc5d"]]);
30579
30688
  const panelGradientBackground$a = "linear-gradient(180deg, var(--ms-modern-panel-surface-elevated) 0%, var(--ms-modern-panel-surface) 100%)";
30580
30689
  const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
30581
30690
  __name: "ModernPermissionsModal",
@@ -33758,7 +33867,7 @@ const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
33758
33867
  voicesLoading.value = true;
33759
33868
  voicesFetchedForKey.value = requestKey;
33760
33869
  try {
33761
- const response = await mediasfuShared.fetchVoicesViaSocket(socket, provider, outputLanguage);
33870
+ const response = await mediasfuShared.fetchVoicesViaSocket(socket, provider, outputLanguage, currentParams.value.roomName);
33762
33871
  if (voicesFetchedForKey.value !== requestKey) {
33763
33872
  return;
33764
33873
  }
@@ -34413,7 +34522,7 @@ const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
34413
34522
  };
34414
34523
  }
34415
34524
  });
34416
- const ModernTranslationSettingsModal = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-a59d7898"]]);
34525
+ const ModernTranslationSettingsModal = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-c52f3fc4"]]);
34417
34526
  const panelGradientBackground$4 = "linear-gradient(180deg, var(--ms-modern-panel-surface-elevated) 0%, var(--ms-modern-panel-surface) 100%)";
34418
34527
  const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
34419
34528
  __name: "ModernWaitingModal",
@@ -40637,9 +40746,10 @@ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
40637
40746
  updateTotalReqWait: (value) => totalReqWait.value = value
40638
40747
  });
40639
40748
  });
40640
- socketDefault.on("personJoined", async ({ name }) => {
40749
+ socketDefault.on("personJoined", async ({ name, displayName }) => {
40641
40750
  await mediasfuShared.personJoined({
40642
- name,
40751
+ // The notice only displays this name, so the readable label (displayName) rides in it.
40752
+ name: displayName || participants.value.find((p) => p.name === name)?.displayName || name,
40643
40753
  showAlert
40644
40754
  });
40645
40755
  });
@@ -41921,7 +42031,7 @@ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
41921
42031
  };
41922
42032
  }
41923
42033
  });
41924
- const MediasfuGeneric = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-6bac9c65"]]);
42034
+ const MediasfuGeneric = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-545c61b9"]]);
41925
42035
  const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
41926
42036
  __name: "MediasfuBroadcast",
41927
42037
  props: {
@@ -43274,7 +43384,7 @@ const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
43274
43384
  })) : vue.createCommentVNode("", true),
43275
43385
  vue.createElementVNode("span", {
43276
43386
  style: vue.normalizeStyle(nameStyle.value)
43277
- }, vue.toDisplayString(__props.name), 5),
43387
+ }, vue.toDisplayString(__props.participant?.displayName || __props.name), 5),
43278
43388
  vue.createElementVNode("div", vue.mergeProps(waveformContainerRestAttrs.value, {
43279
43389
  class: waveformContainerClassNames.value,
43280
43390
  style: waveformContainerStyle.value
@@ -44119,7 +44229,7 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
44119
44229
  style: vue.normalizeStyle(avatarWrapperStyle.value)
44120
44230
  }, [
44121
44231
  vue.createVNode(_sfc_main$d, {
44122
- initials: __props.name,
44232
+ initials: __props.participant?.displayName || __props.name,
44123
44233
  "image-source": __props.imageSource,
44124
44234
  "rounded-image": resolvedMiniCardProps.value.roundedImage,
44125
44235
  "font-size": resolvedMiniCardProps.value.fontSize,
@@ -44142,7 +44252,7 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
44142
44252
  })) : vue.createCommentVNode("", true),
44143
44253
  vue.createElementVNode("span", {
44144
44254
  style: vue.normalizeStyle(nameStyle.value)
44145
- }, vue.toDisplayString(__props.name), 5),
44255
+ }, vue.toDisplayString(__props.participant?.displayName || __props.name), 5),
44146
44256
  vue.createElementVNode("div", vue.mergeProps(waveformContainerRestAttrs.value, {
44147
44257
  class: waveformContainerClassNames.value,
44148
44258
  style: waveformContainerStyle.value