@droponair/sdk-js 0.15.0 → 0.17.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,31 @@ This project follows [Semantic Versioning](https://semver.org/).
6
6
 
7
7
  ---
8
8
 
9
+ ## [0.17.0], 2026-05-22
10
+
11
+ ### Added
12
+
13
+ - **SFU media transport (opt-in per room).** Two new `RoomPolicy` fields choose how a room's live call moves media: `mediaMode: 'MESH' | 'SFU'` (default `'MESH'`) and `mediaEncryption: 'E2EE' | 'SFU'` (default `'E2EE'`). Mesh stays peer-to-peer; SFU routes through the platform's media server, suited to larger calls. With `E2EE` the media server forwards traffic it cannot decrypt, so the platform stays a blind relay even in routed mode.
14
+ - **`getSfuToken(roomId)`** - fetches a short-lived access token to join a room's SFU media. Returns `{ url, token, room, mediaEncryption, expiresAt }`. Hand the URL + token to your SFU client (e.g. LiveKit) to connect; mesh-mode rooms don't need this call. New `SfuToken` type exported from the package root.
15
+
16
+ ### Notes
17
+
18
+ - The SFU is one transport option you compose per room - mesh remains the default and is fine for small calls. SFU mode is required only when the participant count outgrows mesh or when you need server-side recording (`mediaEncryption: 'SFU'`).
19
+
20
+ ---
21
+
22
+ ## [0.16.0], 2026-05-21
23
+
24
+ ### Added
25
+
26
+ - **Call recording signal.** `startRecording(callId)` / `stopRecording(callId)` / `markRecordingAvailable(callId, location)` for group and room calls. The SDK signals recording state; your app owns the media capture and uploads the file to your own storage (the same split as screen sharing - the platform never holds media). The platform broadcasts the signal to every participant, including late joiners, and fires `recording.started` / `recording.stopped` / `recording.available` webhooks. New `GROUP_CALL_RECORDING_*` event types.
27
+
28
+ ### Notes
29
+
30
+ - A recording is always signaled to every participant - that transparency is enforced server-side and is not optional. Control-plane signaling only; no proto change.
31
+
32
+ ---
33
+
9
34
  ## [0.15.0], 2026-05-21
10
35
 
11
36
  ### Added
package/README.md CHANGED
@@ -312,8 +312,9 @@ Available since SDK `0.14.0`. A **room** is an addressable container a live mult
312
312
  | `deleteRoom(roomId)` | `Promise<void>` | Delete a room (creator only) |
313
313
  | `joinRoom(roomId)` | `Promise<string>` | Join the room's live call, returns callId |
314
314
  | `leaveRoom(callId)` | `Promise<void>` | Leave the room's live call |
315
+ | `getSfuToken(roomId)` | `Promise<SfuToken>` | Token to join the room's SFU media (SFU-mode rooms only) |
315
316
 
316
- Room policy (`RoomPolicy`, all optional): `waitingRoom` (non-hosts wait for host admit), `requireHost` (non-hosts cannot open the call), `maxParticipants` (per-room cap), `autoCloseWhenEmpty` (room flips to `CLOSED` when the last participant leaves).
317
+ Room policy (`RoomPolicy`, all optional): `waitingRoom` (non-hosts wait for host admit), `requireHost` (non-hosts cannot open the call), `maxParticipants` (per-room cap), `autoCloseWhenEmpty` (room flips to `CLOSED` when the last participant leaves), `mediaMode` (`'MESH'` default | `'SFU'`), `mediaEncryption` (`'E2EE'` default | `'SFU'`).
317
318
 
318
319
  ```typescript
319
320
  const room = await client.createRoom({
@@ -362,6 +363,46 @@ client.onGroupCallEvent((e) => {
362
363
 
363
364
  Audience members are receive-only by convention: on `GROUP_CALL_ROLE_CHANGED` to `AUDIENCE`, your app simply does not publish a local media track. The platform signals the role; your app owns the WebRTC tracks.
364
365
 
366
+ ### Routed media (SFU)
367
+
368
+ Available since SDK `0.17.0`. A room can opt out of peer-to-peer mesh and route its live-call media through the platform's media server. Set `policy.mediaMode` to `'SFU'` at create time, then ask the SDK for a join token; hand the token to your SFU client (e.g. LiveKit) to connect. `policy.mediaEncryption` controls whether the media server can decrypt the media: `'E2EE'` (default) keeps the platform blind, `'SFU'` lets the server terminate media so it can be recorded server-side.
369
+
370
+ ```typescript
371
+ const room = await client.createRoom({
372
+ name: 'All hands',
373
+ policy: { mediaMode: 'SFU', mediaEncryption: 'E2EE' },
374
+ });
375
+
376
+ const sfu = await client.getSfuToken(room.roomId);
377
+ // sfu = { url, token, room, mediaEncryption, expiresAt }
378
+ // connect with your SFU client using sfu.url + sfu.token
379
+ ```
380
+
381
+ Mesh remains the default; only switch to SFU once the participant count outgrows mesh or you specifically need server-side recording. The `getSfuToken` call returns `409` for mesh-mode rooms and `503` if the media server is not available.
382
+
383
+ ### Call Recording
384
+
385
+ Available since SDK `0.16.0`. The SDK **signals** recording state on a group or room call; your app does the actual media capture (`MediaRecorder`) and uploads the file to your own storage — the platform never holds the media. The recording signal is broadcast to every participant (including anyone who joins later); that transparency is enforced server-side.
386
+
387
+ | Method | Description |
388
+ |--------|-------------|
389
+ | `startRecording(callId)` | Signal that you started recording |
390
+ | `stopRecording(callId)` | Signal that you stopped recording |
391
+ | `markRecordingAvailable(callId, location)` | Announce an uploaded recording (`location` references it in your storage) |
392
+
393
+ ```typescript
394
+ client.startRecording(callId);
395
+ // ... your app records the streams and uploads the file ...
396
+ client.markRecordingAvailable(callId, 's3://my-bucket/recordings/call-123.webm');
397
+ client.stopRecording(callId);
398
+
399
+ client.onGroupCallEvent((e) => {
400
+ if (e.type === 'GROUP_CALL_RECORDING_STARTED') showRecordingBanner(e.payload); // recorder userId
401
+ });
402
+ ```
403
+
404
+ The platform also fires `recording.started` / `recording.stopped` / `recording.available` webhooks. For E2EE calls, recording stays on the client (the platform has no media plane); a server-side SFU recording mode is a future option.
405
+
365
406
  ### Screen Sharing
366
407
 
367
408
  Available since SDK `0.6.0`. The SDK only signals start/stop - capture (via the browser's `getDisplayMedia()`) and adding the resulting `MediaStreamTrack` to the existing peer connection are the app's responsibility.
@@ -1,6 +1,6 @@
1
1
  import { CryptoService } from '../crypto/crypto-service';
2
2
  import { SessionManager } from './session-manager';
3
- import { BroadcastCallback, CallEventCallback, DropOnAirClient, EventCallback, CreateRoomOptions, GroupCallEventCallback, GroupInfo, GroupMessageCallback, Room, UpdateRoomOptions, InitializeOptions, MessageCallback, MessageDeleteCallback, MessageEditCallback, TurnCredentials, DeviceInfo, ReadReceiptCallback, NotificationClearCallback, DraftSyncCallback } from './types';
3
+ import { BroadcastCallback, CallEventCallback, DropOnAirClient, EventCallback, CreateRoomOptions, GroupCallEventCallback, GroupInfo, GroupMessageCallback, Room, UpdateRoomOptions, SfuToken, InitializeOptions, MessageCallback, MessageDeleteCallback, MessageEditCallback, TurnCredentials, DeviceInfo, ReadReceiptCallback, NotificationClearCallback, DraftSyncCallback } from './types';
4
4
  import { AttachmentRef, CreateUploadSessionOptions, DownloadedAttachment, PrepareAttachmentOptions, UploadSession } from '../attachment/attachment-types';
5
5
  export declare class MessagingClient implements DropOnAirClient {
6
6
  private readonly options;
@@ -233,6 +233,7 @@ export declare class MessagingClient implements DropOnAirClient {
233
233
  getRoom(roomId: string): Promise<Room>;
234
234
  updateRoom(roomId: string, update: UpdateRoomOptions): Promise<Room>;
235
235
  deleteRoom(roomId: string): Promise<void>;
236
+ getSfuToken(roomId: string): Promise<SfuToken>;
236
237
  /**
237
238
  * Join the live call in a room. Resolves with the callId once joined; that
238
239
  * callId works with the existing group-call signaling methods (pass an empty
@@ -294,6 +295,10 @@ export declare class MessagingClient implements DropOnAirClient {
294
295
  promoteToSpeaker(callId: string, userId: string): void;
295
296
  demoteToAudience(callId: string, userId: string): void;
296
297
  submitStageQuestion(callId: string, text: string): void;
298
+ startRecording(callId: string): void;
299
+ stopRecording(callId: string): void;
300
+ /** Announce an uploaded recording; `location` is a reference into your storage. */
301
+ markRecordingAvailable(callId: string, location: string): void;
297
302
  private sendGroupCallFrame;
298
303
  /**
299
304
  * Initiate an outgoing call.
@@ -1018,6 +1018,13 @@ class MessagingClient {
1018
1018
  if (!res.ok)
1019
1019
  throw new Error(`deleteRoom failed (HTTP ${res.status})`);
1020
1020
  }
1021
+ async getSfuToken(roomId) {
1022
+ const jwt = await this.getValidDropOnAirJwt(false);
1023
+ const res = await this.fetchFn(`${this.httpUrl}/api/rooms/${encodeURIComponent(roomId)}/sfu-token`, { method: 'POST', headers: { Authorization: `Bearer ${jwt}` } });
1024
+ if (!res.ok)
1025
+ throw new Error(`getSfuToken failed (HTTP ${res.status})`);
1026
+ return res.json();
1027
+ }
1021
1028
  /**
1022
1029
  * Join the live call in a room. Resolves with the callId once joined; that
1023
1030
  * callId works with the existing group-call signaling methods (pass an empty
@@ -1336,6 +1343,19 @@ class MessagingClient {
1336
1343
  submitStageQuestion(callId, text) {
1337
1344
  this.sendGroupCallFrame({ type: 'GROUP_CALL_STAGE_QUESTION', callId, groupId: '', payload: text });
1338
1345
  }
1346
+ // Call recording (Feature 3.5a). These SIGNAL recording state; the actual
1347
+ // media capture + upload to your storage is your app's job (same split as
1348
+ // screen sharing). The platform broadcasts the signal to every participant.
1349
+ startRecording(callId) {
1350
+ this.sendGroupCallFrame({ type: 'GROUP_CALL_RECORDING_STARTED', callId, groupId: '' });
1351
+ }
1352
+ stopRecording(callId) {
1353
+ this.sendGroupCallFrame({ type: 'GROUP_CALL_RECORDING_STOPPED', callId, groupId: '' });
1354
+ }
1355
+ /** Announce an uploaded recording; `location` is a reference into your storage. */
1356
+ markRecordingAvailable(callId, location) {
1357
+ this.sendGroupCallFrame({ type: 'GROUP_CALL_RECORDING_AVAILABLE', callId, groupId: '', payload: location });
1358
+ }
1339
1359
  sendGroupCallFrame(frame) {
1340
1360
  if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
1341
1361
  throw new Error('DropOnAir websocket is not connected');
@@ -135,7 +135,7 @@ export interface DecryptedGroupMessage {
135
135
  plaintext: string;
136
136
  }
137
137
  export type GroupMessageCallback = (message: DecryptedGroupMessage) => void;
138
- export type GroupCallEventType = 'GROUP_CALL_INVITE' | 'GROUP_CALL_RINGING' | 'GROUP_CALL_JOIN' | 'GROUP_CALL_LEAVE' | 'GROUP_CALL_END' | 'GROUP_CALL_ENDED' | 'GROUP_CALL_PARTICIPANT_JOINED' | 'GROUP_CALL_PARTICIPANT_LEFT' | 'GROUP_CALL_PARTICIPANT_REMOVED' | 'GROUP_CALL_ALREADY_ACTIVE' | 'GROUP_CALL_SDP_OFFER' | 'GROUP_CALL_SDP_ANSWER' | 'GROUP_CALL_ICE_CANDIDATE' | 'GROUP_CALL_SCREEN_SHARE_STARTED' | 'GROUP_CALL_SCREEN_SHARE_STOPPED' | 'GROUP_CALL_HOST_TRANSFER' | 'GROUP_CALL_COHOST_APPOINT' | 'GROUP_CALL_COHOST_REVOKE' | 'GROUP_CALL_ROLE_CHANGED' | 'GROUP_CALL_MUTE_PARTICIPANT' | 'GROUP_CALL_REMOVE_PARTICIPANT' | 'GROUP_CALL_WAITING_ROOM_REQUEST' | 'GROUP_CALL_WAITING_ROOM_JOINED' | 'GROUP_CALL_WAITING_ROOM_ADMIT' | 'GROUP_CALL_WAITING_ROOM_ADMITTED' | 'GROUP_CALL_WAITING_ROOM_REJECT' | 'GROUP_CALL_WAITING_ROOM_REJECTED' | 'GROUP_CALL_JOINED' | 'GROUP_CALL_WAITING_ROOM_PENDING' | 'GROUP_CALL_HOST_REQUIRED' | 'GROUP_CALL_ROOM_CLOSED' | 'GROUP_CALL_STAGE_HAND_RAISED' | 'GROUP_CALL_STAGE_HAND_LOWERED' | 'GROUP_CALL_STAGE_PROMOTE' | 'GROUP_CALL_STAGE_DEMOTE' | 'GROUP_CALL_STAGE_QUESTION';
138
+ export type GroupCallEventType = 'GROUP_CALL_INVITE' | 'GROUP_CALL_RINGING' | 'GROUP_CALL_JOIN' | 'GROUP_CALL_LEAVE' | 'GROUP_CALL_END' | 'GROUP_CALL_ENDED' | 'GROUP_CALL_PARTICIPANT_JOINED' | 'GROUP_CALL_PARTICIPANT_LEFT' | 'GROUP_CALL_PARTICIPANT_REMOVED' | 'GROUP_CALL_ALREADY_ACTIVE' | 'GROUP_CALL_SDP_OFFER' | 'GROUP_CALL_SDP_ANSWER' | 'GROUP_CALL_ICE_CANDIDATE' | 'GROUP_CALL_SCREEN_SHARE_STARTED' | 'GROUP_CALL_SCREEN_SHARE_STOPPED' | 'GROUP_CALL_HOST_TRANSFER' | 'GROUP_CALL_COHOST_APPOINT' | 'GROUP_CALL_COHOST_REVOKE' | 'GROUP_CALL_ROLE_CHANGED' | 'GROUP_CALL_MUTE_PARTICIPANT' | 'GROUP_CALL_REMOVE_PARTICIPANT' | 'GROUP_CALL_WAITING_ROOM_REQUEST' | 'GROUP_CALL_WAITING_ROOM_JOINED' | 'GROUP_CALL_WAITING_ROOM_ADMIT' | 'GROUP_CALL_WAITING_ROOM_ADMITTED' | 'GROUP_CALL_WAITING_ROOM_REJECT' | 'GROUP_CALL_WAITING_ROOM_REJECTED' | 'GROUP_CALL_JOINED' | 'GROUP_CALL_WAITING_ROOM_PENDING' | 'GROUP_CALL_HOST_REQUIRED' | 'GROUP_CALL_ROOM_CLOSED' | 'GROUP_CALL_STAGE_HAND_RAISED' | 'GROUP_CALL_STAGE_HAND_LOWERED' | 'GROUP_CALL_STAGE_PROMOTE' | 'GROUP_CALL_STAGE_DEMOTE' | 'GROUP_CALL_STAGE_QUESTION' | 'GROUP_CALL_RECORDING_STARTED' | 'GROUP_CALL_RECORDING_STOPPED' | 'GROUP_CALL_RECORDING_AVAILABLE';
139
139
  export interface GroupCallEvent {
140
140
  type: GroupCallEventType | string;
141
141
  callId: string;
@@ -165,6 +165,30 @@ export interface RoomPolicy {
165
165
  * hand to be promoted. Mesh-scale - suited to panels and small stages.
166
166
  */
167
167
  stageMode?: boolean;
168
+ /**
169
+ * Media transport for the room's live call. 'MESH' (default) is peer-to-peer;
170
+ * 'SFU' routes media through the platform's media server, suited to larger calls.
171
+ */
172
+ mediaMode?: 'MESH' | 'SFU';
173
+ /**
174
+ * Media encryption for an SFU-mode call. 'E2EE' (default) keeps media encrypted
175
+ * past the media server; 'SFU' lets the server terminate media (enables
176
+ * server-side recording). Ignored when mediaMode is 'MESH'.
177
+ */
178
+ mediaEncryption?: 'E2EE' | 'SFU';
179
+ }
180
+ /** Access credentials to join a room's SFU (routed) media. Returned by getSfuToken. */
181
+ export interface SfuToken {
182
+ /** WebSocket URL of the media server to connect your SFU client to. */
183
+ url: string;
184
+ /** Signed, short-lived access token for the media room. */
185
+ token: string;
186
+ /** Media room name to join. */
187
+ room: string;
188
+ /** Media encryption in effect for the room: 'E2EE' or 'SFU'. */
189
+ mediaEncryption: 'E2EE' | 'SFU';
190
+ /** Token expiry, Unix epoch millis. */
191
+ expiresAt: number;
168
192
  }
169
193
  export interface Room {
170
194
  roomId: string;
@@ -492,6 +516,12 @@ export interface DropOnAirClient {
492
516
  joinRoom(roomId: string): Promise<string>;
493
517
  /** Leave the live call in a room. */
494
518
  leaveRoom(callId: string): Promise<void>;
519
+ /**
520
+ * Fetch an access token to join a room's SFU (routed) media. Only valid for
521
+ * rooms whose policy sets mediaMode 'SFU'; mesh-mode rooms run peer-to-peer
522
+ * and need no token. Hand the returned url + token to your SFU client.
523
+ */
524
+ getSfuToken(roomId: string): Promise<SfuToken>;
495
525
  /** Raise your hand to request promotion to speaker (any participant). */
496
526
  raiseHand(callId: string): void;
497
527
  /** Lower your previously raised hand. */
@@ -502,4 +532,10 @@ export interface DropOnAirClient {
502
532
  demoteToAudience(callId: string, userId: string): void;
503
533
  /** Submit a text question; relayed to the stage's speakers. */
504
534
  submitStageQuestion(callId: string, text: string): void;
535
+ /** Signal that you have started recording the call. */
536
+ startRecording(callId: string): void;
537
+ /** Signal that you have stopped recording. */
538
+ stopRecording(callId: string): void;
539
+ /** Announce an uploaded recording; `location` references it in your storage. */
540
+ markRecordingAvailable(callId: string, location: string): void;
505
541
  }
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { InitializeOptions, DropOnAirClient } from './core/types';
2
2
  export { SDK_VERSION, PROTOCOL_VERSION, PAYLOAD_FORMAT_VERSION } from './version';
3
3
  export declare function initialize(options: InitializeOptions): Promise<DropOnAirClient>;
4
- export type { InitializeOptions, DropOnAirClient, DropOnAirEvent, MessageCallback, EventCallback, DecryptedMessage, KeyStorageAdapter, CallEvent, CallEventType, CallEventCallback, TurnCredentials, BroadcastMessage, BroadcastCallback, GroupInfo, GroupMemberInfo, DecryptedGroupMessage, GroupMessageCallback, GroupCallEvent, GroupCallEventType, GroupCallEventCallback, Room, RoomPolicy, CreateRoomOptions, UpdateRoomOptions, MessageEditEvent, MessageEditCallback, MessageDeleteEvent, MessageDeleteCallback, DeviceInfo, ReadReceiptEvent, ReadReceiptCallback, NotificationClearEvent, NotificationClearCallback, DraftSyncEvent, DraftSyncCallback, } from './core/types';
4
+ export type { InitializeOptions, DropOnAirClient, DropOnAirEvent, MessageCallback, EventCallback, DecryptedMessage, KeyStorageAdapter, CallEvent, CallEventType, CallEventCallback, TurnCredentials, BroadcastMessage, BroadcastCallback, GroupInfo, GroupMemberInfo, DecryptedGroupMessage, GroupMessageCallback, GroupCallEvent, GroupCallEventType, GroupCallEventCallback, Room, RoomPolicy, CreateRoomOptions, UpdateRoomOptions, SfuToken, MessageEditEvent, MessageEditCallback, MessageDeleteEvent, MessageDeleteCallback, DeviceInfo, ReadReceiptEvent, ReadReceiptCallback, NotificationClearEvent, NotificationClearCallback, DraftSyncEvent, DraftSyncCallback, } from './core/types';
5
5
  export type { AttachmentEncryptionType, AttachmentConversationType, AttachmentRef, DeviceWrappedKey, CreateUploadSessionOptions, UploadSession, PrepareAttachmentOptions, DownloadedAttachment, } from './attachment/attachment-types';
6
6
  declare const _default: {
7
7
  initialize: typeof initialize;
package/dist/version.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * MINOR, additive feature (e.g. multi-device payloads, new call event type)
8
8
  * PATCH, bug-fix / perf improvement with no wire or API change
9
9
  */
10
- export declare const SDK_VERSION = "0.15.0";
10
+ export declare const SDK_VERSION = "0.17.0";
11
11
  /**
12
12
  * Binary encrypted-payload format version.
13
13
  * Included as the first byte of every encrypted payload so receivers can
package/dist/version.js CHANGED
@@ -10,7 +10,7 @@ exports.PROTOCOL_VERSION = exports.PAYLOAD_FORMAT_VERSION = exports.SDK_VERSION
10
10
  * MINOR, additive feature (e.g. multi-device payloads, new call event type)
11
11
  * PATCH, bug-fix / perf improvement with no wire or API change
12
12
  */
13
- exports.SDK_VERSION = '0.15.0';
13
+ exports.SDK_VERSION = '0.17.0';
14
14
  /**
15
15
  * Binary encrypted-payload format version.
16
16
  * Included as the first byte of every encrypted payload so receivers can
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@droponair/sdk-js",
3
- "version": "0.15.0",
3
+ "version": "0.17.0",
4
4
  "description": "DropOnAir SDK for end-to-end encrypted messaging",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",