@strevokit/meeting-sdk 0.6.0 → 0.8.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 CHANGED
@@ -6,6 +6,34 @@ All notable changes to `@strevokit/meeting-sdk` are documented here. The format
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.8.0]
10
+
11
+ Bundles `@strevokit/signaling-protocol` 1.6.0.
12
+
13
+ ### Changed
14
+
15
+ - A live camera or microphone whose capture ends may continue on another device of that kind. The kind stays on, and
16
+ the change is not announced as stopped or started. When no other device of that kind can be opened, the kind turns
17
+ off and is announced as before.
18
+
19
+ ## [0.7.0]
20
+
21
+ Bundles `@strevokit/signaling-protocol` 1.6.0.
22
+
23
+ ### Added
24
+
25
+ - Connection state `reconnecting` for automatic meeting-service recovery after an unexpected drop while joined.
26
+ - Optional `getJoinToken` and `reconnectWindowMs` on `MeetingEngineOptions` so hosts can mint a fresh join token
27
+ during recovery (default recovery window 120 seconds).
28
+ - Media-path recovery while the room connection stays up: restart after a sustained interruption, and one bounded
29
+ link recreate after a failure within the recovery window.
30
+
31
+ ### Documentation
32
+
33
+ - Backend API guide covering `POST /v1/meetings`, `POST /v1/meetings/{public_id}/participants`,
34
+ `POST /v1/meetings/{public_id}/join-token`, and related embed-origin / get / end routes, with an Express-style
35
+ integration example.
36
+
9
37
  ## [0.6.0]
10
38
 
11
39
  Bundles `@strevokit/signaling-protocol` 1.6.0.
package/README.md CHANGED
@@ -22,23 +22,52 @@ The package is ESM-only and runs in browsers. Use it through a bundler (Vite, we
22
22
 
23
23
  ## Quick start
24
24
 
25
- ### 1. Mint a join token on your backend
25
+ ### 1. Prepare the meeting on your backend
26
26
 
27
- Join tokens are short-lived and single-use. Your backend mints one per participant with its Strevokit API credential.
28
- **Never** send the API credential to the browser.
27
+ Your backend talks to the Strevokit HTTP API with its API credential, then returns only a short-lived join token to the
28
+ browser. **Never** send the API credential to the browser. Full request and response shapes:
29
+ [Backend API](./docs/backend-api.md).
29
30
 
30
31
  ```ts
31
- // Server side (for example, a route in your backend).
32
- const response = await fetch(`https://api.example.com/v1/meetings/${meetingPublicId}/join-token`, {
32
+ // Server side. Headers on every call:
33
+ // Authorization: Bearer ${process.env.STREVOKIT_API_CREDENTIAL}
34
+ // Content-Type: application/json
35
+ const api = "https://api.example.com"; // your Strevokit API base URL
36
+ const headers = {
37
+ Authorization: `Bearer ${process.env.STREVOKIT_API_CREDENTIAL}`,
38
+ "Content-Type": "application/json",
39
+ };
40
+
41
+ // Once per environment: allow-list the origin that hosts your page.
42
+ await fetch(`${api}/v1/embed-origins`, {
33
43
  method: "POST",
34
- headers: {
35
- Authorization: `Bearer ${process.env.STREVOKIT_API_CREDENTIAL}`,
36
- "Content-Type": "application/json",
37
- },
38
- body: JSON.stringify({ participant_public_id: participantPublicId }),
44
+ headers,
45
+ body: JSON.stringify({ origin: "https://app.example.com" }),
39
46
  });
40
- const { data } = await response.json(); // { token, expires_at, expires_in }
41
- // Return data.token to the signed-in user's browser.
47
+
48
+ // Create the meeting, then authorize each person who may join.
49
+ const { data: meeting } = await fetch(`${api}/v1/meetings`, {
50
+ method: "POST",
51
+ headers,
52
+ body: JSON.stringify({ type: "one_to_one", max_participants: 2 }),
53
+ }).then((r) => r.json());
54
+
55
+ const { data: participant } = await fetch(`${api}/v1/meetings/${meeting.public_id}/participants`, {
56
+ method: "POST",
57
+ headers,
58
+ body: JSON.stringify({
59
+ external_user_id: "user_42",
60
+ display_name: "Alex",
61
+ role: "host",
62
+ }),
63
+ }).then((r) => r.json());
64
+
65
+ // When the signed-in user opens the meeting page, mint a join token and return only data.token.
66
+ const { data } = await fetch(`${api}/v1/meetings/${meeting.public_id}/join-token`, {
67
+ method: "POST",
68
+ headers,
69
+ body: JSON.stringify({ participant_public_id: participant.public_id }),
70
+ }).then((r) => r.json()); // { token, expires_at, expires_in }
42
71
  ```
43
72
 
44
73
  ### 2. Join from the browser
@@ -104,7 +133,8 @@ await engine.leave(); // releases camera, microphone, and screen; then `closed`
104
133
  An engine joins once. To join again, mint a new token and create a new engine. Call `engine.dispose()` when your
105
134
  component unmounts; it releases everything immediately and emits nothing.
106
135
 
107
- More examples: [plain HTML](./docs/examples/vanilla.html) and [React](./docs/examples/react.tsx).
136
+ More examples: [plain HTML](./docs/examples/vanilla.html), [React](./docs/examples/react.tsx), and
137
+ [backend integration](./docs/examples/backend-integration.md).
108
138
 
109
139
  ## Browser support
110
140
 
@@ -132,6 +162,8 @@ values generically. See the [changelog](./CHANGELOG.md).
132
162
 
133
163
  ## Documentation
134
164
 
165
+ - [Backend API](./docs/backend-api.md): create meeting, authorize participants, mint join tokens, and related routes
166
+ (`POST` / `GET` / `DELETE` with request and response shapes).
135
167
  - [API reference](./docs/api-reference.md): every export, method, event, error code, and close reason.
136
168
  - [Examples](./docs/examples/).
137
169
 
package/dist/index.d.ts CHANGED
@@ -1,8 +1,15 @@
1
1
  /** Why the engine closed. */
2
2
  export declare type CloseReason = "left" | "meeting_ended" | "session_replaced" | "connection_lost" | "join_failed" | "error";
3
3
 
4
- /** Engine lifecycle state. `closed` is terminal: create a new engine to join again. */
5
- export declare type ConnectionState = "idle" | "connecting" | "joining" | "joined" | "leaving" | "closed";
4
+ /**
5
+ * Engine lifecycle state. `closed` is terminal: create a new engine to join again.
6
+ *
7
+ * After a recoverable meeting-service interruption while `joined`, the engine moves to `reconnecting`
8
+ * and attempts automatic recovery. Success returns to `joined` (same self identity; `joined` is not
9
+ * re-emitted). Exhaustion or hard failure moves to `closed` with `connection_lost`. Deliberate leave,
10
+ * meeting ended, and session replaced cancel recovery and close accordingly.
11
+ */
12
+ export declare type ConnectionState = "idle" | "connecting" | "joining" | "joined" | "reconnecting" | "leaving" | "closed";
6
13
 
7
14
  /**
8
15
  * Creates a meeting engine for one participant. Pass the join token your backend issued and the realtime
@@ -104,6 +111,17 @@ export declare interface MeetingEngineOptions {
104
111
  joinTimeoutMs?: number;
105
112
  /** Optional diagnostics sink. The SDK never passes the join token or raw exception text to it. */
106
113
  logger?: MeetingLogger;
114
+ /**
115
+ * Optional. Called when a new meeting-service connection needs a join token and the in-memory token
116
+ * cannot be used. Must resolve to a server-issued join token for the same participant. Reject to fail
117
+ * recovery. The returned token is kept in memory only and never logged.
118
+ */
119
+ getJoinToken?: () => Promise<string>;
120
+ /**
121
+ * Optional. Continuous unsuccessful recovery budget in milliseconds. Default 120000.
122
+ * Values outside 1000–600000 are clamped to that range.
123
+ */
124
+ reconnectWindowMs?: number;
107
125
  }
108
126
 
109
127
  /**