mediasfu-vue 1.6.0 → 1.7.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 +10 -0
- package/README.md +85 -0
- package/dist/index.cjs +60 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +41 -16
- package/dist/index.js.map +1 -1
- package/dist/mediasfu-vue.css +83 -83
- package/dist/types/SharedTypes/index.d.ts +23 -0
- package/dist/types/index.d.ts +4 -0
- package/package.json +2 -2
- package/src/SharedTypes/index.ts +23 -0
- package/src/components/mediasfuComponents/MediasfuGeneric.vue +2 -1
- package/src/index.ts +17 -0
- package/src/utils/mediasfuRooms.ts +48 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.7.0 — 2026-12-04
|
|
4
|
+
|
|
5
|
+
- Requires `mediasfu-shared` 1.7.0.
|
|
6
|
+
- **Sign-language assistant on new rooms.** `createRoomOnMediaSFU` (and `noUIPreJoinOptions`) accept `signAssist`: `true` (read the host's signing) or `{ signers, avatar, voice, required }`. The create answer's `signAssist` says whether the assistant is joining, with its per-minute rate, or why it could not come. It runs on MediaSFU Cloud rooms created with the account's API key and is paid from the account's sign credit. New types: `SignAssistRequest`, `SignAssistOptions`, `SignAssistCreateResult`, `SignAssistStatus`, `SignAssistRefusalCode`.
|
|
7
|
+
- **Read or stop the assistant.** `getSignAssistOnMediaSFU({ roomName, apiUserName, apiKey })` returns its state, minutes and charge so far, and a caption stream (`{ url, token, expiresAt }`) for your own player. `stopSignAssistOnMediaSFU` stops it early, and billing stops with it.
|
|
8
|
+
- **Refused creates keep the server's reason.** A refused create returns the server's own message in `error` (`Unable to create room, <server message>`; before, only `HTTP error! Status: 402`) and now also the server's `code` (for example `SIGN_CREDITS_REQUIRED` or `region-unavailable`) and the HTTP `status`.
|
|
9
|
+
- **Send new server fields and read the whole reply.** Room create and join options take `extra`: fields sent as they are beside the typed ones, so a field MediaSFU adds later works without an SDK update. A typed field that is set wins, and `extra` can never set `action`, `userName`, `meetingID` or the credentials. Every create, join and sign assist result now also has `raw`, the server's whole JSON reply, on success and on refusal; `data` is unchanged. A refused join keeps the server's `code` and the HTTP `status`, as a refused create does.
|
|
10
|
+
- **A warning before an empty call ends.** When people are in a room but nobody has shared audio or video for 15 minutes, everyone now sees "This room ends in 5:00 unless someone shares audio or video." (chat rooms included) before the server ends it. Turning on a microphone, camera or screen share keeps the room open.
|
|
11
|
+
- **Calls on blocked networks now connect in Firefox too.** On a network that blocks the ports media normally uses, the TURN relay offered by the media server is now in place from the start on Firefox, which cannot add it to a connection that is already running. Before, the relay was never used in Firefox and the participant only saw the blocked-network message. Direct connections are still preferred, so the relay carries media only when they fail. Chrome, Edge and Safari are unchanged.
|
|
12
|
+
|
|
3
13
|
## 1.6.0 — 2026-11-29
|
|
4
14
|
|
|
5
15
|
- Requires `mediasfu-shared` 1.6.0.
|
package/README.md
CHANGED
|
@@ -218,6 +218,91 @@ navigation. For more than one room on a page, give each engine a unique
|
|
|
218
218
|
`external-ui-target` such as `#support-room`, and pass the matching `target-id`
|
|
219
219
|
(`support-room`) to its head.
|
|
220
220
|
|
|
221
|
+
## Sign-language assistant (MediaSFU Cloud)
|
|
222
|
+
|
|
223
|
+
Ask for MediaSFU's sign-language assistant when you create a room. It turns the listed signers' signing into captions
|
|
224
|
+
(and into speech with `voice: true`), and its avatar can sign what is spoken. It is paid per started minute from the
|
|
225
|
+
account's sign credit, so create these rooms from your server with the account API key.
|
|
226
|
+
|
|
227
|
+
```ts
|
|
228
|
+
import {
|
|
229
|
+
createRoomOnMediaSFU,
|
|
230
|
+
getSignAssistOnMediaSFU,
|
|
231
|
+
stopSignAssistOnMediaSFU,
|
|
232
|
+
} from 'mediasfu-vue';
|
|
233
|
+
|
|
234
|
+
const created = await createRoomOnMediaSFU({
|
|
235
|
+
payload: {
|
|
236
|
+
action: 'create',
|
|
237
|
+
userName: 'host01',
|
|
238
|
+
duration: 60,
|
|
239
|
+
capacity: 10,
|
|
240
|
+
signAssist: { signers: ['host01'], avatar: true, required: false }, // or simply: signAssist: true
|
|
241
|
+
},
|
|
242
|
+
apiUserName,
|
|
243
|
+
apiKey,
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
const data = created.data;
|
|
247
|
+
if (data && 'error' in data) {
|
|
248
|
+
console.error(data.code, data.error); // for example 'SIGN_CREDITS_REQUIRED' (HTTP 402)
|
|
249
|
+
} else if (data) {
|
|
250
|
+
console.log(data.signAssist?.state); // 'joining' or 'joined'; 'refused' with a reason when required is false
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// Later: state, minutes and charge so far, and a caption stream for your own player; or stop it early.
|
|
254
|
+
const status = await getSignAssistOnMediaSFU({ roomName: 'your-room-name', apiUserName, apiKey });
|
|
255
|
+
await stopSignAssistOnMediaSFU({ roomName: 'your-room-name', apiUserName, apiKey });
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
- `signers`: up to 4 participant names (2-10 letters or digits) whose signing is read. Default: the creating `userName`.
|
|
259
|
+
An empty list with the avatar on is avatar-only.
|
|
260
|
+
- `required` (default `true`) refuses the whole create when the assistant cannot come (`SIGN_CREDITS_REQUIRED`,
|
|
261
|
+
`SIGN_ASSIST_NOT_ENABLED`, `SIGN_ASSIST_UNAVAILABLE`, ...). With `false` the room opens without it.
|
|
262
|
+
- A refused create keeps `error` as before and adds the server's `code` and the HTTP `status`.
|
|
263
|
+
|
|
264
|
+
### Send fields this SDK does not type yet, and read the whole reply
|
|
265
|
+
|
|
266
|
+
When MediaSFU adds a room field, you can use it the day it ships, with no SDK update: put it in `extra`, and read new
|
|
267
|
+
reply fields from `raw`. The server still checks every field, so `extra` is no way around a rule.
|
|
268
|
+
|
|
269
|
+
```ts
|
|
270
|
+
import { createRoomOnMediaSFU, joinRoomOnMediaSFU } from 'mediasfu-vue';
|
|
271
|
+
|
|
272
|
+
const created = await createRoomOnMediaSFU({
|
|
273
|
+
payload: {
|
|
274
|
+
action: 'create',
|
|
275
|
+
userName: 'host01',
|
|
276
|
+
duration: 60,
|
|
277
|
+
capacity: 10,
|
|
278
|
+
signAssist: { signers: ['host01'], avatar: true },
|
|
279
|
+
extra: { someNewField: true }, // sent as is beside the typed fields
|
|
280
|
+
},
|
|
281
|
+
apiUserName,
|
|
282
|
+
apiKey,
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
if (!created.success) {
|
|
286
|
+
const error = created.data as { error: string; code?: string; status?: number } | null;
|
|
287
|
+
console.error(error?.code, error?.status, created.raw); // the server's code, the HTTP status, its whole reply
|
|
288
|
+
} else {
|
|
289
|
+
console.log(created.raw?.someNewReplyField); // any reply field, typed or not
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
const joined = await joinRoomOnMediaSFU({
|
|
293
|
+
payload: { action: 'join', meetingID: 'your-room-name', userName: 'guest1', extra: { someNewField: 1 } },
|
|
294
|
+
apiUserName,
|
|
295
|
+
apiKey,
|
|
296
|
+
});
|
|
297
|
+
console.log(joined.raw); // also on a refusal, beside data.code and data.status
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
- `extra` on create and join options (and the body of `stopSignAssistOnMediaSFU`): each field is sent unless a typed
|
|
301
|
+
field already sets it. `action`, `userName`, `meetingID` and the credentials can never be set from `extra`.
|
|
302
|
+
- `raw` on every create, join and sign assist result: the server's JSON reply as received, on success and on refusal.
|
|
303
|
+
`data` is unchanged. `raw` is absent when the request never reached MediaSFU or the reply was not JSON.
|
|
304
|
+
- Prices and quality are not SDK options, in `extra` or anywhere else: MediaSFU sets them on the server.
|
|
305
|
+
|
|
221
306
|
## Feature-rich headless quick start
|
|
222
307
|
|
|
223
308
|
This example selects the best incoming stream, renders it, keeps all prepared
|
package/dist/index.cjs
CHANGED
|
@@ -134,6 +134,12 @@ const resolveRoomApiLink = (localLink, action) => {
|
|
|
134
134
|
}
|
|
135
135
|
return `${normaliseLocalLink(trimmedLink)}/${action}`;
|
|
136
136
|
};
|
|
137
|
+
const refusedResult = (reply, status, prefix) => {
|
|
138
|
+
const refusal = mediasfuShared.readMediaSFURefusal(reply, status);
|
|
139
|
+
const refused = { error: `${prefix}, ${refusal.message}`, status };
|
|
140
|
+
if (refusal.code) refused.code = refusal.code;
|
|
141
|
+
return reply.raw ? { data: refused, success: false, raw: reply.raw } : { data: refused, success: false };
|
|
142
|
+
};
|
|
137
143
|
const getStorage = () => {
|
|
138
144
|
if (typeof window === "undefined" || !("localStorage" in window)) {
|
|
139
145
|
return void 0;
|
|
@@ -188,14 +194,19 @@ const createRoomOnMediaSFU = async ({
|
|
|
188
194
|
"Content-Type": "application/json",
|
|
189
195
|
Authorization: `Bearer ${apiUserName}:${apiKey}`
|
|
190
196
|
},
|
|
191
|
-
|
|
197
|
+
// Typed fields as given, plus `extra` fields the typed ones do not set.
|
|
198
|
+
body: JSON.stringify(mediasfuShared.buildMediaSFURequestBody(payload))
|
|
192
199
|
});
|
|
200
|
+
const reply = await mediasfuShared.readMediaSFUReply(response);
|
|
193
201
|
if (!response.ok) {
|
|
194
|
-
|
|
202
|
+
return refusedResult(reply, response.status, "Unable to create room");
|
|
203
|
+
}
|
|
204
|
+
if (!reply.body || typeof reply.body !== "object") {
|
|
205
|
+
throw new Error("Room service returned an invalid response.");
|
|
195
206
|
}
|
|
196
|
-
const data =
|
|
207
|
+
const data = reply.body;
|
|
197
208
|
rememberCredential(data, payload.userName);
|
|
198
|
-
return { data, success: true };
|
|
209
|
+
return reply.raw ? { data, success: true, raw: reply.raw } : { data, success: true };
|
|
199
210
|
} catch (error) {
|
|
200
211
|
const message = error.message ?? "unknown error";
|
|
201
212
|
return {
|
|
@@ -233,7 +244,8 @@ const joinRoomOnMediaSFU = async ({
|
|
|
233
244
|
const finalLink = resolveRoomApiLink(localLink, "joinRoom");
|
|
234
245
|
const join = payload;
|
|
235
246
|
const stored = join?.action === "join" ? await mediasfuShared.readRejoinCredentialAsync(join.meetingID, join.userName) : null;
|
|
236
|
-
const
|
|
247
|
+
const sent = mediasfuShared.buildMediaSFURequestBody(payload);
|
|
248
|
+
const body = stored && !join.rejoinSecret ? { ...sent, rejoinSecret: stored.secret } : sent;
|
|
237
249
|
const response = await fetch(finalLink, {
|
|
238
250
|
method: "POST",
|
|
239
251
|
headers: {
|
|
@@ -242,10 +254,11 @@ const joinRoomOnMediaSFU = async ({
|
|
|
242
254
|
},
|
|
243
255
|
body: JSON.stringify(body)
|
|
244
256
|
});
|
|
257
|
+
const reply = await mediasfuShared.readMediaSFUReply(response);
|
|
258
|
+
const raw = reply.raw ? { raw: reply.raw } : {};
|
|
245
259
|
if (!response.ok) {
|
|
246
260
|
if (stored) {
|
|
247
|
-
|
|
248
|
-
if (/already taken/i.test(refusal)) {
|
|
261
|
+
if (/already taken/i.test(reply.text)) {
|
|
249
262
|
return {
|
|
250
263
|
data: {
|
|
251
264
|
message: "Room joined successfully",
|
|
@@ -255,13 +268,17 @@ const joinRoomOnMediaSFU = async ({
|
|
|
255
268
|
secret: stored.secret,
|
|
256
269
|
success: true
|
|
257
270
|
},
|
|
258
|
-
success: true
|
|
271
|
+
success: true,
|
|
272
|
+
...raw
|
|
259
273
|
};
|
|
260
274
|
}
|
|
261
275
|
}
|
|
262
|
-
|
|
276
|
+
return refusedResult(reply, response.status, "Unable to join room");
|
|
277
|
+
}
|
|
278
|
+
if (!reply.body || typeof reply.body !== "object") {
|
|
279
|
+
throw new Error("Room service returned an invalid response.");
|
|
263
280
|
}
|
|
264
|
-
let data =
|
|
281
|
+
let data = reply.body;
|
|
265
282
|
if (data?.waiting === true && data?.secret) {
|
|
266
283
|
const admission = await waitForRoomAdmission({
|
|
267
284
|
roomName: data.roomName || payload.meetingID,
|
|
@@ -272,12 +289,12 @@ const joinRoomOnMediaSFU = async ({
|
|
|
272
289
|
endpoint: finalLink
|
|
273
290
|
});
|
|
274
291
|
if (admission.status !== "admitted" || !admission.data) {
|
|
275
|
-
return { data: { error: admission.error || WAITING_ROOM_DECLINED_MESSAGE }, success: false };
|
|
292
|
+
return { data: { error: admission.error || WAITING_ROOM_DECLINED_MESSAGE }, success: false, ...raw };
|
|
276
293
|
}
|
|
277
294
|
data = { ...data, ...admission.data, waiting: false, message: "Room joined successfully", success: true };
|
|
278
295
|
}
|
|
279
296
|
rememberCredential(data, payload.userName, payload.meetingID);
|
|
280
|
-
return { data, success: true };
|
|
297
|
+
return { data, success: true, ...raw };
|
|
281
298
|
} catch (error) {
|
|
282
299
|
const reason = error.message ?? "unknown error";
|
|
283
300
|
return {
|
|
@@ -42834,9 +42851,10 @@ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
|
|
|
42834
42851
|
updateShowMessagesBadge: (value) => showMessagesBadge.value = value
|
|
42835
42852
|
});
|
|
42836
42853
|
});
|
|
42837
|
-
socketDefault.on("meetingTimeRemaining", async ({ timeRemaining }) => {
|
|
42854
|
+
socketDefault.on("meetingTimeRemaining", async ({ timeRemaining, reason }) => {
|
|
42838
42855
|
await mediasfuShared.meetingTimeRemaining({
|
|
42839
42856
|
timeRemaining,
|
|
42857
|
+
reason,
|
|
42840
42858
|
showAlert,
|
|
42841
42859
|
eventType: eventType.value
|
|
42842
42860
|
});
|
|
@@ -43975,7 +43993,7 @@ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
|
|
|
43975
43993
|
};
|
|
43976
43994
|
}
|
|
43977
43995
|
});
|
|
43978
|
-
const MediasfuGeneric = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-
|
|
43996
|
+
const MediasfuGeneric = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-950255c1"]]);
|
|
43979
43997
|
const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
|
|
43980
43998
|
__name: "MediasfuBroadcast",
|
|
43981
43999
|
props: {
|
|
@@ -50483,6 +50501,10 @@ function useMediasfuHeadless() {
|
|
|
50483
50501
|
produce
|
|
50484
50502
|
};
|
|
50485
50503
|
}
|
|
50504
|
+
Object.defineProperty(exports, "MEDIASFU_PROTECTED_REQUEST_KEYS", {
|
|
50505
|
+
enumerable: true,
|
|
50506
|
+
get: () => mediasfuShared.MEDIASFU_PROTECTED_REQUEST_KEYS
|
|
50507
|
+
});
|
|
50486
50508
|
Object.defineProperty(exports, "MediaSocketConnectError", {
|
|
50487
50509
|
enumerable: true,
|
|
50488
50510
|
get: () => mediasfuShared.MediaSocketConnectError
|
|
@@ -50515,6 +50537,10 @@ Object.defineProperty(exports, "breakoutRoomUpdated", {
|
|
|
50515
50537
|
enumerable: true,
|
|
50516
50538
|
get: () => mediasfuShared.breakoutRoomUpdated
|
|
50517
50539
|
});
|
|
50540
|
+
Object.defineProperty(exports, "buildMediaSFURequestBody", {
|
|
50541
|
+
enumerable: true,
|
|
50542
|
+
get: () => mediasfuShared.buildMediaSFURequestBody
|
|
50543
|
+
});
|
|
50518
50544
|
Object.defineProperty(exports, "canCaptureDisplayAudio", {
|
|
50519
50545
|
enumerable: true,
|
|
50520
50546
|
get: () => mediasfuShared.canCaptureDisplayAudio
|
|
@@ -50603,6 +50629,10 @@ Object.defineProperty(exports, "getLanguageNativeName", {
|
|
|
50603
50629
|
enumerable: true,
|
|
50604
50630
|
get: () => mediasfuShared.getLanguageNativeName
|
|
50605
50631
|
});
|
|
50632
|
+
Object.defineProperty(exports, "getSignAssistOnMediaSFU", {
|
|
50633
|
+
enumerable: true,
|
|
50634
|
+
get: () => mediasfuShared.getSignAssistOnMediaSFU
|
|
50635
|
+
});
|
|
50606
50636
|
Object.defineProperty(exports, "getSupportedLanguages", {
|
|
50607
50637
|
enumerable: true,
|
|
50608
50638
|
get: () => mediasfuShared.getSupportedLanguages
|
|
@@ -50699,6 +50729,14 @@ Object.defineProperty(exports, "pruneExpiredSubtitles", {
|
|
|
50699
50729
|
enumerable: true,
|
|
50700
50730
|
get: () => mediasfuShared.pruneExpiredSubtitles
|
|
50701
50731
|
});
|
|
50732
|
+
Object.defineProperty(exports, "readMediaSFURefusal", {
|
|
50733
|
+
enumerable: true,
|
|
50734
|
+
get: () => mediasfuShared.readMediaSFURefusal
|
|
50735
|
+
});
|
|
50736
|
+
Object.defineProperty(exports, "readMediaSFUReply", {
|
|
50737
|
+
enumerable: true,
|
|
50738
|
+
get: () => mediasfuShared.readMediaSFUReply
|
|
50739
|
+
});
|
|
50702
50740
|
Object.defineProperty(exports, "readRejoinCredential", {
|
|
50703
50741
|
enumerable: true,
|
|
50704
50742
|
get: () => mediasfuShared.readRejoinCredential
|
|
@@ -50731,6 +50769,10 @@ Object.defineProperty(exports, "removePanelist", {
|
|
|
50731
50769
|
enumerable: true,
|
|
50732
50770
|
get: () => mediasfuShared.removePanelist
|
|
50733
50771
|
});
|
|
50772
|
+
Object.defineProperty(exports, "resolveSignAssistApi", {
|
|
50773
|
+
enumerable: true,
|
|
50774
|
+
get: () => mediasfuShared.resolveSignAssistApi
|
|
50775
|
+
});
|
|
50734
50776
|
Object.defineProperty(exports, "sessionReplaced", {
|
|
50735
50777
|
enumerable: true,
|
|
50736
50778
|
get: () => mediasfuShared.sessionReplaced
|
|
@@ -50751,6 +50793,10 @@ Object.defineProperty(exports, "stopRecording", {
|
|
|
50751
50793
|
enumerable: true,
|
|
50752
50794
|
get: () => mediasfuShared.stopRecording
|
|
50753
50795
|
});
|
|
50796
|
+
Object.defineProperty(exports, "stopSignAssistOnMediaSFU", {
|
|
50797
|
+
enumerable: true,
|
|
50798
|
+
get: () => mediasfuShared.stopSignAssistOnMediaSFU
|
|
50799
|
+
});
|
|
50754
50800
|
Object.defineProperty(exports, "toggleScreenAudio", {
|
|
50755
50801
|
enumerable: true,
|
|
50756
50802
|
get: () => mediasfuShared.toggleScreenAudio
|