livekit-client 1.9.2 → 1.9.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/livekit-client.esm.mjs +3251 -3013
- package/dist/livekit-client.esm.mjs.map +1 -1
- package/dist/livekit-client.umd.js +1 -1
- package/dist/livekit-client.umd.js.map +1 -1
- package/dist/src/api/SignalClient.d.ts +98 -98
- package/dist/src/api/SignalClient.d.ts.map +1 -1
- package/dist/src/connectionHelper/ConnectionCheck.d.ts +25 -24
- package/dist/src/connectionHelper/ConnectionCheck.d.ts.map +1 -1
- package/dist/src/connectionHelper/checks/Checker.d.ts +58 -58
- package/dist/src/connectionHelper/checks/publishAudio.d.ts +5 -5
- package/dist/src/connectionHelper/checks/publishVideo.d.ts +5 -5
- package/dist/src/connectionHelper/checks/reconnect.d.ts +5 -5
- package/dist/src/connectionHelper/checks/turn.d.ts +5 -5
- package/dist/src/connectionHelper/checks/webrtc.d.ts +5 -5
- package/dist/src/connectionHelper/checks/websocket.d.ts +5 -5
- package/dist/src/index.d.ts +34 -31
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/logger.d.ts +25 -25
- package/dist/src/options.d.ts +98 -98
- package/dist/src/proto/google/protobuf/timestamp.d.ts +145 -145
- package/dist/src/proto/livekit_models.d.ts +2300 -2300
- package/dist/src/proto/livekit_rtc.d.ts +14032 -14032
- package/dist/src/room/DefaultReconnectPolicy.d.ts +7 -7
- package/dist/src/room/DeviceManager.d.ts +8 -8
- package/dist/src/room/PCTransport.d.ts +37 -37
- package/dist/src/room/PCTransport.d.ts.map +1 -1
- package/dist/src/room/RTCEngine.d.ts +126 -121
- package/dist/src/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/ReconnectPolicy.d.ts +23 -23
- package/dist/src/room/RegionUrlProvider.d.ts +13 -13
- package/dist/src/room/Room.d.ts +232 -232
- package/dist/src/room/defaults.d.ts +7 -7
- package/dist/src/room/defaults.d.ts.map +1 -1
- package/dist/src/room/errors.d.ts +42 -42
- package/dist/src/room/events.d.ts +455 -455
- package/dist/src/room/participant/LocalParticipant.d.ts +170 -170
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/Participant.d.ts +93 -93
- package/dist/src/room/participant/ParticipantTrackPermission.d.ts +25 -25
- package/dist/src/room/participant/RemoteParticipant.d.ts +52 -51
- package/dist/src/room/participant/RemoteParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/publishUtils.d.ts +19 -18
- package/dist/src/room/participant/publishUtils.d.ts.map +1 -1
- package/dist/src/room/stats.d.ts +66 -66
- package/dist/src/room/timers.d.ts +12 -12
- package/dist/src/room/track/LocalAudioTrack.d.ts +24 -24
- package/dist/src/room/track/LocalAudioTrack.d.ts.map +1 -1
- package/dist/src/room/track/LocalTrack.d.ts +43 -43
- package/dist/src/room/track/LocalTrackPublication.d.ts +37 -37
- package/dist/src/room/track/LocalVideoTrack.d.ts +53 -53
- package/dist/src/room/track/LocalVideoTrack.d.ts.map +1 -1
- package/dist/src/room/track/RemoteAudioTrack.d.ts +52 -52
- package/dist/src/room/track/RemoteAudioTrack.d.ts.map +1 -1
- package/dist/src/room/track/RemoteTrack.d.ts +14 -14
- package/dist/src/room/track/RemoteTrackPublication.d.ts +60 -60
- package/dist/src/room/track/RemoteVideoTrack.d.ts +52 -52
- package/dist/src/room/track/RemoteVideoTrack.d.ts.map +1 -1
- package/dist/src/room/track/Track.d.ts +124 -124
- package/dist/src/room/track/TrackPublication.d.ts +67 -67
- package/dist/src/room/track/create.d.ts +23 -23
- package/dist/src/room/track/create.d.ts.map +1 -1
- package/dist/src/room/track/options.d.ts +255 -247
- package/dist/src/room/track/options.d.ts.map +1 -1
- package/dist/src/room/track/types.d.ts +22 -22
- package/dist/src/room/track/utils.d.ts +13 -13
- package/dist/src/room/types.d.ts +25 -25
- package/dist/src/room/utils.d.ts +86 -85
- package/dist/src/room/utils.d.ts.map +1 -1
- package/dist/src/test/MockMediaStreamTrack.d.ts +25 -25
- package/dist/src/test/mocks.d.ts +10 -10
- package/dist/src/version.d.ts +2 -2
- package/dist/ts4.2/src/connectionHelper/ConnectionCheck.d.ts +2 -1
- package/dist/ts4.2/src/index.d.ts +8 -6
- package/dist/ts4.2/src/room/PCTransport.d.ts +1 -1
- package/dist/ts4.2/src/room/RTCEngine.d.ts +6 -1
- package/dist/ts4.2/src/room/defaults.d.ts +1 -1
- package/dist/ts4.2/src/room/participant/LocalParticipant.d.ts +4 -4
- package/dist/ts4.2/src/room/participant/RemoteParticipant.d.ts +2 -1
- package/dist/ts4.2/src/room/participant/publishUtils.d.ts +2 -1
- package/dist/ts4.2/src/room/track/LocalAudioTrack.d.ts +1 -1
- package/dist/ts4.2/src/room/track/LocalVideoTrack.d.ts +1 -1
- package/dist/ts4.2/src/room/track/RemoteAudioTrack.d.ts +1 -1
- package/dist/ts4.2/src/room/track/create.d.ts +1 -1
- package/dist/ts4.2/src/room/track/options.d.ts +10 -2
- package/dist/ts4.2/src/room/utils.d.ts +1 -0
- package/package.json +12 -12
- package/src/api/SignalClient.ts +10 -11
- package/src/connectionHelper/ConnectionCheck.ts +2 -1
- package/src/index.ts +13 -8
- package/src/room/PCTransport.ts +9 -5
- package/src/room/RTCEngine.ts +10 -3
- package/src/room/defaults.ts +6 -4
- package/src/room/participant/LocalParticipant.ts +10 -9
- package/src/room/participant/RemoteParticipant.ts +2 -1
- package/src/room/participant/publishUtils.ts +7 -5
- package/src/room/track/LocalAudioTrack.ts +2 -1
- package/src/room/track/LocalVideoTrack.ts +3 -2
- package/src/room/track/RemoteAudioTrack.ts +2 -1
- package/src/room/track/RemoteVideoTrack.ts +4 -8
- package/src/room/track/create.ts +2 -2
- package/src/room/track/options.ts +23 -7
- package/src/room/utils.ts +15 -2
package/dist/src/room/Room.d.ts
CHANGED
@@ -1,233 +1,233 @@
|
|
1
|
-
import type TypedEmitter from 'typed-emitter';
|
2
|
-
import type { InternalRoomOptions, RoomConnectOptions, RoomOptions } from '../options';
|
3
|
-
import { DataPacket_Kind, DisconnectReason, ParticipantPermission } from '../proto/livekit_models';
|
4
|
-
import RTCEngine from './RTCEngine';
|
5
|
-
import LocalParticipant from './participant/LocalParticipant';
|
6
|
-
import type Participant from './participant/Participant';
|
7
|
-
import type { ConnectionQuality } from './participant/Participant';
|
8
|
-
import RemoteParticipant from './participant/RemoteParticipant';
|
9
|
-
import LocalTrackPublication from './track/LocalTrackPublication';
|
10
|
-
import type RemoteTrack from './track/RemoteTrack';
|
11
|
-
import RemoteTrackPublication from './track/RemoteTrackPublication';
|
12
|
-
import { Track } from './track/Track';
|
13
|
-
import type { TrackPublication } from './track/TrackPublication';
|
14
|
-
import type { SimulationOptions, SimulationScenario } from './types';
|
15
|
-
export declare enum ConnectionState {
|
16
|
-
Disconnected = "disconnected",
|
17
|
-
Connecting = "connecting",
|
18
|
-
Connected = "connected",
|
19
|
-
Reconnecting = "reconnecting"
|
20
|
-
}
|
21
|
-
/** @deprecated RoomState has been renamed to [[ConnectionState]] */
|
22
|
-
export declare const RoomState: typeof ConnectionState;
|
23
|
-
declare const Room_base: new () => TypedEmitter<RoomEventCallbacks>;
|
24
|
-
/**
|
25
|
-
* In LiveKit, a room is the logical grouping for a list of participants.
|
26
|
-
* Participants in a room can publish tracks, and subscribe to others' tracks.
|
27
|
-
*
|
28
|
-
* a Room fires [[RoomEvent | RoomEvents]].
|
29
|
-
*
|
30
|
-
* @noInheritDoc
|
31
|
-
*/
|
32
|
-
declare class Room extends Room_base {
|
33
|
-
state: ConnectionState;
|
34
|
-
/** map of sid: [[RemoteParticipant]] */
|
35
|
-
participants: Map<string, RemoteParticipant>;
|
36
|
-
/**
|
37
|
-
* list of participants that are actively speaking. when this changes
|
38
|
-
* a [[RoomEvent.ActiveSpeakersChanged]] event is fired
|
39
|
-
*/
|
40
|
-
activeSpeakers: Participant[];
|
41
|
-
/** @internal */
|
42
|
-
engine: RTCEngine;
|
43
|
-
/** the current participant */
|
44
|
-
localParticipant: LocalParticipant;
|
45
|
-
/** options of room */
|
46
|
-
options: InternalRoomOptions;
|
47
|
-
private roomInfo?;
|
48
|
-
private identityToSid;
|
49
|
-
/** connect options of room */
|
50
|
-
private connOptions?;
|
51
|
-
private audioEnabled;
|
52
|
-
private audioContext?;
|
53
|
-
/** used for aborting pending connections to a LiveKit server */
|
54
|
-
private abortController?;
|
55
|
-
/** future holding client initiated connection attempt */
|
56
|
-
private connectFuture?;
|
57
|
-
private disconnectLock;
|
58
|
-
private cachedParticipantSids;
|
59
|
-
private connectionReconcileInterval?;
|
60
|
-
/**
|
61
|
-
* Creates a new Room, the primary construct for a LiveKit session.
|
62
|
-
* @param options
|
63
|
-
*/
|
64
|
-
constructor(options?: RoomOptions);
|
65
|
-
/**
|
66
|
-
* if the current room has a participant with `recorder: true` in its JWT grant
|
67
|
-
**/
|
68
|
-
get isRecording(): boolean;
|
69
|
-
/** server assigned unique room id */
|
70
|
-
get sid(): string;
|
71
|
-
/** user assigned name, derived from JWT token */
|
72
|
-
get name(): string;
|
73
|
-
/** room metadata */
|
74
|
-
get metadata(): string | undefined;
|
75
|
-
get numParticipants(): number;
|
76
|
-
get numPublishers(): number;
|
77
|
-
private maybeCreateEngine;
|
78
|
-
/**
|
79
|
-
* getLocalDevices abstracts navigator.mediaDevices.enumerateDevices.
|
80
|
-
* In particular, it handles Chrome's unique behavior of creating `default`
|
81
|
-
* devices. When encountered, it'll be removed from the list of devices.
|
82
|
-
* The actual default device will be placed at top.
|
83
|
-
* @param kind
|
84
|
-
* @returns a list of available local devices
|
85
|
-
*/
|
86
|
-
static getLocalDevices(kind?: MediaDeviceKind, requestPermissions?: boolean): Promise<MediaDeviceInfo[]>;
|
87
|
-
/**
|
88
|
-
* prepares the connection to the livekit server by sending a HEAD request in order to
|
89
|
-
* 1. speed up DNS resolution
|
90
|
-
* 2. speed up TLS setup
|
91
|
-
* on the actual connection request
|
92
|
-
* throws an error if server is not reachable after the request timeout
|
93
|
-
* @experimental
|
94
|
-
*/
|
95
|
-
prepareConnection(url: string): Promise<void>;
|
96
|
-
connect: (url: string, token: string, opts?: RoomConnectOptions) => Promise<void>;
|
97
|
-
private connectSignal;
|
98
|
-
private applyJoinResponse;
|
99
|
-
private attemptConnection;
|
100
|
-
/**
|
101
|
-
* disconnects the room, emits [[RoomEvent.Disconnected]]
|
102
|
-
*/
|
103
|
-
disconnect: (stopTracks?: boolean) => Promise<void>;
|
104
|
-
/**
|
105
|
-
* retrieves a participant by identity
|
106
|
-
* @param identity
|
107
|
-
* @returns
|
108
|
-
*/
|
109
|
-
getParticipantByIdentity(identity: string): Participant | undefined;
|
110
|
-
private clearConnectionFutures;
|
111
|
-
/**
|
112
|
-
* @internal for testing
|
113
|
-
*/
|
114
|
-
simulateScenario(scenario: SimulationScenario): Promise<void>;
|
115
|
-
private onPageLeave;
|
116
|
-
/**
|
117
|
-
* Browsers have different policies regarding audio playback. Most requiring
|
118
|
-
* some form of user interaction (click/tap/etc).
|
119
|
-
* In those cases, audio will be silent until a click/tap triggering one of the following
|
120
|
-
* - `startAudio`
|
121
|
-
* - `getUserMedia`
|
122
|
-
*/
|
123
|
-
startAudio(): Promise<void>;
|
124
|
-
/**
|
125
|
-
* Returns true if audio playback is enabled
|
126
|
-
*/
|
127
|
-
get canPlaybackAudio(): boolean;
|
128
|
-
/**
|
129
|
-
* Returns the active audio output device used in this room.
|
130
|
-
*
|
131
|
-
* Note: to get the active `audioinput` or `videoinput` use [[LocalTrack.getDeviceId()]]
|
132
|
-
*
|
133
|
-
* @return the previously successfully set audio output device ID or an empty string if the default device is used.
|
134
|
-
*/
|
135
|
-
getActiveAudioOutputDevice(): string;
|
136
|
-
/**
|
137
|
-
* Switches all active devices used in this room to the given device.
|
138
|
-
*
|
139
|
-
* Note: setting AudioOutput is not supported on some browsers. See [setSinkId](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/setSinkId#browser_compatibility)
|
140
|
-
*
|
141
|
-
* @param kind use `videoinput` for camera track,
|
142
|
-
* `audioinput` for microphone track,
|
143
|
-
* `audiooutput` to set speaker for all incoming audio tracks
|
144
|
-
* @param deviceId
|
145
|
-
*/
|
146
|
-
switchActiveDevice(kind: MediaDeviceKind, deviceId: string, exact?: boolean): Promise<void>;
|
147
|
-
private setupLocalParticipantEvents;
|
148
|
-
private recreateEngine;
|
149
|
-
private onTrackAdded;
|
150
|
-
private handleRestarting;
|
151
|
-
private handleSignalRestarted;
|
152
|
-
private handleDisconnect;
|
153
|
-
private handleParticipantUpdates;
|
154
|
-
private handleParticipantDisconnected;
|
155
|
-
private handleActiveSpeakersUpdate;
|
156
|
-
private handleSpeakersChanged;
|
157
|
-
private handleStreamStateUpdate;
|
158
|
-
private handleSubscriptionPermissionUpdate;
|
159
|
-
private handleDataPacket;
|
160
|
-
private handleAudioPlaybackStarted;
|
161
|
-
private handleAudioPlaybackFailed;
|
162
|
-
private handleDeviceChange;
|
163
|
-
private handleRoomUpdate;
|
164
|
-
private handleConnectionQualityUpdate;
|
165
|
-
private acquireAudioContext;
|
166
|
-
private createParticipant;
|
167
|
-
private getOrCreateParticipant;
|
168
|
-
private sendSyncState;
|
169
|
-
/**
|
170
|
-
* After resuming, we'll need to notify the server of the current
|
171
|
-
* subscription settings.
|
172
|
-
*/
|
173
|
-
private updateSubscriptions;
|
174
|
-
private registerConnectionReconcile;
|
175
|
-
private clearConnectionReconcile;
|
176
|
-
private setAndEmitConnectionState;
|
177
|
-
private emitWhenConnected;
|
178
|
-
private onLocalParticipantMetadataChanged;
|
179
|
-
private onLocalParticipantNameChanged;
|
180
|
-
private onLocalTrackMuted;
|
181
|
-
private onLocalTrackUnmuted;
|
182
|
-
private onLocalTrackPublished;
|
183
|
-
private onLocalTrackUnpublished;
|
184
|
-
private onLocalConnectionQualityChanged;
|
185
|
-
private onMediaDevicesError;
|
186
|
-
private onLocalParticipantPermissionsChanged;
|
187
|
-
/**
|
188
|
-
* Allows to populate a room with simulated participants.
|
189
|
-
* No actual connection to a server will be established, all state is
|
190
|
-
* @experimental
|
191
|
-
*/
|
192
|
-
simulateParticipants(options: SimulationOptions): Promise<void>;
|
193
|
-
emit<E extends keyof RoomEventCallbacks>(event: E, ...args: Parameters<RoomEventCallbacks[E]>): boolean;
|
194
|
-
}
|
195
|
-
export default Room;
|
196
|
-
export type RoomEventCallbacks = {
|
197
|
-
connected: () => void;
|
198
|
-
reconnecting: () => void;
|
199
|
-
reconnected: () => void;
|
200
|
-
disconnected: (reason?: DisconnectReason) => void;
|
201
|
-
/** @deprecated stateChanged has been renamed to connectionStateChanged */
|
202
|
-
stateChanged: (state: ConnectionState) => void;
|
203
|
-
connectionStateChanged: (state: ConnectionState) => void;
|
204
|
-
mediaDevicesChanged: () => void;
|
205
|
-
participantConnected: (participant: RemoteParticipant) => void;
|
206
|
-
participantDisconnected: (participant: RemoteParticipant) => void;
|
207
|
-
trackPublished: (publication: RemoteTrackPublication, participant: RemoteParticipant) => void;
|
208
|
-
trackSubscribed: (track: RemoteTrack, publication: RemoteTrackPublication, participant: RemoteParticipant) => void;
|
209
|
-
trackSubscriptionFailed: (trackSid: string, participant: RemoteParticipant) => void;
|
210
|
-
trackUnpublished: (publication: RemoteTrackPublication, participant: RemoteParticipant) => void;
|
211
|
-
trackUnsubscribed: (track: RemoteTrack, publication: RemoteTrackPublication, participant: RemoteParticipant) => void;
|
212
|
-
trackMuted: (publication: TrackPublication, participant: Participant) => void;
|
213
|
-
trackUnmuted: (publication: TrackPublication, participant: Participant) => void;
|
214
|
-
localTrackPublished: (publication: LocalTrackPublication, participant: LocalParticipant) => void;
|
215
|
-
localTrackUnpublished: (publication: LocalTrackPublication, participant: LocalParticipant) => void;
|
216
|
-
localAudioSilenceDetected: (publication: LocalTrackPublication) => void;
|
217
|
-
participantMetadataChanged: (metadata: string | undefined, participant: RemoteParticipant | LocalParticipant) => void;
|
218
|
-
participantNameChanged: (name: string, participant: RemoteParticipant | LocalParticipant) => void;
|
219
|
-
participantPermissionsChanged: (prevPermissions: ParticipantPermission | undefined, participant: RemoteParticipant | LocalParticipant) => void;
|
220
|
-
activeSpeakersChanged: (speakers: Array<Participant>) => void;
|
221
|
-
roomMetadataChanged: (metadata: string) => void;
|
222
|
-
dataReceived: (payload: Uint8Array, participant?: RemoteParticipant, kind?: DataPacket_Kind, topic?: string) => void;
|
223
|
-
connectionQualityChanged: (quality: ConnectionQuality, participant: Participant) => void;
|
224
|
-
mediaDevicesError: (error: Error) => void;
|
225
|
-
trackStreamStateChanged: (publication: RemoteTrackPublication, streamState: Track.StreamState, participant: RemoteParticipant) => void;
|
226
|
-
trackSubscriptionPermissionChanged: (publication: RemoteTrackPublication, status: TrackPublication.PermissionStatus, participant: RemoteParticipant) => void;
|
227
|
-
trackSubscriptionStatusChanged: (publication: RemoteTrackPublication, status: TrackPublication.SubscriptionStatus, participant: RemoteParticipant) => void;
|
228
|
-
audioPlaybackChanged: (playing: boolean) => void;
|
229
|
-
signalConnected: () => void;
|
230
|
-
recordingStatusChanged: (recording: boolean) => void;
|
231
|
-
dcBufferStatusChanged: (isLow: boolean, kind: DataPacket_Kind) => void;
|
232
|
-
};
|
1
|
+
import type TypedEmitter from 'typed-emitter';
|
2
|
+
import type { InternalRoomOptions, RoomConnectOptions, RoomOptions } from '../options';
|
3
|
+
import { DataPacket_Kind, DisconnectReason, ParticipantPermission } from '../proto/livekit_models';
|
4
|
+
import RTCEngine from './RTCEngine';
|
5
|
+
import LocalParticipant from './participant/LocalParticipant';
|
6
|
+
import type Participant from './participant/Participant';
|
7
|
+
import type { ConnectionQuality } from './participant/Participant';
|
8
|
+
import RemoteParticipant from './participant/RemoteParticipant';
|
9
|
+
import LocalTrackPublication from './track/LocalTrackPublication';
|
10
|
+
import type RemoteTrack from './track/RemoteTrack';
|
11
|
+
import RemoteTrackPublication from './track/RemoteTrackPublication';
|
12
|
+
import { Track } from './track/Track';
|
13
|
+
import type { TrackPublication } from './track/TrackPublication';
|
14
|
+
import type { SimulationOptions, SimulationScenario } from './types';
|
15
|
+
export declare enum ConnectionState {
|
16
|
+
Disconnected = "disconnected",
|
17
|
+
Connecting = "connecting",
|
18
|
+
Connected = "connected",
|
19
|
+
Reconnecting = "reconnecting"
|
20
|
+
}
|
21
|
+
/** @deprecated RoomState has been renamed to [[ConnectionState]] */
|
22
|
+
export declare const RoomState: typeof ConnectionState;
|
23
|
+
declare const Room_base: new () => TypedEmitter<RoomEventCallbacks>;
|
24
|
+
/**
|
25
|
+
* In LiveKit, a room is the logical grouping for a list of participants.
|
26
|
+
* Participants in a room can publish tracks, and subscribe to others' tracks.
|
27
|
+
*
|
28
|
+
* a Room fires [[RoomEvent | RoomEvents]].
|
29
|
+
*
|
30
|
+
* @noInheritDoc
|
31
|
+
*/
|
32
|
+
declare class Room extends Room_base {
|
33
|
+
state: ConnectionState;
|
34
|
+
/** map of sid: [[RemoteParticipant]] */
|
35
|
+
participants: Map<string, RemoteParticipant>;
|
36
|
+
/**
|
37
|
+
* list of participants that are actively speaking. when this changes
|
38
|
+
* a [[RoomEvent.ActiveSpeakersChanged]] event is fired
|
39
|
+
*/
|
40
|
+
activeSpeakers: Participant[];
|
41
|
+
/** @internal */
|
42
|
+
engine: RTCEngine;
|
43
|
+
/** the current participant */
|
44
|
+
localParticipant: LocalParticipant;
|
45
|
+
/** options of room */
|
46
|
+
options: InternalRoomOptions;
|
47
|
+
private roomInfo?;
|
48
|
+
private identityToSid;
|
49
|
+
/** connect options of room */
|
50
|
+
private connOptions?;
|
51
|
+
private audioEnabled;
|
52
|
+
private audioContext?;
|
53
|
+
/** used for aborting pending connections to a LiveKit server */
|
54
|
+
private abortController?;
|
55
|
+
/** future holding client initiated connection attempt */
|
56
|
+
private connectFuture?;
|
57
|
+
private disconnectLock;
|
58
|
+
private cachedParticipantSids;
|
59
|
+
private connectionReconcileInterval?;
|
60
|
+
/**
|
61
|
+
* Creates a new Room, the primary construct for a LiveKit session.
|
62
|
+
* @param options
|
63
|
+
*/
|
64
|
+
constructor(options?: RoomOptions);
|
65
|
+
/**
|
66
|
+
* if the current room has a participant with `recorder: true` in its JWT grant
|
67
|
+
**/
|
68
|
+
get isRecording(): boolean;
|
69
|
+
/** server assigned unique room id */
|
70
|
+
get sid(): string;
|
71
|
+
/** user assigned name, derived from JWT token */
|
72
|
+
get name(): string;
|
73
|
+
/** room metadata */
|
74
|
+
get metadata(): string | undefined;
|
75
|
+
get numParticipants(): number;
|
76
|
+
get numPublishers(): number;
|
77
|
+
private maybeCreateEngine;
|
78
|
+
/**
|
79
|
+
* getLocalDevices abstracts navigator.mediaDevices.enumerateDevices.
|
80
|
+
* In particular, it handles Chrome's unique behavior of creating `default`
|
81
|
+
* devices. When encountered, it'll be removed from the list of devices.
|
82
|
+
* The actual default device will be placed at top.
|
83
|
+
* @param kind
|
84
|
+
* @returns a list of available local devices
|
85
|
+
*/
|
86
|
+
static getLocalDevices(kind?: MediaDeviceKind, requestPermissions?: boolean): Promise<MediaDeviceInfo[]>;
|
87
|
+
/**
|
88
|
+
* prepares the connection to the livekit server by sending a HEAD request in order to
|
89
|
+
* 1. speed up DNS resolution
|
90
|
+
* 2. speed up TLS setup
|
91
|
+
* on the actual connection request
|
92
|
+
* throws an error if server is not reachable after the request timeout
|
93
|
+
* @experimental
|
94
|
+
*/
|
95
|
+
prepareConnection(url: string): Promise<void>;
|
96
|
+
connect: (url: string, token: string, opts?: RoomConnectOptions) => Promise<void>;
|
97
|
+
private connectSignal;
|
98
|
+
private applyJoinResponse;
|
99
|
+
private attemptConnection;
|
100
|
+
/**
|
101
|
+
* disconnects the room, emits [[RoomEvent.Disconnected]]
|
102
|
+
*/
|
103
|
+
disconnect: (stopTracks?: boolean) => Promise<void>;
|
104
|
+
/**
|
105
|
+
* retrieves a participant by identity
|
106
|
+
* @param identity
|
107
|
+
* @returns
|
108
|
+
*/
|
109
|
+
getParticipantByIdentity(identity: string): Participant | undefined;
|
110
|
+
private clearConnectionFutures;
|
111
|
+
/**
|
112
|
+
* @internal for testing
|
113
|
+
*/
|
114
|
+
simulateScenario(scenario: SimulationScenario): Promise<void>;
|
115
|
+
private onPageLeave;
|
116
|
+
/**
|
117
|
+
* Browsers have different policies regarding audio playback. Most requiring
|
118
|
+
* some form of user interaction (click/tap/etc).
|
119
|
+
* In those cases, audio will be silent until a click/tap triggering one of the following
|
120
|
+
* - `startAudio`
|
121
|
+
* - `getUserMedia`
|
122
|
+
*/
|
123
|
+
startAudio(): Promise<void>;
|
124
|
+
/**
|
125
|
+
* Returns true if audio playback is enabled
|
126
|
+
*/
|
127
|
+
get canPlaybackAudio(): boolean;
|
128
|
+
/**
|
129
|
+
* Returns the active audio output device used in this room.
|
130
|
+
*
|
131
|
+
* Note: to get the active `audioinput` or `videoinput` use [[LocalTrack.getDeviceId()]]
|
132
|
+
*
|
133
|
+
* @return the previously successfully set audio output device ID or an empty string if the default device is used.
|
134
|
+
*/
|
135
|
+
getActiveAudioOutputDevice(): string;
|
136
|
+
/**
|
137
|
+
* Switches all active devices used in this room to the given device.
|
138
|
+
*
|
139
|
+
* Note: setting AudioOutput is not supported on some browsers. See [setSinkId](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/setSinkId#browser_compatibility)
|
140
|
+
*
|
141
|
+
* @param kind use `videoinput` for camera track,
|
142
|
+
* `audioinput` for microphone track,
|
143
|
+
* `audiooutput` to set speaker for all incoming audio tracks
|
144
|
+
* @param deviceId
|
145
|
+
*/
|
146
|
+
switchActiveDevice(kind: MediaDeviceKind, deviceId: string, exact?: boolean): Promise<void>;
|
147
|
+
private setupLocalParticipantEvents;
|
148
|
+
private recreateEngine;
|
149
|
+
private onTrackAdded;
|
150
|
+
private handleRestarting;
|
151
|
+
private handleSignalRestarted;
|
152
|
+
private handleDisconnect;
|
153
|
+
private handleParticipantUpdates;
|
154
|
+
private handleParticipantDisconnected;
|
155
|
+
private handleActiveSpeakersUpdate;
|
156
|
+
private handleSpeakersChanged;
|
157
|
+
private handleStreamStateUpdate;
|
158
|
+
private handleSubscriptionPermissionUpdate;
|
159
|
+
private handleDataPacket;
|
160
|
+
private handleAudioPlaybackStarted;
|
161
|
+
private handleAudioPlaybackFailed;
|
162
|
+
private handleDeviceChange;
|
163
|
+
private handleRoomUpdate;
|
164
|
+
private handleConnectionQualityUpdate;
|
165
|
+
private acquireAudioContext;
|
166
|
+
private createParticipant;
|
167
|
+
private getOrCreateParticipant;
|
168
|
+
private sendSyncState;
|
169
|
+
/**
|
170
|
+
* After resuming, we'll need to notify the server of the current
|
171
|
+
* subscription settings.
|
172
|
+
*/
|
173
|
+
private updateSubscriptions;
|
174
|
+
private registerConnectionReconcile;
|
175
|
+
private clearConnectionReconcile;
|
176
|
+
private setAndEmitConnectionState;
|
177
|
+
private emitWhenConnected;
|
178
|
+
private onLocalParticipantMetadataChanged;
|
179
|
+
private onLocalParticipantNameChanged;
|
180
|
+
private onLocalTrackMuted;
|
181
|
+
private onLocalTrackUnmuted;
|
182
|
+
private onLocalTrackPublished;
|
183
|
+
private onLocalTrackUnpublished;
|
184
|
+
private onLocalConnectionQualityChanged;
|
185
|
+
private onMediaDevicesError;
|
186
|
+
private onLocalParticipantPermissionsChanged;
|
187
|
+
/**
|
188
|
+
* Allows to populate a room with simulated participants.
|
189
|
+
* No actual connection to a server will be established, all state is
|
190
|
+
* @experimental
|
191
|
+
*/
|
192
|
+
simulateParticipants(options: SimulationOptions): Promise<void>;
|
193
|
+
emit<E extends keyof RoomEventCallbacks>(event: E, ...args: Parameters<RoomEventCallbacks[E]>): boolean;
|
194
|
+
}
|
195
|
+
export default Room;
|
196
|
+
export type RoomEventCallbacks = {
|
197
|
+
connected: () => void;
|
198
|
+
reconnecting: () => void;
|
199
|
+
reconnected: () => void;
|
200
|
+
disconnected: (reason?: DisconnectReason) => void;
|
201
|
+
/** @deprecated stateChanged has been renamed to connectionStateChanged */
|
202
|
+
stateChanged: (state: ConnectionState) => void;
|
203
|
+
connectionStateChanged: (state: ConnectionState) => void;
|
204
|
+
mediaDevicesChanged: () => void;
|
205
|
+
participantConnected: (participant: RemoteParticipant) => void;
|
206
|
+
participantDisconnected: (participant: RemoteParticipant) => void;
|
207
|
+
trackPublished: (publication: RemoteTrackPublication, participant: RemoteParticipant) => void;
|
208
|
+
trackSubscribed: (track: RemoteTrack, publication: RemoteTrackPublication, participant: RemoteParticipant) => void;
|
209
|
+
trackSubscriptionFailed: (trackSid: string, participant: RemoteParticipant) => void;
|
210
|
+
trackUnpublished: (publication: RemoteTrackPublication, participant: RemoteParticipant) => void;
|
211
|
+
trackUnsubscribed: (track: RemoteTrack, publication: RemoteTrackPublication, participant: RemoteParticipant) => void;
|
212
|
+
trackMuted: (publication: TrackPublication, participant: Participant) => void;
|
213
|
+
trackUnmuted: (publication: TrackPublication, participant: Participant) => void;
|
214
|
+
localTrackPublished: (publication: LocalTrackPublication, participant: LocalParticipant) => void;
|
215
|
+
localTrackUnpublished: (publication: LocalTrackPublication, participant: LocalParticipant) => void;
|
216
|
+
localAudioSilenceDetected: (publication: LocalTrackPublication) => void;
|
217
|
+
participantMetadataChanged: (metadata: string | undefined, participant: RemoteParticipant | LocalParticipant) => void;
|
218
|
+
participantNameChanged: (name: string, participant: RemoteParticipant | LocalParticipant) => void;
|
219
|
+
participantPermissionsChanged: (prevPermissions: ParticipantPermission | undefined, participant: RemoteParticipant | LocalParticipant) => void;
|
220
|
+
activeSpeakersChanged: (speakers: Array<Participant>) => void;
|
221
|
+
roomMetadataChanged: (metadata: string) => void;
|
222
|
+
dataReceived: (payload: Uint8Array, participant?: RemoteParticipant, kind?: DataPacket_Kind, topic?: string) => void;
|
223
|
+
connectionQualityChanged: (quality: ConnectionQuality, participant: Participant) => void;
|
224
|
+
mediaDevicesError: (error: Error) => void;
|
225
|
+
trackStreamStateChanged: (publication: RemoteTrackPublication, streamState: Track.StreamState, participant: RemoteParticipant) => void;
|
226
|
+
trackSubscriptionPermissionChanged: (publication: RemoteTrackPublication, status: TrackPublication.PermissionStatus, participant: RemoteParticipant) => void;
|
227
|
+
trackSubscriptionStatusChanged: (publication: RemoteTrackPublication, status: TrackPublication.SubscriptionStatus, participant: RemoteParticipant) => void;
|
228
|
+
audioPlaybackChanged: (playing: boolean) => void;
|
229
|
+
signalConnected: () => void;
|
230
|
+
recordingStatusChanged: (recording: boolean) => void;
|
231
|
+
dcBufferStatusChanged: (isLow: boolean, kind: DataPacket_Kind) => void;
|
232
|
+
};
|
233
233
|
//# sourceMappingURL=Room.d.ts.map
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import type { InternalRoomConnectOptions, InternalRoomOptions } from '../options';
|
2
|
-
import { AudioCaptureOptions, TrackPublishDefaults, VideoCaptureOptions } from './track/options';
|
3
|
-
export declare const publishDefaults: TrackPublishDefaults;
|
4
|
-
export declare const audioDefaults: AudioCaptureOptions;
|
5
|
-
export declare const videoDefaults: VideoCaptureOptions;
|
6
|
-
export declare const roomOptionDefaults: InternalRoomOptions;
|
7
|
-
export declare const roomConnectOptionDefaults: InternalRoomConnectOptions;
|
1
|
+
import type { InternalRoomConnectOptions, InternalRoomOptions } from '../options';
|
2
|
+
import type { AudioCaptureOptions, TrackPublishDefaults, VideoCaptureOptions } from './track/options';
|
3
|
+
export declare const publishDefaults: TrackPublishDefaults;
|
4
|
+
export declare const audioDefaults: AudioCaptureOptions;
|
5
|
+
export declare const videoDefaults: VideoCaptureOptions;
|
6
|
+
export declare const roomOptionDefaults: InternalRoomOptions;
|
7
|
+
export declare const roomConnectOptionDefaults: InternalRoomConnectOptions;
|
8
8
|
//# sourceMappingURL=defaults.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/room/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/room/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGlF,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,eAAe,EAAE,oBAcpB,CAAC;AAEX,eAAO,MAAM,aAAa,EAAE,mBAI3B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,mBAE3B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,mBAOvB,CAAC;AAEX,eAAO,MAAM,yBAAyB,EAAE,0BAI9B,CAAC"}
|
@@ -1,43 +1,43 @@
|
|
1
|
-
export declare class LivekitError extends Error {
|
2
|
-
code: number;
|
3
|
-
constructor(code: number, message?: string);
|
4
|
-
}
|
5
|
-
export declare const enum ConnectionErrorReason {
|
6
|
-
NotAllowed = 0,
|
7
|
-
ServerUnreachable = 1,
|
8
|
-
InternalError = 2,
|
9
|
-
Cancelled = 3
|
10
|
-
}
|
11
|
-
export declare class ConnectionError extends LivekitError {
|
12
|
-
status?: number;
|
13
|
-
reason?: ConnectionErrorReason;
|
14
|
-
constructor(message?: string, reason?: ConnectionErrorReason, status?: number);
|
15
|
-
}
|
16
|
-
export declare class DeviceUnsupportedError extends LivekitError {
|
17
|
-
constructor(message?: string);
|
18
|
-
}
|
19
|
-
export declare class TrackInvalidError extends LivekitError {
|
20
|
-
constructor(message?: string);
|
21
|
-
}
|
22
|
-
export declare class UnsupportedServer extends LivekitError {
|
23
|
-
constructor(message?: string);
|
24
|
-
}
|
25
|
-
export declare class UnexpectedConnectionState extends LivekitError {
|
26
|
-
constructor(message?: string);
|
27
|
-
}
|
28
|
-
export declare class NegotiationError extends LivekitError {
|
29
|
-
constructor(message?: string);
|
30
|
-
}
|
31
|
-
export declare class PublishDataError extends LivekitError {
|
32
|
-
constructor(message?: string);
|
33
|
-
}
|
34
|
-
export declare enum MediaDeviceFailure {
|
35
|
-
PermissionDenied = "PermissionDenied",
|
36
|
-
NotFound = "NotFound",
|
37
|
-
DeviceInUse = "DeviceInUse",
|
38
|
-
Other = "Other"
|
39
|
-
}
|
40
|
-
export declare namespace MediaDeviceFailure {
|
41
|
-
function getFailure(error: any): MediaDeviceFailure | undefined;
|
42
|
-
}
|
1
|
+
export declare class LivekitError extends Error {
|
2
|
+
code: number;
|
3
|
+
constructor(code: number, message?: string);
|
4
|
+
}
|
5
|
+
export declare const enum ConnectionErrorReason {
|
6
|
+
NotAllowed = 0,
|
7
|
+
ServerUnreachable = 1,
|
8
|
+
InternalError = 2,
|
9
|
+
Cancelled = 3
|
10
|
+
}
|
11
|
+
export declare class ConnectionError extends LivekitError {
|
12
|
+
status?: number;
|
13
|
+
reason?: ConnectionErrorReason;
|
14
|
+
constructor(message?: string, reason?: ConnectionErrorReason, status?: number);
|
15
|
+
}
|
16
|
+
export declare class DeviceUnsupportedError extends LivekitError {
|
17
|
+
constructor(message?: string);
|
18
|
+
}
|
19
|
+
export declare class TrackInvalidError extends LivekitError {
|
20
|
+
constructor(message?: string);
|
21
|
+
}
|
22
|
+
export declare class UnsupportedServer extends LivekitError {
|
23
|
+
constructor(message?: string);
|
24
|
+
}
|
25
|
+
export declare class UnexpectedConnectionState extends LivekitError {
|
26
|
+
constructor(message?: string);
|
27
|
+
}
|
28
|
+
export declare class NegotiationError extends LivekitError {
|
29
|
+
constructor(message?: string);
|
30
|
+
}
|
31
|
+
export declare class PublishDataError extends LivekitError {
|
32
|
+
constructor(message?: string);
|
33
|
+
}
|
34
|
+
export declare enum MediaDeviceFailure {
|
35
|
+
PermissionDenied = "PermissionDenied",
|
36
|
+
NotFound = "NotFound",
|
37
|
+
DeviceInUse = "DeviceInUse",
|
38
|
+
Other = "Other"
|
39
|
+
}
|
40
|
+
export declare namespace MediaDeviceFailure {
|
41
|
+
function getFailure(error: any): MediaDeviceFailure | undefined;
|
42
|
+
}
|
43
43
|
//# sourceMappingURL=errors.d.ts.map
|