chuvsu-js 5.5.4 → 5.5.5
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.
|
@@ -6,6 +6,8 @@ export declare class WebinarGateway {
|
|
|
6
6
|
private session;
|
|
7
7
|
private client;
|
|
8
8
|
getSession(): WebinarSession;
|
|
9
|
+
/** Cookie-authenticated state socket for managed reconnection and health checks. */
|
|
10
|
+
createStateSocket(): WebinarSocket;
|
|
9
11
|
/** Cookie-authenticated signaling socket; audio/video WebRTC stays in the browser. */
|
|
10
12
|
createMediaSocket(): WebinarSocket;
|
|
11
13
|
openSession(opts: {
|
package/dist/webinar/gateway.js
CHANGED
|
@@ -13,6 +13,12 @@ export class WebinarGateway {
|
|
|
13
13
|
throw new AuthError("Open a webinar session first");
|
|
14
14
|
return structuredClone(this.session);
|
|
15
15
|
}
|
|
16
|
+
/** Cookie-authenticated state socket for managed reconnection and health checks. */
|
|
17
|
+
createStateSocket() {
|
|
18
|
+
if (!this.session)
|
|
19
|
+
throw new AuthError("Open a webinar session first");
|
|
20
|
+
return this.http.createWebSocket(this.session.connections.state);
|
|
21
|
+
}
|
|
16
22
|
/** Cookie-authenticated signaling socket; audio/video WebRTC stays in the browser. */
|
|
17
23
|
createMediaSocket() {
|
|
18
24
|
if (!this.session)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { WebinarSocketFactory } from "./types.js";
|
|
2
2
|
export interface WebinarMediaOptions {
|
|
3
|
+
/** Inject a compatible receive stream in runtimes without a global MediaStream. */
|
|
4
|
+
streamFactory?: () => MediaStream;
|
|
3
5
|
socketFactory?: WebinarSocketFactory;
|
|
4
6
|
peerFactory?: (config: RTCConfiguration) => RTCPeerConnection;
|
|
5
7
|
timeout?: number;
|
package/dist/webinar/playback.js
CHANGED
|
@@ -30,7 +30,7 @@ export class WebinarPlayback {
|
|
|
30
30
|
this.offering =
|
|
31
31
|
kind !== "audio" || session.mediaSettings?.listenOnlyOffering !== false;
|
|
32
32
|
this.messages = webinarMediaMessages(session, kind, streamId, hasAudio);
|
|
33
|
-
this.stream = new MediaStream();
|
|
33
|
+
this.stream = opts.streamFactory ? opts.streamFactory() : new MediaStream();
|
|
34
34
|
this.connection = (opts.peerFactory ?? ((config) => new RTCPeerConnection(config)))({
|
|
35
35
|
iceServers: session.iceServers,
|
|
36
36
|
iceTransportPolicy: session.mediaSettings?.forceRelay ||
|
package/docs/webinar.md
CHANGED
|
@@ -38,6 +38,18 @@ owner-scoped WebSocket signaling relay and provide its browser endpoint through
|
|
|
38
38
|
connections and audio/video remain directly between the browser and BBB. Never
|
|
39
39
|
serialize the gateway cookie jar or share a relay with another participant.
|
|
40
40
|
|
|
41
|
+
For managed backend reconnection, `gateway.createStateSocket()` creates the state
|
|
42
|
+
transport using the gateway's existing cookies and TLS configuration. Pass it as
|
|
43
|
+
`new WebinarClient(gateway.getSession(), { socketFactory: () => gateway.createStateSocket() })`.
|
|
44
|
+
Close the preceding state client before replacing it; constructing the socket
|
|
45
|
+
alone does not authenticate or rejoin the participant.
|
|
46
|
+
|
|
47
|
+
`WebinarMediaOptions.streamFactory` complements `peerFactory` for runtimes without
|
|
48
|
+
a global `MediaStream`. Supply a compatible receive stream through
|
|
49
|
+
`streamFactory: () => stream`; the library does not install global polyfills.
|
|
50
|
+
Receive-only audio still requires a real WebRTC peer connection and consumes
|
|
51
|
+
network bandwidth. These factories do not automatically enable media.
|
|
52
|
+
|
|
41
53
|
## State and events
|
|
42
54
|
|
|
43
55
|
- `getUsers()`, `getPresenter()`, `getModerators()` distinguish participant roles.
|