@rapidmx/meet-plugin 0.3.1 → 0.4.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.
@@ -17,7 +17,7 @@ export type VideoMeetingStatus = "scheduled" | "active" | "ended" | "cancelled";
17
17
  /** Mirrors `BaseVideoMeetingRoute.ts`'s `IceServerConfig` - already the exact shape `RTCPeerConnection`'s
18
18
  * `iceServers` constructor option expects, passed straight through with no reshaping. */
19
19
  export interface IceServerConfig {
20
- urls: string;
20
+ urls: string | string[];
21
21
  username?: string;
22
22
  credential?: string;
23
23
  }
@@ -3,7 +3,7 @@ export type VideoMeetingStatus = "scheduled" | "active" | "ended" | "cancelled";
3
3
  /** Mirrors `BaseVideoMeetingRoute.ts`'s `IceServerConfig` - already the exact shape `RTCPeerConnection`'s
4
4
  * `iceServers` constructor option expects, passed straight through with no reshaping. */
5
5
  export interface IceServerConfig {
6
- urls: string;
6
+ urls: string | string[];
7
7
  username?: string;
8
8
  credential?: string;
9
9
  }
@@ -3,6 +3,11 @@
3
3
  // SPDX-License-Identifier: MPL-2.0
4
4
  ///////////////////////////////////////////////////////////////////////////////
5
5
  import * as crypto from "crypto";
6
+ /** The URLs in a `mail:videoconf:turn:url` value: one, or several separated by commas and/or whitespace (for a TURN server
7
+ * listening on both UDP and TLS, `turn:host:3478,turns:host:5349`). Blank entries are dropped. */
8
+ export function parseTurnUrls(value) {
9
+ return value.split(/[\s,]+/).filter(Boolean);
10
+ }
6
11
  /** Always-available, free public STUN servers - discovery only, no media relay. Two independent providers, so a
7
12
  * call still has STUN available if one of them is ever unreachable. */
8
13
  export const DEFAULT_STUN_SERVERS = [
@@ -48,10 +53,12 @@ export function turnRestCredential(sharedSecret, userPart, ttlSeconds = DEFAULT_
48
53
  */
49
54
  export function buildIceServers(settings, options) {
50
55
  const servers = [...DEFAULT_STUN_SERVERS];
51
- const url = settings.url.trim();
52
- if (!url) {
56
+ const turnUrls = parseTurnUrls(settings.url);
57
+ if (turnUrls.length === 0) {
53
58
  return servers;
54
59
  }
60
+ // A single URL stays a string, exactly as before, so a deployment that never sets more than one sees no change.
61
+ const url = turnUrls.length === 1 ? turnUrls[0] : turnUrls;
55
62
  if (settings.sharedSecret.trim()) {
56
63
  const userPart = settings.username.trim() || (options?.randomUserPart ?? (() => crypto.randomBytes(8).toString("hex")))();
57
64
  const { username, credential } = turnRestCredential(settings.sharedSecret.trim(), userPart, options?.ttlSeconds, options?.now);
@@ -1 +1 @@
1
- {"version":3,"file":"IceServerUtils.js","sourceRoot":"","sources":["../../../src/util/IceServerUtils.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,mEAAmE;AACnE,mCAAmC;AACnC,+EAA+E;AAC/E,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAkBjC;uEACuE;AACvE,MAAM,CAAC,MAAM,oBAAoB,GAA+B;IAC5D,EAAE,IAAI,EAAE,8BAA8B,EAAE;IACxC,EAAE,IAAI,EAAE,+BAA+B,EAAE;CAC5C,CAAC;AAEF;;iBAEiB;AACjB,MAAM,CAAC,MAAM,mCAAmC,GAAW,EAAE,GAAG,EAAE,CAAC;AAEnE;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,kBAAkB,CAC9B,YAAoB,EACpB,QAAgB,EAChB,aAAqB,mCAAmC,EACxD,MAAY,IAAI,IAAI,EAAE;IAEtB,MAAM,MAAM,GAAW,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;IAC9F,MAAM,QAAQ,GAAW,GAAG,MAAM,IAAI,QAAQ,EAAE,CAAC;IACjD,MAAM,UAAU,GAAW,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;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UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC5G,CAAC;SAAM,CAAC;QACJ,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC"}
@@ -1,17 +1,22 @@
1
1
  /** A single ICE server entry, matching the shape the browser `RTCPeerConnection` `iceServers` constructor option
2
2
  * expects (`RTCIceServer`), so the join response can be handed to it directly with no reshaping. */
3
3
  export interface IceServerConfig {
4
- urls: string;
4
+ /** One URL, or several that share one credential (a TURN server's UDP and TLS addresses, say). */
5
+ urls: string | string[];
5
6
  username?: string;
6
7
  credential?: string;
7
8
  }
8
- /** The `mail:videoconf:turn:*` settings, exactly as configured (empty strings for anything unset). */
9
+ /** The `mail:videoconf:turn:*` settings, exactly as configured (empty strings for anything unset). `url` may name several
10
+ * URLs, separated by commas and/or whitespace - see `parseTurnUrls()`. */
9
11
  export interface TurnSettings {
10
12
  url: string;
11
13
  username: string;
12
14
  credential: string;
13
15
  sharedSecret: string;
14
16
  }
17
+ /** The URLs in a `mail:videoconf:turn:url` value: one, or several separated by commas and/or whitespace (for a TURN server
18
+ * listening on both UDP and TLS, `turn:host:3478,turns:host:5349`). Blank entries are dropped. */
19
+ export declare function parseTurnUrls(value: string): string[];
15
20
  /** Always-available, free public STUN servers - discovery only, no media relay. Two independent providers, so a
16
21
  * call still has STUN available if one of them is ever unreachable. */
17
22
  export declare const DEFAULT_STUN_SERVERS: readonly IceServerConfig[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rapidmx/meet-plugin",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "RapidMX plugin that provides WebRTC video conferencing, joinable from a calendar invite or a shared link.",
5
5
  "repository": "https://github.com/RapidMX/meet-plugin.git",
6
6
  "author": "RapidREST <rapidrests@gmail.com>",
@@ -128,7 +128,7 @@
128
128
  "label": "TURN server URL",
129
129
  "type": "string",
130
130
  "default": "",
131
- "help": "A turn: or turns: URL (e.g. turns:turn.example.com:5349) relaying media for a participant behind a restrictive NAT or firewall, for whom a direct peer-to-peer connection fails. Public STUN servers are used for everyone else and need no configuration. Leave empty to serve calls with STUN only - most calls will still connect, but some participants may not."
131
+ "help": "A turn: or turns: URL (e.g. turns:turn.example.com:5349), or several separated by commas (turn:turn.example.com:3478,turns:turn.example.com:5349), relaying media for a participant behind a restrictive NAT or firewall, for whom a direct peer-to-peer connection fails. Public STUN servers are used for everyone else and need no configuration. Leave empty to serve calls with STUN only - most calls will still connect, but some participants may not."
132
132
  },
133
133
  {
134
134
  "key": "mail:videoconf:turn:username",