mediascale-sdk 1.0.12 → 1.0.13
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/docs/integration.md +220 -7
- package/package.json +2 -2
- package/src/client.js +605 -201
- package/src/index.js +2 -0
- package/src/live.js +100 -0
- package/src/record-compositor.js +3 -3
- package/src/record-frame-compositor.js +103 -110
- package/src/record-worker.js +1 -1
- package/src/record.js +292 -138
package/docs/integration.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
# Use the SDK in Next.js ( v1.0
|
|
1
|
+
# Use the SDK in Next.js ( v1.1.0 )
|
|
2
2
|
|
|
3
3
|
One address talks to Mediascale. The default is `http://localhost:8080`.
|
|
4
4
|
|
|
5
5
|
A person joins a session, turns on camera and microphone, hears the others, and leaves. Recording is **off by default**. Pass `recording: true` to `createClient`, or put `recording: true` on a **host** token (for example from Stream Control → Webinar → Enable recording). Recording then starts on `connect()` — no mic or camera required. You can also call `startRecording()` / `stopRecording()` any time. Each start/stop opens a new segment; `end()` combines every segment into one file.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Live streaming to YouTube, Twitch, Facebook, or any RTMP server is built in. Put destinations on the meeting (Stream Control or `addRtmpDestinations`), put `rtmp: true` on the **host** token when you want streaming to start on join, or call `startRtmp()` from your Live UI. See [Live streaming (RTMP)](#live-streaming-rtmp).
|
|
8
|
+
|
|
9
|
+
The secret that signs tokens stays on your server. The browser only receives a short-lived token. **Never put stream keys in the JWT.**
|
|
8
10
|
|
|
9
11
|
## Install
|
|
10
12
|
|
|
@@ -43,6 +45,8 @@ export async function POST(request) {
|
|
|
43
45
|
const role = body.role === "host" ? "host" : "audience";
|
|
44
46
|
const name = String(body.name || "Guest").slice(0, 40);
|
|
45
47
|
const recording = body.recording === true || body.recording === "1" || body.recording === 1;
|
|
48
|
+
// Host-only: when true and destinations exist for this sessionId, SDK auto Go Live on connect().
|
|
49
|
+
const rtmp = body.rtmp === true || body.rtmp === "1" || body.rtmp === 1;
|
|
46
50
|
if (!sessionId) return Response.json({ error: "sessionId is required" }, { status: 400 });
|
|
47
51
|
|
|
48
52
|
const payload = {
|
|
@@ -50,7 +54,7 @@ export async function POST(request) {
|
|
|
50
54
|
role,
|
|
51
55
|
name,
|
|
52
56
|
// Host-only: when true, createClient starts recording on connect() even if you omit recording: true.
|
|
53
|
-
...(role === "host" ? { recording } : { recording: false }),
|
|
57
|
+
...(role === "host" ? { recording, rtmp } : { recording: false }),
|
|
54
58
|
exp: Date.now() + 2 * 60 * 60 * 1000,
|
|
55
59
|
};
|
|
56
60
|
const encoded = Buffer.from(JSON.stringify(payload)).toString("base64url");
|
|
@@ -69,6 +73,7 @@ Token claims the SDK reads:
|
|
|
69
73
|
| `role` | `host` or `audience` (required) |
|
|
70
74
|
| `name` | Display name |
|
|
71
75
|
| `recording` | When `true` on a **host** token, auto-start recording on `connect()` unless `createClient({ recording: false })` |
|
|
76
|
+
| `rtmp` | When `true` on a **host** token **and** the meeting already has enabled destinations, the SDK calls `startRtmp()` automatically after `connect()`. Stream keys are **never** put in the token. Hosts can still open Live and stream without this claim by adding destinations in-meeting. |
|
|
72
77
|
| `exp` | Expiry as a Unix timestamp in **milliseconds** |
|
|
73
78
|
|
|
74
79
|
### Sample stage roles (meet UI)
|
|
@@ -121,7 +126,8 @@ Copy `sdk/react-sdk/sample/app/room.js` into your app. The comments in that file
|
|
|
121
126
|
4. **Screen** calls `startScreenShare()` or `stopScreenShare()`.
|
|
122
127
|
5. **Custom stream** (optional) — see [Custom streams](#custom-streams) (`startCustomStream` / `stopCustomStream`), for example a whiteboard tab capture.
|
|
123
128
|
6. **Record** (host) starts automatically when enabled on the token / `createClient`, or from the toolbar via `startRecording()` / `stopRecording()`. You can toggle any time; the final file includes every segment and mirrors the live stage layout.
|
|
124
|
-
7. **
|
|
129
|
+
7. **Live (RTMP)** (host / co-host) — wire a Live control to `onRtmpStatus`, `startRtmp()`, and `stopRtmp()`. If the host token has `rtmp: true` and destinations were saved for this `sessionId`, streaming starts on connect (same as pressing Go Live). See [Live streaming (RTMP)](#live-streaming-rtmp).
|
|
130
|
+
8. **End** leaves the session and saves the recording if this person was recording.
|
|
125
131
|
|
|
126
132
|
`recording` defaults to **false**. Set `createClient({ recording: true })` **or** put `recording: true` on the host JWT when the host should already be recording when they join (Stream Control “Enable recording” does this). Chunks start **immediately** on connect / `startRecording()` — mic and camera are not required. Until video is live, the recording canvas shows the host placeholder (magenta field, circular letter avatar, bottom-left **name pill**).
|
|
127
133
|
|
|
@@ -216,8 +222,8 @@ await client.end(); // combines every segment into one file
|
|
|
216
222
|
|
|
217
223
|
| Function | What it does |
|
|
218
224
|
| --- | --- |
|
|
219
|
-
| `createClient({ endpoint, sessionId, token, recording, recordingCanvasBackground, iceServers, publishLimits, ...callbacks })` | Prepares the client. `sessionId` and `token` are required. `endpoint` defaults to `http://localhost:8080`. `recording` defaults to **false**. Optional `recordingCanvasBackground` (CSS color, default `#2563eb`) is the base for the radial + wave canvas backdrop and the local/presenter accent border. Optional `publishLimits: { cameraBps, screenBps }` overrides portal join caps. |
|
|
220
|
-
| `connect()` | Checks the token and joins the session. If recording is enabled for a **host**, recording starts
|
|
225
|
+
| `createClient({ endpoint, sessionId, token, recording, recordingCanvasBackground, recordingFps, recordingBitrate, rtmpFps, rtmpBitrate, iceServers, publishLimits, ...callbacks })` | Prepares the client. `sessionId` and `token` are required. `endpoint` defaults to `http://localhost:8080`. `recording` defaults to **false**. Optional `recordingCanvasBackground` (CSS color, default `#2563eb`) is the base for the radial + wave canvas backdrop and the local/presenter accent border. Optional `publishLimits: { cameraBps, screenBps }` overrides portal join caps. Frame rates are independent: `recordingFps` (default **15**) and `rtmpFps` (default **30**), each 1–60. `recordingBitrate` (default 4.5 Mbps) and `rtmpBitrate` (default 2.5 Mbps) are in bps. |
|
|
226
|
+
| `connect()` | Checks the token and joins the session. If recording is enabled for a **host**, recording starts in the background. If the host token has `rtmp: true` and the meeting already has enabled destinations, `startRtmp()` also runs in the background. Join does not wait for either to finish preparing. |
|
|
221
227
|
| `subscribe()` | Starts playing the other people. Call this once after `connect()`. |
|
|
222
228
|
| `startCamera({ cameraId, resolution, track })` | Publishes the camera. Pass `track` to use your own live video track (SDK clones it). |
|
|
223
229
|
| `replaceCameraTrack(track)` | Hot-swaps the live camera producer with a new live video track (SDK clones it). No unpublish. Camera must already be started. |
|
|
@@ -235,6 +241,16 @@ await client.end(); // combines every segment into one file
|
|
|
235
241
|
| `stopRecording()` | Pauses recording without saving. Call `startRecording()` again to continue; `end()` still combines all segments into one file. |
|
|
236
242
|
| `setRecordingCrop(source, crop)` | Crops a video source in the recording layout. `crop` is `{ x, y, w, h }` in 0..1 (same as subscriber whiteboard crop). Pass `null` to clear. |
|
|
237
243
|
| `setRecordingStage(people)` | **Required for stage-accurate recording.** Who appears on the recording stage: `[{ id, name, local? }]` (max six on canvas). Avatars + name pills until that peer’s webcam arrives. See [Recording must match the live stage](#recording-must-match-the-live-stage). |
|
|
244
|
+
| `setRecordingFps(fps)` / `getRecordingFps()` | Recording frame rate (1–60). Applies to the next `startRecording()`; a running segment keeps its rate. |
|
|
245
|
+
| `startRtmp({ destinations? })` | **Go Live** (host / co-host). Streams the stage to every enabled destination. Optional `destinations` are added first. Also runs automatically after `connect()` when the host token has `rtmp: true` and destinations already exist. Throws if the browser cannot encode H264. |
|
|
246
|
+
| `stopRtmp()` | Ends the live stream on every platform. Destinations stay saved so the host can Go Live again. |
|
|
247
|
+
| `addRtmpDestinations(list)` | Adds `[{ platform, streamKey, serverUrl?, label? }]`. `platform` is `youtube`, `twitch`, `facebook`, or `custom` (custom needs `serverUrl`). Works before or during a live stream. |
|
|
248
|
+
| `setRtmpDestination(id, enabled)` | Turns one destination on or off. While live, only that platform connects or disconnects. |
|
|
249
|
+
| `removeRtmpDestination(id)` | Deletes a destination. |
|
|
250
|
+
| `getRtmpStatus()` | Returns the current live state (see `onRtmpStatus`). |
|
|
251
|
+
| `setRtmpFps(fps)` / `getRtmpFps()` | RTMP frame rate (1–60). While live, the compositor restarts and swaps tracks in place (platforms stay connected). |
|
|
252
|
+
| `canLiveStream()` | `true` when this browser can compose and encode H264. Hide or disable Go Live when this is `false`. |
|
|
253
|
+
| `isRtmpEnabled()` | `true` after a host has joined (or a co-host has opened Live). Safe to show the Live control when this is true for managers. |
|
|
238
254
|
| `getPeerId()` | Socket peer id for this browser after `connect()`. |
|
|
239
255
|
| `getPublishLimits()` | Current `{ cameraBps, screenBps }` used for outgoing video encode caps. |
|
|
240
256
|
| `getUserList()` / `updateSelf(...)` / `stageAction(...)` | Optional portal roster helpers used by the sample meet UI. Skip these if your app already manages users and stage on its own. |
|
|
@@ -255,6 +271,7 @@ Pass these to `createClient`.
|
|
|
255
271
|
| `onError(error)` | A call failed. `error.message` is the reason. The same call also throws, so `await` can use `try/catch`. |
|
|
256
272
|
| `onRecording(state)` | `armed` briefly while capture is preparing. `recording` while chunks are uploading. `stopped` after `stopRecording()`, handoff, or `end()`. |
|
|
257
273
|
| `onActiveSpeaker({ peerId, displayName, producerId, local })` | Fires when the loudest mic in the room changes. `peerId` is `null` when nobody is speaking. `local` is true when it is this browser. Requires `ACTIVE_SPEAKER_DETECTION=true` on the origin SFU and portal. |
|
|
274
|
+
| `onRtmpStatus(status)` | Live stream state changed. `status` is `{ enabled, state, live, startedAt, composing }`; hosts and co-hosts also get `destinations: [{ id, platform, label, host, keyHint, enabled, state, kbps, error }]`, `fps`, and `error`. `state` is `idle`, `starting`, `connecting`, `waiting-media`, `live`, `reconnecting`, `failed`, or `error`. |
|
|
258
275
|
| `onStageChanged(people)` | Optional. Fires when the recording stage list changes after `setRecordingStage` (or sample roster updates). |
|
|
259
276
|
| `onUserList` / `onUserJoined` / `onUserLeft` / `onUserUpdated` / `onUserBlocked` | Optional portal roster events for the sample meet UI. Not required if your webinar app manages join/leave/stage itself — use `setRecordingStage` instead. |
|
|
260
277
|
|
|
@@ -426,6 +443,202 @@ window.addEventListener("mediascale:recording-error", (event) => {
|
|
|
426
443
|
});
|
|
427
444
|
```
|
|
428
445
|
|
|
446
|
+
## Live streaming (RTMP)
|
|
447
|
+
|
|
448
|
+
A host streams the meeting to several platforms at once (YouTube, Twitch, Facebook, or any RTMP/RTMPS ingest). The live picture uses the **same stage layout** as recording (screen + up to six cameras, name pills, brand background, every mic mixed). Keep calling `setRecordingStage([...])` whenever your stage changes — that list drives both recording and the live compositor.
|
|
449
|
+
|
|
450
|
+
### What webinar apps must do
|
|
451
|
+
|
|
452
|
+
| Step | Who | What |
|
|
453
|
+
| --- | --- | --- |
|
|
454
|
+
| 1. Store destinations | Your backend **or** Stream Control | Platform + server URL + stream key per destination, keyed by the same `sessionId` the host will join |
|
|
455
|
+
| 2. Mint host token | Your `/api/token` | Include `rtmp: true` when destinations were prepared ahead of time (auto Go Live). Omit it when the host will configure Live only inside the room |
|
|
456
|
+
| 3. Create the client | Browser | `createClient({ …, onRtmpStatus })` then `connect()` / `subscribe()` |
|
|
457
|
+
| 4. Drive stage layout | Browser | `setRecordingStage` so avatars / names match the live UI |
|
|
458
|
+
| 5. Live UI | Host / co-host | Show a Live control; call `startRtmp` / `stopRtmp`; render destinations from `onRtmpStatus` |
|
|
459
|
+
|
|
460
|
+
Audience tokens never get `rtmp`. Stream keys never go in the JWT — only in destination storage / `addRtmpDestinations`.
|
|
461
|
+
|
|
462
|
+
### Path A — Stream Control webinar create
|
|
463
|
+
|
|
464
|
+
Stream Control → Webinar → **Enable live streaming (RTMP)** saves destinations (keys encrypted) and puts `rtmp: true` on the host link.
|
|
465
|
+
|
|
466
|
+
1. Host opens the meet URL.
|
|
467
|
+
2. After `connect()`, the SDK **auto Go Live** when enabled destinations exist for that `sessionId`.
|
|
468
|
+
3. The Live panel lists those destinations (`platform`, `serverUrl` / `host`, `keyHint`). Keys are not re-entered.
|
|
469
|
+
4. Host can **End live stream**, change destinations, or Go Live again from the same panel.
|
|
470
|
+
|
|
471
|
+
### Path B — Your own webinar product (SDK only)
|
|
472
|
+
|
|
473
|
+
Use the same `sessionId` everywhere (token, destinations, `createClient`).
|
|
474
|
+
|
|
475
|
+
**1. Token** — see the route above. Example body from your create-webinar API:
|
|
476
|
+
|
|
477
|
+
```js
|
|
478
|
+
await fetch("/api/token", {
|
|
479
|
+
method: "POST",
|
|
480
|
+
headers: { "Content-Type": "application/json" },
|
|
481
|
+
body: JSON.stringify({
|
|
482
|
+
sessionId, // same id you stored destinations under
|
|
483
|
+
role: "host",
|
|
484
|
+
name: hostDisplayName,
|
|
485
|
+
recording: true, // optional
|
|
486
|
+
rtmp: true, // auto Go Live when destinations already exist
|
|
487
|
+
}),
|
|
488
|
+
});
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
**2. Destinations before join** (optional)
|
|
492
|
+
|
|
493
|
+
- Stream Control meet session API stores them when you use that product, **or**
|
|
494
|
+
- Host adds them in-meeting with `addRtmpDestinations` / `startRtmp({ destinations })` (Path C).
|
|
495
|
+
|
|
496
|
+
If you store destinations yourself via the control plane, use the same `sessionId` and never return full stream keys to the browser (UI only shows `keyHint`).
|
|
497
|
+
|
|
498
|
+
**3. Client + Live UI**
|
|
499
|
+
|
|
500
|
+
```js
|
|
501
|
+
const client = createClient({
|
|
502
|
+
endpoint, // e.g. https://stream.example.com or http://localhost:8080
|
|
503
|
+
sessionId,
|
|
504
|
+
token, // host JWT
|
|
505
|
+
rtmpFps: 30, // live canvas / H264 (default 30)
|
|
506
|
+
rtmpBitrate: 2_500_000,
|
|
507
|
+
recordingFps: 15, // independent of rtmpFps
|
|
508
|
+
onRtmpStatus: (status) => {
|
|
509
|
+
// status.enabled — show Live for managers once the room allows it
|
|
510
|
+
// status.live — true when platforms are receiving
|
|
511
|
+
// status.state — idle | starting | connecting | waiting-media | live | reconnecting | failed | error
|
|
512
|
+
// status.destinations — host/co-host only: id, platform, label, host, serverUrl, keyHint, enabled, state, kbps, error
|
|
513
|
+
setLive(status);
|
|
514
|
+
},
|
|
515
|
+
onError: (error) => showToast(error.message),
|
|
516
|
+
});
|
|
517
|
+
|
|
518
|
+
await client.connect();
|
|
519
|
+
await client.subscribe();
|
|
520
|
+
|
|
521
|
+
// Keep live + recording tiles aligned with your stage UI
|
|
522
|
+
client.setRecordingStage([
|
|
523
|
+
{ id: hostPeerId, name: "Alex", local: true },
|
|
524
|
+
{ id: speakerPeerId, name: "Rakesh", local: false },
|
|
525
|
+
]);
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
Wire your Live button like the sample (`sample/app/live-panel.js`):
|
|
529
|
+
|
|
530
|
+
```js
|
|
531
|
+
if (!client.canLiveStream()) {
|
|
532
|
+
// Hide Go Live — need Chrome, Edge, or Safari (H264)
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
// Go Live (no-op destinations if already saved for this session)
|
|
536
|
+
await client.startRtmp();
|
|
537
|
+
|
|
538
|
+
// Or add / replace destinations in one call
|
|
539
|
+
await client.startRtmp({
|
|
540
|
+
destinations: [
|
|
541
|
+
{ platform: "youtube", streamKey: "xxxx-xxxx-xxxx-xxxx" },
|
|
542
|
+
{ platform: "twitch", streamKey: "live_123_abc" },
|
|
543
|
+
{ platform: "custom", serverUrl: "rtmp://ingest.example/live", streamKey: "my-key", label: "CDN" },
|
|
544
|
+
],
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
await client.addRtmpDestinations([
|
|
548
|
+
{ platform: "facebook", streamKey: "FB-123?s_bl=1&a=b" },
|
|
549
|
+
]);
|
|
550
|
+
|
|
551
|
+
await client.setRtmpDestination(destinationId, false); // one platform off; others keep going
|
|
552
|
+
await client.removeRtmpDestination(destinationId);
|
|
553
|
+
|
|
554
|
+
await client.stopRtmp(); // end broadcast; destinations remain for a later Go Live
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
### Path C — No RTMP at create time
|
|
558
|
+
|
|
559
|
+
Omit `rtmp` on the token (or set `false`). The host still gets a Live control after join:
|
|
560
|
+
|
|
561
|
+
1. Open Live → add destinations (`addRtmpDestinations`) → **Go Live** (`startRtmp()`).
|
|
562
|
+
2. Or call `startRtmp({ destinations: [...] })` once.
|
|
563
|
+
|
|
564
|
+
### Destination object
|
|
565
|
+
|
|
566
|
+
| Field | Required | Notes |
|
|
567
|
+
| --- | --- | --- |
|
|
568
|
+
| `platform` | yes | `youtube`, `twitch`, `facebook`, or `custom` |
|
|
569
|
+
| `streamKey` | yes when adding | Never store this in the JWT or client logs |
|
|
570
|
+
| `serverUrl` | custom yes; others optional | Presets: YouTube `rtmp://a.rtmp.youtube.com/live2`, Twitch `rtmp://live.twitch.tv/app`, Facebook `rtmps://live-api-s.facebook.com:443/rtmp/` |
|
|
571
|
+
| `label` | no | Defaults to the platform name |
|
|
572
|
+
|
|
573
|
+
Presets fill `serverUrl` when omitted. Max destinations per meeting defaults to **5** (`RTMP_MAX_DESTINATIONS`).
|
|
574
|
+
|
|
575
|
+
### Auto-start rules
|
|
576
|
+
|
|
577
|
+
| Host token | Destinations for `sessionId` | On `connect()` |
|
|
578
|
+
| --- | --- | --- |
|
|
579
|
+
| `rtmp: true` | ≥1 enabled | SDK calls `startRtmp()` automatically |
|
|
580
|
+
| `rtmp: true` | none | Idle — host adds destinations then Go Live |
|
|
581
|
+
| `rtmp` omitted / false | any | Idle — host uses Live UI manually |
|
|
582
|
+
|
|
583
|
+
Auto-start does **not** block join. Failures go to `onError` / `onRtmpStatus` (`state: "error"`).
|
|
584
|
+
|
|
585
|
+
### `onRtmpStatus` shape
|
|
586
|
+
|
|
587
|
+
```js
|
|
588
|
+
{
|
|
589
|
+
enabled: true,
|
|
590
|
+
state: "live", // see table in Callbacks
|
|
591
|
+
live: true,
|
|
592
|
+
startedAt: "2026-…",
|
|
593
|
+
composing: true, // this browser is publishing hidden rtmp-* tracks
|
|
594
|
+
fps: 30, // host / co-host
|
|
595
|
+
error: null,
|
|
596
|
+
destinations: [ // host / co-host only
|
|
597
|
+
{
|
|
598
|
+
id: "…",
|
|
599
|
+
platform: "youtube",
|
|
600
|
+
label: "YouTube",
|
|
601
|
+
host: "a.rtmp.youtube.com",
|
|
602
|
+
serverUrl: "rtmp://a.rtmp.youtube.com/live2",
|
|
603
|
+
keyHint: "••••xxxx",
|
|
604
|
+
enabled: true,
|
|
605
|
+
state: "live", // idle | pending | connecting | live | failed | off | …
|
|
606
|
+
kbps: 2400,
|
|
607
|
+
error: null,
|
|
608
|
+
},
|
|
609
|
+
],
|
|
610
|
+
}
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
Suggested UI: Live toolbar button `on` when `state` is not `idle` / `error`; panel lists `destinations` (prefilled from create — no need to retype keys); primary action is Go Live / End live stream.
|
|
614
|
+
|
|
615
|
+
### How the media flows
|
|
616
|
+
|
|
617
|
+
```
|
|
618
|
+
Host browser
|
|
619
|
+
stage canvas @ rtmpFps ─► H264 (hidden track "rtmp-video") ─┐
|
|
620
|
+
mix of every mic ─► Opus (hidden track "rtmp-audio") ─┴─► origin ─RTP─► RTMP server
|
|
621
|
+
RTMP server (one VM runs many meetings)
|
|
622
|
+
H264 ─► passed through (no decode / encode)
|
|
623
|
+
Opus ─► AAC (once per meeting) ─► FLV ─► YouTube / Twitch / Facebook / custom …
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
- Hidden tracks are charged on the **origin** only and are never sent to edges or shown to participants.
|
|
627
|
+
- Browser must encode **H264** (Chrome, Edge, Safari). Check `canLiveStream()` before enabling Go Live.
|
|
628
|
+
- Host uploads about `rtmpBitrate` (default 2.5 Mbps) more while live.
|
|
629
|
+
- If the presenter leaves, another publisher takes over composing (same idea as recording). If nobody can, the stream stops.
|
|
630
|
+
- Each destination reconnects with its own backoff; one bad key does not stop the others.
|
|
631
|
+
- Platform side (e.g. YouTube) must already be **Go Live** / accepting the key, or the destination stays connecting / failed while Mediascale is pushing.
|
|
632
|
+
|
|
633
|
+
### Frame rates
|
|
634
|
+
|
|
635
|
+
| Option | Default | Used for |
|
|
636
|
+
| --- | --- | --- |
|
|
637
|
+
| `recordingFps` | `15` | MediaRecorder recording canvas |
|
|
638
|
+
| `rtmpFps` | `30` | Live stream canvas and H264 encode |
|
|
639
|
+
|
|
640
|
+
Separate canvases — each rate is independent. Live compositor window events: `mediascale:live-mode` / `mediascale:live-error`.
|
|
641
|
+
|
|
429
642
|
## Run the sample
|
|
430
643
|
|
|
431
644
|
```bash
|
|
@@ -438,4 +651,4 @@ Open http://localhost:3200. The page asks your Next.js server for a token, then
|
|
|
438
651
|
|
|
439
652
|
Set `SDK_SECRET` in the environment before `npm run dev`. `MEDASCALE_ENDPOINT` is optional. The sample uses it when it is set, and otherwise uses `http://localhost:8080`.
|
|
440
653
|
|
|
441
|
-
With the full local stack (`deploy/local`), the sample is also served behind the gateway at `/meet`. Stream Control → Webinar can mint host/invite links with `recording`
|
|
654
|
+
With the full local stack (`deploy/local`), the sample is also served behind the gateway at `/meet`. Stream Control → Webinar can mint host/invite links with `recording` and `rtmp` from those toggles. When RTMP destinations were saved at create, the host page **starts streaming on join**; the **LIVE** button stays available to end, restart, or edit destinations (`sample/app/live-panel.js`). `?recordingFps=15&rtmpFps=30` on the meet URL overrides frame rates for testing.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mediascale-sdk",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Mediascale React/browser SDK for live sessions, WebRTC publish/subscribe, and
|
|
3
|
+
"version": "1.0.13",
|
|
4
|
+
"description": "Mediascale React/browser SDK for live sessions, WebRTC publish/subscribe, recording, and RTMP live streaming",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"exports": {
|