restream-sdk 0.4.1 → 0.4.2
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/package.json +1 -1
- package/src/core.js +5 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "restream-sdk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
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
|
@@ -427,11 +427,14 @@ export class RestreamStudio extends EventTarget {
|
|
|
427
427
|
this._emit("job", job);
|
|
428
428
|
if (job?.id) this.startRealtime(job.id);
|
|
429
429
|
// Push the initial presence/layout state (explicit `layout`, or whatever was set via
|
|
430
|
-
// setStreamState() before we had a job id).
|
|
430
|
+
// setStreamState() before we had a job id). setStreamState is synchronous (returns the
|
|
431
|
+
// merged state, not a Promise) and its network send is debounced + self-handles errors,
|
|
432
|
+
// so DON'T await/.catch it — doing so threw and made goLive reject after the job had
|
|
433
|
+
// already started. Wrapped defensively so a flush error can never reject go-live.
|
|
431
434
|
const initialState = { ...(this._pendingState || {}), ...(layout || {}) };
|
|
432
435
|
if (job?.id && Object.keys(initialState).length) {
|
|
433
436
|
this._pendingState = null;
|
|
434
|
-
this.setStreamState(initialState)
|
|
437
|
+
try { this.setStreamState(initialState); } catch (e) { this._emit("error", e); }
|
|
435
438
|
}
|
|
436
439
|
return job;
|
|
437
440
|
}
|