@livekit/rtc-node 0.13.29 → 0.13.30
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/dist/audio_stream-B4hGVcKz.d.cts +498 -0
- package/dist/audio_stream-DEG1JKge.d.ts +498 -0
- package/dist/audio_stream.cjs +21 -6
- package/dist/audio_stream.cjs.map +1 -1
- package/dist/audio_stream.d.cts +12 -22
- package/dist/audio_stream.d.ts +12 -22
- package/dist/audio_stream.d.ts.map +1 -1
- package/dist/audio_stream.js +19 -5
- package/dist/audio_stream.js.map +1 -1
- package/dist/data_streams/index.d.cts +1 -1
- package/dist/data_streams/index.d.ts +1 -1
- package/dist/data_streams/stream_reader.d.cts +1 -1
- package/dist/data_streams/stream_reader.d.ts +1 -1
- package/dist/data_streams/stream_writer.d.cts +1 -1
- package/dist/data_streams/stream_writer.d.ts +1 -1
- package/dist/data_streams/types.d.cts +1 -1
- package/dist/data_streams/types.d.ts +1 -1
- package/dist/frame_processor.cjs +6 -0
- package/dist/frame_processor.cjs.map +1 -1
- package/dist/frame_processor.d.cts +2 -0
- package/dist/frame_processor.d.ts +2 -0
- package/dist/frame_processor.d.ts.map +1 -1
- package/dist/frame_processor.js +6 -0
- package/dist/frame_processor.js.map +1 -1
- package/dist/index.d.cts +4 -7
- package/dist/index.d.ts +4 -7
- package/dist/participant.cjs +6 -0
- package/dist/participant.cjs.map +1 -1
- package/dist/participant.d.cts +14 -153
- package/dist/participant.d.ts +14 -153
- package/dist/participant.d.ts.map +1 -1
- package/dist/participant.js +6 -0
- package/dist/participant.js.map +1 -1
- package/dist/room.cjs +28 -0
- package/dist/room.cjs.map +1 -1
- package/dist/room.d.cts +12 -221
- package/dist/room.d.ts +12 -221
- package/dist/room.d.ts.map +1 -1
- package/dist/room.js +28 -0
- package/dist/room.js.map +1 -1
- package/dist/track.cjs +123 -0
- package/dist/track.cjs.map +1 -1
- package/dist/track.d.cts +15 -42
- package/dist/track.d.ts +15 -42
- package/dist/track.d.ts.map +1 -1
- package/dist/track.js +123 -0
- package/dist/track.js.map +1 -1
- package/dist/track_publication.d.cts +14 -47
- package/dist/track_publication.d.ts +14 -47
- package/dist/{stream_reader-CuG4b8Y-.d.cts → types-_PdPVish.d.cts} +40 -40
- package/dist/{stream_reader-CuG4b8Y-.d.ts → types-_PdPVish.d.ts} +40 -40
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.d.cts +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/video_stream.d.cts +12 -2
- package/dist/video_stream.d.ts +12 -2
- package/package.json +3 -3
- package/src/audio_stream.ts +28 -4
- package/src/audio_stream_room_lifecycle.test.ts +753 -0
- package/src/bun_runtime.test.ts +27 -0
- package/src/frame_processor.ts +4 -0
- package/src/participant.ts +17 -0
- package/src/room.ts +44 -0
- package/src/track.ts +141 -0
- package/src/version.ts +1 -1
package/dist/room.d.cts
CHANGED
|
@@ -1,227 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
1
|
+
import '@livekit/rtc-ffi-bindings';
|
|
2
|
+
import '@livekit/typed-emitter';
|
|
3
|
+
import './types-_PdPVish.cjs';
|
|
4
|
+
import './e2ee.cjs';
|
|
5
|
+
export { C as ConnectError, j as Room, o as RoomCallbacks, k as RoomEvent, l as RoomOptions, m as RtcConfiguration, p as defaultRoomOptions, q as defaultRtcConfiguration } from './audio_stream-B4hGVcKz.cjs';
|
|
6
|
+
import './types.cjs';
|
|
7
|
+
import 'node:stream/web';
|
|
8
|
+
import './audio_frame.cjs';
|
|
9
|
+
import './frame_processor.cjs';
|
|
10
|
+
import './video_frame.cjs';
|
|
11
|
+
import './audio_source.cjs';
|
|
12
|
+
import './ffi_client.cjs';
|
|
10
13
|
import '@livekit/mutex';
|
|
11
14
|
import 'node:fs';
|
|
12
15
|
import './data_streams/stream_writer.cjs';
|
|
13
|
-
import './ffi_client.cjs';
|
|
14
16
|
import './rpc.cjs';
|
|
15
17
|
import './transcription.cjs';
|
|
16
|
-
import './audio_source.cjs';
|
|
17
|
-
import './audio_frame.cjs';
|
|
18
18
|
import './video_source.cjs';
|
|
19
|
-
import './video_frame.cjs';
|
|
20
|
-
|
|
21
|
-
interface RtcConfiguration {
|
|
22
|
-
iceTransportType: IceTransportType;
|
|
23
|
-
continualGatheringPolicy: ContinualGatheringPolicy;
|
|
24
|
-
iceServers: IceServer[];
|
|
25
|
-
}
|
|
26
|
-
declare const defaultRtcConfiguration: RtcConfiguration;
|
|
27
|
-
interface RoomOptions {
|
|
28
|
-
autoSubscribe: boolean;
|
|
29
|
-
dynacast: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated Use `encryption` instead. See x for details
|
|
32
|
-
*/
|
|
33
|
-
e2ee?: E2EEOptions;
|
|
34
|
-
encryption?: E2EEOptions;
|
|
35
|
-
rtcConfig?: RtcConfiguration;
|
|
36
|
-
}
|
|
37
|
-
declare const defaultRoomOptions: RoomOptions$1;
|
|
38
|
-
declare const Room_base: new () => TypedEventEmitter<RoomCallbacks>;
|
|
39
|
-
declare class Room extends Room_base {
|
|
40
|
-
private info?;
|
|
41
|
-
private ffiHandle?;
|
|
42
|
-
/**
|
|
43
|
-
* used to ensure events are processed sequentially and allow for
|
|
44
|
-
* the local participant to acquire the lock while doing state updates related to FFI events
|
|
45
|
-
* before processing the next events
|
|
46
|
-
*/
|
|
47
|
-
private ffiEventLock;
|
|
48
|
-
private byteStreamControllers;
|
|
49
|
-
private textStreamControllers;
|
|
50
|
-
private byteStreamHandlers;
|
|
51
|
-
private textStreamHandlers;
|
|
52
|
-
private preConnectEvents;
|
|
53
|
-
private disconnectController;
|
|
54
|
-
private hasCleanedUp;
|
|
55
|
-
private _token?;
|
|
56
|
-
private _serverUrl?;
|
|
57
|
-
private _connectionState;
|
|
58
|
-
e2eeManager?: E2EEManager;
|
|
59
|
-
remoteParticipants: Map<string, RemoteParticipant>;
|
|
60
|
-
localParticipant?: LocalParticipant;
|
|
61
|
-
constructor();
|
|
62
|
-
get connectionState(): ConnectionState;
|
|
63
|
-
get name(): string | undefined;
|
|
64
|
-
get metadata(): string | undefined;
|
|
65
|
-
get isConnected(): boolean;
|
|
66
|
-
/** @internal */
|
|
67
|
-
get token(): string | undefined;
|
|
68
|
-
/** @internal */
|
|
69
|
-
get serverUrl(): string | undefined;
|
|
70
|
-
private sidPromise?;
|
|
71
|
-
/**
|
|
72
|
-
* Gets the room's server ID. This ID is assigned by the LiveKit server
|
|
73
|
-
* and is unique for each room session.
|
|
74
|
-
* SID is assigned asynchronously after connection.
|
|
75
|
-
* @returns Promise that resolves to the room's server ID, or empty string if not connected
|
|
76
|
-
*/
|
|
77
|
-
getSid(): Promise<string>;
|
|
78
|
-
getRtcStats(): Promise<_livekit_rtc_ffi_bindings.GetSessionStatsCallback_Result>;
|
|
79
|
-
get numParticipants(): number;
|
|
80
|
-
get numPublishers(): number;
|
|
81
|
-
get creationTime(): Date;
|
|
82
|
-
get isRecording(): boolean;
|
|
83
|
-
/**
|
|
84
|
-
* The time in seconds after which a room will be closed after the last
|
|
85
|
-
* participant has disconnected.
|
|
86
|
-
*/
|
|
87
|
-
get departureTimeout(): number;
|
|
88
|
-
/**
|
|
89
|
-
* The time in seconds after which an empty room will be automatically closed.
|
|
90
|
-
*/
|
|
91
|
-
get emptyTimeout(): number;
|
|
92
|
-
/**
|
|
93
|
-
* Connects to a LiveKit room using the provided URL and access token.
|
|
94
|
-
* @param url - The WebSocket URL of the LiveKit server
|
|
95
|
-
* @param token - A valid LiveKit access token for authentication
|
|
96
|
-
* @param opts - Optional room configuration options
|
|
97
|
-
* @throws ConnectError - if connection fails
|
|
98
|
-
*/
|
|
99
|
-
connect(url: string, token: string, opts?: RoomOptions): Promise<void>;
|
|
100
|
-
/**
|
|
101
|
-
* Disconnects from the room and cleans up all resources.
|
|
102
|
-
* This will stop all tracks and close the connection.
|
|
103
|
-
*/
|
|
104
|
-
disconnect(): Promise<void>;
|
|
105
|
-
/**
|
|
106
|
-
* Trigger a reconnection / chaos scenario for testing. Most useful in
|
|
107
|
-
* tests to deterministically force a Resume (signal-only reconnect that
|
|
108
|
-
* preserves the PeerConnection and existing publications) or a full
|
|
109
|
-
* reconnect (the SDK rebuilds the RtcSession and re-publishes existing
|
|
110
|
-
* local tracks; `RoomEvent.Reconnected` fires).
|
|
111
|
-
*/
|
|
112
|
-
simulateScenario(scenario: SimulateScenarioKind): Promise<void>;
|
|
113
|
-
private updateConnectionState;
|
|
114
|
-
private cleanupOnDisconnect;
|
|
115
|
-
/**
|
|
116
|
-
* Registers a handler for incoming text data streams on a specific topic.
|
|
117
|
-
* Text streams are used for receiving structured text data from other participants.
|
|
118
|
-
* @param topic - The topic to listen for text streams on
|
|
119
|
-
* @param callback - Function to handle incoming text stream data
|
|
120
|
-
* @throws Error - if a handler for this topic is already registered
|
|
121
|
-
*/
|
|
122
|
-
registerTextStreamHandler(topic: string, callback: TextStreamHandler): void;
|
|
123
|
-
unregisterTextStreamHandler(topic: string): void;
|
|
124
|
-
/**
|
|
125
|
-
* Registers a handler for incoming byte data streams on a specific topic.
|
|
126
|
-
* Byte streams are used for receiving binary data like files from other participants.
|
|
127
|
-
* @param topic - The topic to listen for byte streams on
|
|
128
|
-
* @param callback - Function to handle incoming byte stream data
|
|
129
|
-
* @throws Error - if a handler for this topic is already registered
|
|
130
|
-
*/
|
|
131
|
-
registerByteStreamHandler(topic: string, callback: ByteStreamHandler): void;
|
|
132
|
-
unregisterByteStreamHandler(topic: string): void;
|
|
133
|
-
private onFfiEvent;
|
|
134
|
-
private processFfiEvent;
|
|
135
|
-
private retrieveParticipantByIdentity;
|
|
136
|
-
private requireParticipantByIdentity;
|
|
137
|
-
private requireRemoteParticipant;
|
|
138
|
-
private requirePublicationOfParticipant;
|
|
139
|
-
private requirePublicationOfRemoteParticipant;
|
|
140
|
-
private createRemoteParticipant;
|
|
141
|
-
private handleStreamHeader;
|
|
142
|
-
private handleStreamChunk;
|
|
143
|
-
private handleStreamTrailer;
|
|
144
|
-
}
|
|
145
|
-
declare class ConnectError extends Error {
|
|
146
|
-
constructor(message: string);
|
|
147
|
-
}
|
|
148
|
-
type RoomCallbacks = {
|
|
149
|
-
participantConnected: (participant: RemoteParticipant) => void;
|
|
150
|
-
participantDisconnected: (participant: RemoteParticipant) => void;
|
|
151
|
-
localTrackPublished: (publication: LocalTrackPublication, participant: LocalParticipant) => void;
|
|
152
|
-
localTrackUnpublished: (publication: LocalTrackPublication, participant: LocalParticipant) => void;
|
|
153
|
-
/**
|
|
154
|
-
* Fired when the SDK auto-republished a local track during a full
|
|
155
|
-
* reconnect. The publication object's identity is preserved (the same
|
|
156
|
-
* instance is updated in place with the new server-assigned SIDs);
|
|
157
|
-
* `previousSid` is provided for callers that key external state on the
|
|
158
|
-
* old SID and need to reconcile.
|
|
159
|
-
*/
|
|
160
|
-
localTrackRepublished: (publication: LocalTrackPublication, previousSid: string, participant: LocalParticipant) => void;
|
|
161
|
-
localTrackSubscribed: (track: LocalTrack) => void;
|
|
162
|
-
trackPublished: (publication: RemoteTrackPublication, participant: RemoteParticipant) => void;
|
|
163
|
-
trackUnpublished: (publication: RemoteTrackPublication, participant: RemoteParticipant) => void;
|
|
164
|
-
trackSubscribed: (track: RemoteTrack, publication: RemoteTrackPublication, participant: RemoteParticipant) => void;
|
|
165
|
-
trackUnsubscribed: (track: RemoteTrack, publication: RemoteTrackPublication, participant: RemoteParticipant) => void;
|
|
166
|
-
trackSubscriptionFailed: (trackSid: string, participant: RemoteParticipant, reason?: string) => void;
|
|
167
|
-
trackMuted: (publication: TrackPublication, participant: Participant) => void;
|
|
168
|
-
trackUnmuted: (publication: TrackPublication, participant: Participant) => void;
|
|
169
|
-
activeSpeakersChanged: (speakers: Participant[]) => void;
|
|
170
|
-
roomMetadataChanged: (metadata: string) => void;
|
|
171
|
-
roomInfoUpdated: (info: RoomInfo) => void;
|
|
172
|
-
participantMetadataChanged: (metadata: string | undefined, participant: Participant) => void;
|
|
173
|
-
participantNameChanged: (name: string, participant: Participant) => void;
|
|
174
|
-
participantAttributesChanged: (changedAttributes: Record<string, string>, participant: Participant) => void;
|
|
175
|
-
participantEncryptionStatusChanged: (isEncrypted: boolean, participant: Participant) => void;
|
|
176
|
-
connectionQualityChanged: (quality: ConnectionQuality, participant: Participant) => void;
|
|
177
|
-
dataReceived: (payload: Uint8Array, participant?: RemoteParticipant, kind?: DataPacketKind, topic?: string, encryptionType?: EncryptionType) => void;
|
|
178
|
-
chatMessage: (message: ChatMessage, participant?: Participant) => void;
|
|
179
|
-
dtmfReceived: (code: number, digit: string, participant: RemoteParticipant) => void;
|
|
180
|
-
encryptionError: (error: Error) => void;
|
|
181
|
-
connectionStateChanged: (state: ConnectionState) => void;
|
|
182
|
-
connected: () => void;
|
|
183
|
-
disconnected: (reason: DisconnectReason) => void;
|
|
184
|
-
reconnecting: () => void;
|
|
185
|
-
reconnected: () => void;
|
|
186
|
-
roomSidChanged: (sid: string) => void;
|
|
187
|
-
roomUpdated: () => void;
|
|
188
|
-
moved: () => void;
|
|
189
|
-
tokenRefreshed: () => void;
|
|
190
|
-
};
|
|
191
|
-
declare enum RoomEvent {
|
|
192
|
-
ParticipantConnected = "participantConnected",
|
|
193
|
-
ParticipantDisconnected = "participantDisconnected",
|
|
194
|
-
LocalTrackPublished = "localTrackPublished",
|
|
195
|
-
LocalTrackUnpublished = "localTrackUnpublished",
|
|
196
|
-
LocalTrackRepublished = "localTrackRepublished",
|
|
197
|
-
LocalTrackSubscribed = "localTrackSubscribed",
|
|
198
|
-
TrackPublished = "trackPublished",
|
|
199
|
-
TrackUnpublished = "trackUnpublished",
|
|
200
|
-
TrackSubscribed = "trackSubscribed",
|
|
201
|
-
TrackUnsubscribed = "trackUnsubscribed",
|
|
202
|
-
TrackSubscriptionFailed = "trackSubscriptionFailed",
|
|
203
|
-
TrackMuted = "trackMuted",
|
|
204
|
-
TrackUnmuted = "trackUnmuted",
|
|
205
|
-
ActiveSpeakersChanged = "activeSpeakersChanged",
|
|
206
|
-
RoomMetadataChanged = "roomMetadataChanged",
|
|
207
|
-
RoomSidChanged = "roomSidChanged",
|
|
208
|
-
ParticipantMetadataChanged = "participantMetadataChanged",
|
|
209
|
-
ParticipantNameChanged = "participantNameChanged",
|
|
210
|
-
ParticipantAttributesChanged = "participantAttributesChanged",
|
|
211
|
-
ParticipantEncryptionStatusChanged = "participantEncryptionStatusChanged",
|
|
212
|
-
ConnectionQualityChanged = "connectionQualityChanged",
|
|
213
|
-
DataReceived = "dataReceived",
|
|
214
|
-
ChatMessage = "chatMessage",
|
|
215
|
-
DtmfReceived = "dtmfReceived",
|
|
216
|
-
EncryptionError = "encryptionError",
|
|
217
|
-
ConnectionStateChanged = "connectionStateChanged",
|
|
218
|
-
Connected = "connected",
|
|
219
|
-
Disconnected = "disconnected",
|
|
220
|
-
Reconnecting = "reconnecting",
|
|
221
|
-
Reconnected = "reconnected",
|
|
222
|
-
RoomUpdated = "roomUpdated",
|
|
223
|
-
Moved = "moved",
|
|
224
|
-
TokenRefreshed = "tokenRefreshed"
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
export { ConnectError, Room, type RoomCallbacks, RoomEvent, type RoomOptions, type RtcConfiguration, defaultRoomOptions, defaultRtcConfiguration };
|
package/dist/room.d.ts
CHANGED
|
@@ -1,227 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
1
|
+
import '@livekit/rtc-ffi-bindings';
|
|
2
|
+
import '@livekit/typed-emitter';
|
|
3
|
+
import './types-_PdPVish.js';
|
|
4
|
+
import './e2ee.js';
|
|
5
|
+
export { C as ConnectError, j as Room, o as RoomCallbacks, k as RoomEvent, l as RoomOptions, m as RtcConfiguration, p as defaultRoomOptions, q as defaultRtcConfiguration } from './audio_stream-DEG1JKge.js';
|
|
6
|
+
import './types.js';
|
|
7
|
+
import 'node:stream/web';
|
|
8
|
+
import './audio_frame.js';
|
|
9
|
+
import './frame_processor.js';
|
|
10
|
+
import './video_frame.js';
|
|
11
|
+
import './audio_source.js';
|
|
12
|
+
import './ffi_client.js';
|
|
10
13
|
import '@livekit/mutex';
|
|
11
14
|
import 'node:fs';
|
|
12
15
|
import './data_streams/stream_writer.js';
|
|
13
|
-
import './ffi_client.js';
|
|
14
16
|
import './rpc.js';
|
|
15
17
|
import './transcription.js';
|
|
16
|
-
import './audio_source.js';
|
|
17
|
-
import './audio_frame.js';
|
|
18
18
|
import './video_source.js';
|
|
19
|
-
import './video_frame.js';
|
|
20
|
-
|
|
21
|
-
interface RtcConfiguration {
|
|
22
|
-
iceTransportType: IceTransportType;
|
|
23
|
-
continualGatheringPolicy: ContinualGatheringPolicy;
|
|
24
|
-
iceServers: IceServer[];
|
|
25
|
-
}
|
|
26
|
-
declare const defaultRtcConfiguration: RtcConfiguration;
|
|
27
|
-
interface RoomOptions {
|
|
28
|
-
autoSubscribe: boolean;
|
|
29
|
-
dynacast: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated Use `encryption` instead. See x for details
|
|
32
|
-
*/
|
|
33
|
-
e2ee?: E2EEOptions;
|
|
34
|
-
encryption?: E2EEOptions;
|
|
35
|
-
rtcConfig?: RtcConfiguration;
|
|
36
|
-
}
|
|
37
|
-
declare const defaultRoomOptions: RoomOptions$1;
|
|
38
|
-
declare const Room_base: new () => TypedEventEmitter<RoomCallbacks>;
|
|
39
|
-
declare class Room extends Room_base {
|
|
40
|
-
private info?;
|
|
41
|
-
private ffiHandle?;
|
|
42
|
-
/**
|
|
43
|
-
* used to ensure events are processed sequentially and allow for
|
|
44
|
-
* the local participant to acquire the lock while doing state updates related to FFI events
|
|
45
|
-
* before processing the next events
|
|
46
|
-
*/
|
|
47
|
-
private ffiEventLock;
|
|
48
|
-
private byteStreamControllers;
|
|
49
|
-
private textStreamControllers;
|
|
50
|
-
private byteStreamHandlers;
|
|
51
|
-
private textStreamHandlers;
|
|
52
|
-
private preConnectEvents;
|
|
53
|
-
private disconnectController;
|
|
54
|
-
private hasCleanedUp;
|
|
55
|
-
private _token?;
|
|
56
|
-
private _serverUrl?;
|
|
57
|
-
private _connectionState;
|
|
58
|
-
e2eeManager?: E2EEManager;
|
|
59
|
-
remoteParticipants: Map<string, RemoteParticipant>;
|
|
60
|
-
localParticipant?: LocalParticipant;
|
|
61
|
-
constructor();
|
|
62
|
-
get connectionState(): ConnectionState;
|
|
63
|
-
get name(): string | undefined;
|
|
64
|
-
get metadata(): string | undefined;
|
|
65
|
-
get isConnected(): boolean;
|
|
66
|
-
/** @internal */
|
|
67
|
-
get token(): string | undefined;
|
|
68
|
-
/** @internal */
|
|
69
|
-
get serverUrl(): string | undefined;
|
|
70
|
-
private sidPromise?;
|
|
71
|
-
/**
|
|
72
|
-
* Gets the room's server ID. This ID is assigned by the LiveKit server
|
|
73
|
-
* and is unique for each room session.
|
|
74
|
-
* SID is assigned asynchronously after connection.
|
|
75
|
-
* @returns Promise that resolves to the room's server ID, or empty string if not connected
|
|
76
|
-
*/
|
|
77
|
-
getSid(): Promise<string>;
|
|
78
|
-
getRtcStats(): Promise<_livekit_rtc_ffi_bindings.GetSessionStatsCallback_Result>;
|
|
79
|
-
get numParticipants(): number;
|
|
80
|
-
get numPublishers(): number;
|
|
81
|
-
get creationTime(): Date;
|
|
82
|
-
get isRecording(): boolean;
|
|
83
|
-
/**
|
|
84
|
-
* The time in seconds after which a room will be closed after the last
|
|
85
|
-
* participant has disconnected.
|
|
86
|
-
*/
|
|
87
|
-
get departureTimeout(): number;
|
|
88
|
-
/**
|
|
89
|
-
* The time in seconds after which an empty room will be automatically closed.
|
|
90
|
-
*/
|
|
91
|
-
get emptyTimeout(): number;
|
|
92
|
-
/**
|
|
93
|
-
* Connects to a LiveKit room using the provided URL and access token.
|
|
94
|
-
* @param url - The WebSocket URL of the LiveKit server
|
|
95
|
-
* @param token - A valid LiveKit access token for authentication
|
|
96
|
-
* @param opts - Optional room configuration options
|
|
97
|
-
* @throws ConnectError - if connection fails
|
|
98
|
-
*/
|
|
99
|
-
connect(url: string, token: string, opts?: RoomOptions): Promise<void>;
|
|
100
|
-
/**
|
|
101
|
-
* Disconnects from the room and cleans up all resources.
|
|
102
|
-
* This will stop all tracks and close the connection.
|
|
103
|
-
*/
|
|
104
|
-
disconnect(): Promise<void>;
|
|
105
|
-
/**
|
|
106
|
-
* Trigger a reconnection / chaos scenario for testing. Most useful in
|
|
107
|
-
* tests to deterministically force a Resume (signal-only reconnect that
|
|
108
|
-
* preserves the PeerConnection and existing publications) or a full
|
|
109
|
-
* reconnect (the SDK rebuilds the RtcSession and re-publishes existing
|
|
110
|
-
* local tracks; `RoomEvent.Reconnected` fires).
|
|
111
|
-
*/
|
|
112
|
-
simulateScenario(scenario: SimulateScenarioKind): Promise<void>;
|
|
113
|
-
private updateConnectionState;
|
|
114
|
-
private cleanupOnDisconnect;
|
|
115
|
-
/**
|
|
116
|
-
* Registers a handler for incoming text data streams on a specific topic.
|
|
117
|
-
* Text streams are used for receiving structured text data from other participants.
|
|
118
|
-
* @param topic - The topic to listen for text streams on
|
|
119
|
-
* @param callback - Function to handle incoming text stream data
|
|
120
|
-
* @throws Error - if a handler for this topic is already registered
|
|
121
|
-
*/
|
|
122
|
-
registerTextStreamHandler(topic: string, callback: TextStreamHandler): void;
|
|
123
|
-
unregisterTextStreamHandler(topic: string): void;
|
|
124
|
-
/**
|
|
125
|
-
* Registers a handler for incoming byte data streams on a specific topic.
|
|
126
|
-
* Byte streams are used for receiving binary data like files from other participants.
|
|
127
|
-
* @param topic - The topic to listen for byte streams on
|
|
128
|
-
* @param callback - Function to handle incoming byte stream data
|
|
129
|
-
* @throws Error - if a handler for this topic is already registered
|
|
130
|
-
*/
|
|
131
|
-
registerByteStreamHandler(topic: string, callback: ByteStreamHandler): void;
|
|
132
|
-
unregisterByteStreamHandler(topic: string): void;
|
|
133
|
-
private onFfiEvent;
|
|
134
|
-
private processFfiEvent;
|
|
135
|
-
private retrieveParticipantByIdentity;
|
|
136
|
-
private requireParticipantByIdentity;
|
|
137
|
-
private requireRemoteParticipant;
|
|
138
|
-
private requirePublicationOfParticipant;
|
|
139
|
-
private requirePublicationOfRemoteParticipant;
|
|
140
|
-
private createRemoteParticipant;
|
|
141
|
-
private handleStreamHeader;
|
|
142
|
-
private handleStreamChunk;
|
|
143
|
-
private handleStreamTrailer;
|
|
144
|
-
}
|
|
145
|
-
declare class ConnectError extends Error {
|
|
146
|
-
constructor(message: string);
|
|
147
|
-
}
|
|
148
|
-
type RoomCallbacks = {
|
|
149
|
-
participantConnected: (participant: RemoteParticipant) => void;
|
|
150
|
-
participantDisconnected: (participant: RemoteParticipant) => void;
|
|
151
|
-
localTrackPublished: (publication: LocalTrackPublication, participant: LocalParticipant) => void;
|
|
152
|
-
localTrackUnpublished: (publication: LocalTrackPublication, participant: LocalParticipant) => void;
|
|
153
|
-
/**
|
|
154
|
-
* Fired when the SDK auto-republished a local track during a full
|
|
155
|
-
* reconnect. The publication object's identity is preserved (the same
|
|
156
|
-
* instance is updated in place with the new server-assigned SIDs);
|
|
157
|
-
* `previousSid` is provided for callers that key external state on the
|
|
158
|
-
* old SID and need to reconcile.
|
|
159
|
-
*/
|
|
160
|
-
localTrackRepublished: (publication: LocalTrackPublication, previousSid: string, participant: LocalParticipant) => void;
|
|
161
|
-
localTrackSubscribed: (track: LocalTrack) => void;
|
|
162
|
-
trackPublished: (publication: RemoteTrackPublication, participant: RemoteParticipant) => void;
|
|
163
|
-
trackUnpublished: (publication: RemoteTrackPublication, participant: RemoteParticipant) => void;
|
|
164
|
-
trackSubscribed: (track: RemoteTrack, publication: RemoteTrackPublication, participant: RemoteParticipant) => void;
|
|
165
|
-
trackUnsubscribed: (track: RemoteTrack, publication: RemoteTrackPublication, participant: RemoteParticipant) => void;
|
|
166
|
-
trackSubscriptionFailed: (trackSid: string, participant: RemoteParticipant, reason?: string) => void;
|
|
167
|
-
trackMuted: (publication: TrackPublication, participant: Participant) => void;
|
|
168
|
-
trackUnmuted: (publication: TrackPublication, participant: Participant) => void;
|
|
169
|
-
activeSpeakersChanged: (speakers: Participant[]) => void;
|
|
170
|
-
roomMetadataChanged: (metadata: string) => void;
|
|
171
|
-
roomInfoUpdated: (info: RoomInfo) => void;
|
|
172
|
-
participantMetadataChanged: (metadata: string | undefined, participant: Participant) => void;
|
|
173
|
-
participantNameChanged: (name: string, participant: Participant) => void;
|
|
174
|
-
participantAttributesChanged: (changedAttributes: Record<string, string>, participant: Participant) => void;
|
|
175
|
-
participantEncryptionStatusChanged: (isEncrypted: boolean, participant: Participant) => void;
|
|
176
|
-
connectionQualityChanged: (quality: ConnectionQuality, participant: Participant) => void;
|
|
177
|
-
dataReceived: (payload: Uint8Array, participant?: RemoteParticipant, kind?: DataPacketKind, topic?: string, encryptionType?: EncryptionType) => void;
|
|
178
|
-
chatMessage: (message: ChatMessage, participant?: Participant) => void;
|
|
179
|
-
dtmfReceived: (code: number, digit: string, participant: RemoteParticipant) => void;
|
|
180
|
-
encryptionError: (error: Error) => void;
|
|
181
|
-
connectionStateChanged: (state: ConnectionState) => void;
|
|
182
|
-
connected: () => void;
|
|
183
|
-
disconnected: (reason: DisconnectReason) => void;
|
|
184
|
-
reconnecting: () => void;
|
|
185
|
-
reconnected: () => void;
|
|
186
|
-
roomSidChanged: (sid: string) => void;
|
|
187
|
-
roomUpdated: () => void;
|
|
188
|
-
moved: () => void;
|
|
189
|
-
tokenRefreshed: () => void;
|
|
190
|
-
};
|
|
191
|
-
declare enum RoomEvent {
|
|
192
|
-
ParticipantConnected = "participantConnected",
|
|
193
|
-
ParticipantDisconnected = "participantDisconnected",
|
|
194
|
-
LocalTrackPublished = "localTrackPublished",
|
|
195
|
-
LocalTrackUnpublished = "localTrackUnpublished",
|
|
196
|
-
LocalTrackRepublished = "localTrackRepublished",
|
|
197
|
-
LocalTrackSubscribed = "localTrackSubscribed",
|
|
198
|
-
TrackPublished = "trackPublished",
|
|
199
|
-
TrackUnpublished = "trackUnpublished",
|
|
200
|
-
TrackSubscribed = "trackSubscribed",
|
|
201
|
-
TrackUnsubscribed = "trackUnsubscribed",
|
|
202
|
-
TrackSubscriptionFailed = "trackSubscriptionFailed",
|
|
203
|
-
TrackMuted = "trackMuted",
|
|
204
|
-
TrackUnmuted = "trackUnmuted",
|
|
205
|
-
ActiveSpeakersChanged = "activeSpeakersChanged",
|
|
206
|
-
RoomMetadataChanged = "roomMetadataChanged",
|
|
207
|
-
RoomSidChanged = "roomSidChanged",
|
|
208
|
-
ParticipantMetadataChanged = "participantMetadataChanged",
|
|
209
|
-
ParticipantNameChanged = "participantNameChanged",
|
|
210
|
-
ParticipantAttributesChanged = "participantAttributesChanged",
|
|
211
|
-
ParticipantEncryptionStatusChanged = "participantEncryptionStatusChanged",
|
|
212
|
-
ConnectionQualityChanged = "connectionQualityChanged",
|
|
213
|
-
DataReceived = "dataReceived",
|
|
214
|
-
ChatMessage = "chatMessage",
|
|
215
|
-
DtmfReceived = "dtmfReceived",
|
|
216
|
-
EncryptionError = "encryptionError",
|
|
217
|
-
ConnectionStateChanged = "connectionStateChanged",
|
|
218
|
-
Connected = "connected",
|
|
219
|
-
Disconnected = "disconnected",
|
|
220
|
-
Reconnecting = "reconnecting",
|
|
221
|
-
Reconnected = "reconnected",
|
|
222
|
-
RoomUpdated = "roomUpdated",
|
|
223
|
-
Moved = "moved",
|
|
224
|
-
TokenRefreshed = "tokenRefreshed"
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
export { ConnectError, Room, type RoomCallbacks, RoomEvent, type RoomOptions, type RtcConfiguration, defaultRoomOptions, defaultRtcConfiguration };
|
package/dist/room.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"room.d.ts","sourceRoot":"","sources":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cAAc,mBAAmB;IACjC,0BAA0B,+BAA+B;IACzD,sBAAsB,2BAA2B;IACjD,4BAA4B,iCAAiC;IAC7D,kCAAkC,uCAAuC;IACzE,wBAAwB,6BAA6B;IACrD,YAAY,iBAAiB;IAC7B,WAAW,gBAAgB;IAC3B,YAAY,iBAAiB;IAC7B,eAAe,oBAAoB;IACnC,sBAAsB,2BAA2B;IACjD,SAAS,cAAc;IACvB,YAAY,iBAAiB;IAC7B,YAAY,iBAAiB;IAC7B,WAAW,gBAAgB;IAC3B,WAAW,gBAAgB;IAC3B,KAAK,UAAU;IACf,cAAc,mBAAmB;CAClC"}
|
package/dist/room.js
CHANGED
|
@@ -72,6 +72,7 @@ class Room extends EventEmitter {
|
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
74
|
this.processFfiEvent = async (ffiEvent) => {
|
|
75
|
+
var _a, _b;
|
|
75
76
|
if (!this.localParticipant || !this.ffiHandle || !this.info) {
|
|
76
77
|
throw new Error("processFfiEvent called before connect");
|
|
77
78
|
}
|
|
@@ -109,11 +110,21 @@ class Room extends EventEmitter {
|
|
|
109
110
|
}
|
|
110
111
|
} else if (ev.case == "localTrackPublished") {
|
|
111
112
|
const publication = this.localParticipant.trackPublications.get(ev.value.trackSid);
|
|
113
|
+
if (publication == null ? void 0 : publication.track) {
|
|
114
|
+
publication.track.setRoom(this);
|
|
115
|
+
}
|
|
112
116
|
this.emit("localTrackPublished" /* LocalTrackPublished */, publication, this.localParticipant);
|
|
113
117
|
} else if (ev.case == "localTrackUnpublished") {
|
|
114
118
|
const publication = this.localParticipant.trackPublications.get(ev.value.publicationSid);
|
|
119
|
+
const track = publication == null ? void 0 : publication.track;
|
|
120
|
+
if (track) {
|
|
121
|
+
track.setRoom(null);
|
|
122
|
+
}
|
|
115
123
|
this.localParticipant.trackPublications.delete(ev.value.publicationSid);
|
|
116
124
|
this.emit("localTrackUnpublished" /* LocalTrackUnpublished */, publication, this.localParticipant);
|
|
125
|
+
if (track && publication) {
|
|
126
|
+
publication.track = void 0;
|
|
127
|
+
}
|
|
117
128
|
} else if (ev.case == "localTrackRepublished") {
|
|
118
129
|
const value = ev.value;
|
|
119
130
|
const previousSid = value.previousSid;
|
|
@@ -123,6 +134,10 @@ class Room extends EventEmitter {
|
|
|
123
134
|
publication.updateInfo(newInfo);
|
|
124
135
|
this.localParticipant.trackPublications.delete(previousSid);
|
|
125
136
|
this.localParticipant.trackPublications.set(publication.sid, publication);
|
|
137
|
+
if ((_a = publication.track) == null ? void 0 : _a.info) {
|
|
138
|
+
publication.track.info.sid = publication.sid;
|
|
139
|
+
publication.track.setRoom(this);
|
|
140
|
+
}
|
|
126
141
|
this.emit("localTrackRepublished" /* LocalTrackRepublished */, publication, previousSid, this.localParticipant);
|
|
127
142
|
} else {
|
|
128
143
|
log.warn(`RoomEvent.LocalTrackRepublished: previous publication not found: ${previousSid}`);
|
|
@@ -170,6 +185,7 @@ class Room extends EventEmitter {
|
|
|
170
185
|
} else if (trackInfo.kind == TrackKind.KIND_AUDIO) {
|
|
171
186
|
publication.track = new RemoteAudioTrack(ownedTrack);
|
|
172
187
|
}
|
|
188
|
+
(_b = publication.track) == null ? void 0 : _b.setRoom(this);
|
|
173
189
|
this.emit("trackSubscribed" /* TrackSubscribed */, publication.track, publication, participant);
|
|
174
190
|
} catch (e) {
|
|
175
191
|
log.warn(`RoomEvent.TrackSubscribed: ${e.message}`);
|
|
@@ -181,6 +197,7 @@ class Room extends EventEmitter {
|
|
|
181
197
|
ev.value.trackSid
|
|
182
198
|
);
|
|
183
199
|
const track = publication.track;
|
|
200
|
+
track.setRoom(null);
|
|
184
201
|
publication.track = void 0;
|
|
185
202
|
publication.subscribed = false;
|
|
186
203
|
this.emit("trackUnsubscribed" /* TrackUnsubscribed */, track, publication, participant);
|
|
@@ -622,6 +639,7 @@ class Room extends EventEmitter {
|
|
|
622
639
|
// disconnect() both race to get here — whichever wins emits the events,
|
|
623
640
|
// the other is a no-op. A reconnect via connect() clears hasCleanedUp.
|
|
624
641
|
cleanupOnDisconnect(reason = DisconnectReason.CLIENT_INITIATED) {
|
|
642
|
+
var _a, _b;
|
|
625
643
|
if (this.hasCleanedUp) return;
|
|
626
644
|
this.hasCleanedUp = true;
|
|
627
645
|
for (const [, streamController] of this.byteStreamControllers) {
|
|
@@ -638,6 +656,16 @@ class Room extends EventEmitter {
|
|
|
638
656
|
}
|
|
639
657
|
}
|
|
640
658
|
this.textStreamControllers.clear();
|
|
659
|
+
if (this.localParticipant) {
|
|
660
|
+
for (const pub of this.localParticipant.trackPublications.values()) {
|
|
661
|
+
(_a = pub.track) == null ? void 0 : _a.setRoom(null);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
for (const participant of this.remoteParticipants.values()) {
|
|
665
|
+
for (const pub of participant.trackPublications.values()) {
|
|
666
|
+
(_b = pub.track) == null ? void 0 : _b.setRoom(null);
|
|
667
|
+
}
|
|
668
|
+
}
|
|
641
669
|
this.sidPromise = void 0;
|
|
642
670
|
this.disconnectController.abort();
|
|
643
671
|
this.updateConnectionState(ConnectionState.CONN_DISCONNECTED);
|