@streaming-cdn/rtc-web 1.3.14 → 1.3.15

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # RTC Web SDK 1.3.14
1
+ # RTC Web SDK 1.3.15
2
2
 
3
3
  The customer package contains compiled ESM/UMD JavaScript and TypeScript declarations. It intentionally excludes implementation source and source maps. Example source remains available under `examples/`.
4
4
 
@@ -169,6 +169,41 @@ the room client (`getNativeClient()`); the publisher keeps sending every
169
169
  layer. The React Native adapter has the same transport option and the same
170
170
  `setRemoteQuality` on the client.
171
171
 
172
+ ## Virtual backgrounds and effects
173
+
174
+ `createVideoEffectsPipeline(cameraTrack)` draws the camera through a canvas
175
+ and hands back a processed track for `setVideoTrack`, so both transports
176
+ publish it unchanged. Backgrounds: `blur`, animated procedural scenes
177
+ (`aurora`, `cybergrid`, `bokeh`, `sunset`), or your own `image`. Overlays:
178
+ `snow`, `confetti`, `vignette`. Person cut-out uses any `Segmenter` you plug
179
+ in (for example a self-hosted MediaPipe selfie model); without one the
180
+ pipeline degrades honestly — `blur` blurs the whole frame, scenes show the
181
+ camera as a floating card.
182
+
183
+ ```ts
184
+ const effects = createVideoEffectsPipeline(cameraTrack, { segmenter });
185
+ effects.setBackground("aurora");
186
+ effects.setOverlay("confetti");
187
+ await media.setVideoTrack(effects.track);
188
+ ```
189
+
190
+ ## Call recording
191
+
192
+ `createCallRecorder(media.getNativeClient(), { credential })` composites every
193
+ participant's video onto a canvas, mixes all audio, records with
194
+ MediaRecorder, and on `stop()` uploads the file with the room signaling token.
195
+ The platform stores it, bills the storage, lists it under
196
+ `GET /v1/rtc/recordings` (Server API), and serves it from
197
+ `GET /v1/rtc/recordings/{id}/download`. Recording happens on this client —
198
+ what is recorded is what this participant saw and heard.
199
+
200
+ ```ts
201
+ const recorder = createCallRecorder(media.getNativeClient(), { credential });
202
+ await recorder.start();
203
+ // ... later
204
+ const { recordingId, durationSeconds } = await recorder.stop();
205
+ ```
206
+
172
207
  ## Active speaker
173
208
 
174
209
  The client samples WebRTC audio levels once a second on both transports and
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Client-side call recording.
3
+ *
4
+ * The mesh has no server with access to the media, so the first recorder that
5
+ * can exist lives where the media already is: this client. It composites every
6
+ * video tile onto a canvas, mixes every audio track, records the result with
7
+ * MediaRecorder, and uploads the finished file with the room signaling token.
8
+ * The platform bills and purges the stored file through the same
9
+ * `rtc_recordings` rows a future server-side recorder will use.
10
+ */
11
+ export interface RecordableRoomClient {
12
+ getRemoteStreams(): Array<{
13
+ participant: {
14
+ participantId: string;
15
+ displayName: string;
16
+ };
17
+ stream: MediaStream;
18
+ }>;
19
+ getLocalStream(): MediaStream | null;
20
+ }
21
+ export interface CallRecorderOptions {
22
+ credential: {
23
+ signalingToken: string;
24
+ signalingUrl: string;
25
+ };
26
+ /** Canvas output height; width follows 16:9. Default 720. */
27
+ height?: number;
28
+ mimeType?: string;
29
+ /** Test seams. */
30
+ document?: Document;
31
+ mediaRecorderFactory?: (stream: MediaStream, options: {
32
+ mimeType: string;
33
+ }) => MediaRecorder;
34
+ fetchImplementation?: typeof fetch;
35
+ }
36
+ export interface CallRecorderResult {
37
+ recordingId: string;
38
+ sizeBytes: number;
39
+ durationSeconds: number;
40
+ }
41
+ export interface CallRecorder {
42
+ readonly recording: boolean;
43
+ start(): Promise<void>;
44
+ /** Stops, uploads, and marks the recording ready. */
45
+ stop(): Promise<CallRecorderResult>;
46
+ dispose(): void;
47
+ }
48
+ export declare function createCallRecorder(client: RecordableRoomClient, options: CallRecorderOptions): CallRecorder;
package/dist/index.d.ts CHANGED
@@ -2,6 +2,10 @@ export { createPictureInPictureController } from "./picture-in-picture";
2
2
  export type { PictureInPictureController, PictureInPictureOptions } from "./picture-in-picture";
3
3
  export { pickActiveSpeaker, SPEAKER_NOISE_FLOOR, SPEAKER_TAKEOVER_RATIO } from "./active-speaker";
4
4
  export type { SpeakerLevel } from "./active-speaker";
5
+ export { createCallRecorder } from "./call-recorder";
6
+ export type { CallRecorder, CallRecorderOptions, CallRecorderResult } from "./call-recorder";
7
+ export { BACKGROUND_PRESETS, createVideoEffectsPipeline, OVERLAY_EFFECTS, scenePainters } from "./video-effects";
8
+ export type { BackgroundPreset, OverlayEffect, Segmenter, VideoEffectsOptions, VideoEffectsPipeline } from "./video-effects";
5
9
  export type RtcMode = "voice" | "video" | "meeting";
6
10
  /**
7
11
  * How media travels. `mesh` (the default) opens one connection per pair and
@@ -338,4 +342,4 @@ export declare class RtcIncomingClient extends EventTarget {
338
342
  private emit;
339
343
  }
340
344
  export declare function createRtcIncomingClient(options: RtcIncomingClientOptions): RtcIncomingClient;
341
- export declare const version = "1.3.14";
345
+ export declare const version = "1.3.15";