restream-sdk 0.1.8 → 0.1.9

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/core.js +9 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "restream-sdk",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Plug-and-play headless React hooks to add multi-platform restreaming (connect socials, go live, live chat + viewers, collaborative split-screen) with zero client backend.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/core.js CHANGED
@@ -532,6 +532,15 @@ export class RestreamStudio extends EventTarget {
532
532
  let evt;
533
533
  try { evt = JSON.parse(e.data); } catch { return; } // heartbeat / non-JSON
534
534
  if (!evt || !evt.type) return;
535
+ // When the composite starts, transition this client onto the composite job —
536
+ // critical for the HOST, who was still tracking their (now-superseded) solo
537
+ // job. The guest already attached via the accept response; the id guard makes
538
+ // this idempotent so it doesn't restart realtime twice.
539
+ if (evt.type === "collab-composite" && evt.job?.id && this.job?.id !== evt.job.id) {
540
+ this.job = evt.job;
541
+ this._emit("job", evt.job);
542
+ this.startRealtime(evt.job.id);
543
+ }
535
544
  this._emit(evt.type, evt);
536
545
  this._emit("collab", evt);
537
546
  };