livekit-client 0.13.0 → 0.13.4
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/README.md +76 -45
- package/dist/connect.d.ts +4 -6
- package/dist/connect.js +19 -29
- package/dist/connect.js.map +1 -1
- package/dist/options.d.ts +19 -15
- package/dist/options.js.map +1 -1
- package/dist/room/DeviceManager.d.ts +0 -3
- package/dist/room/DeviceManager.js +0 -15
- package/dist/room/DeviceManager.js.map +1 -1
- package/dist/room/Room.d.ts +5 -16
- package/dist/room/Room.js +14 -30
- package/dist/room/Room.js.map +1 -1
- package/dist/room/defaults.d.ts +5 -3
- package/dist/room/defaults.js +24 -8
- package/dist/room/defaults.js.map +1 -1
- package/dist/room/events.d.ts +10 -2
- package/dist/room/events.js +10 -2
- package/dist/room/events.js.map +1 -1
- package/dist/room/participant/LocalParticipant.d.ts +0 -3
- package/dist/room/participant/LocalParticipant.js +50 -47
- package/dist/room/participant/LocalParticipant.js.map +1 -1
- package/dist/room/participant/Participant.d.ts +3 -0
- package/dist/room/participant/Participant.js +14 -0
- package/dist/room/participant/Participant.js.map +1 -1
- package/dist/room/participant/RemoteParticipant.js +9 -3
- package/dist/room/participant/RemoteParticipant.js.map +1 -1
- package/dist/room/track/LocalTrack.js +9 -7
- package/dist/room/track/LocalTrack.js.map +1 -1
- package/dist/room/track/LocalVideoTrack.js +14 -11
- package/dist/room/track/LocalVideoTrack.js.map +1 -1
- package/dist/room/track/create.js +3 -1
- package/dist/room/track/create.js.map +1 -1
- package/dist/room/track/options.d.ts +38 -7
- package/dist/room/track/options.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/example/sample.ts +19 -22
- package/package.json +1 -1
@@ -4,10 +4,6 @@ export interface TrackPublishDefaults {
|
|
4
4
|
* encoding parameters for camera track
|
5
5
|
*/
|
6
6
|
videoEncoding?: VideoEncoding;
|
7
|
-
/**
|
8
|
-
* default video capture resolution
|
9
|
-
*/
|
10
|
-
videoResolution?: VideoResolution;
|
11
7
|
/**
|
12
8
|
* encoding parameters for screen share track
|
13
9
|
*/
|
@@ -26,10 +22,45 @@ export interface TrackPublishDefaults {
|
|
26
22
|
dtx?: boolean;
|
27
23
|
/**
|
28
24
|
* use simulcast, defaults to false.
|
29
|
-
* When using simulcast, LiveKit will publish up to three version of the stream
|
25
|
+
* When using simulcast, LiveKit will publish up to three version of the stream
|
26
|
+
* at various resolutions.
|
30
27
|
*/
|
31
28
|
simulcast?: boolean;
|
32
29
|
}
|
30
|
+
export interface TrackCaptureDefaults {
|
31
|
+
/**
|
32
|
+
* default device to use for microphone capture
|
33
|
+
*/
|
34
|
+
audioDeviceId?: string;
|
35
|
+
/**
|
36
|
+
* specifies whether automatic gain control is preferred, defaults to true
|
37
|
+
*/
|
38
|
+
autoGainControl?: boolean;
|
39
|
+
/**
|
40
|
+
* the channel count or range of channel counts which are acceptable and/or required
|
41
|
+
*/
|
42
|
+
channelCount?: number;
|
43
|
+
/**
|
44
|
+
* whether or not echo cancellation is preferred, defaults to true
|
45
|
+
*/
|
46
|
+
echoCancellation?: boolean;
|
47
|
+
/**
|
48
|
+
* whether noise suppression is preferred, defaults to true
|
49
|
+
*/
|
50
|
+
noiseSuppression?: boolean;
|
51
|
+
/**
|
52
|
+
* set if a particular video facing mode is preferred
|
53
|
+
*/
|
54
|
+
videoFacingMode?: 'user' | 'environment' | 'left' | 'right';
|
55
|
+
/**
|
56
|
+
* default device to use for camera capture
|
57
|
+
*/
|
58
|
+
videoDeviceId?: string;
|
59
|
+
/**
|
60
|
+
* default video capture resolution
|
61
|
+
*/
|
62
|
+
videoResolution?: VideoResolution;
|
63
|
+
}
|
33
64
|
/**
|
34
65
|
* Options when publishing tracks
|
35
66
|
*/
|
@@ -118,8 +149,8 @@ export interface CreateAudioTrackOptions extends CreateLocalTrackOptions {
|
|
118
149
|
*
|
119
150
|
* ```typescript
|
120
151
|
* {
|
121
|
-
* width:
|
122
|
-
* height:
|
152
|
+
* width: 960,
|
153
|
+
* height: 540,
|
123
154
|
* frameRate: {
|
124
155
|
* ideal: 30,
|
125
156
|
* max: 60,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../src/room/track/options.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../src/room/track/options.ts"],"names":[],"mappings":";;;AA4MA,MAAa,WAAW;IAOtB,YAAY,KAAa,EAAE,MAAc,EAAE,UAAkB,EAAE,YAAoB;QACjF,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG;YACd,UAAU;YACV,YAAY;SACb,CAAC;IACJ,CAAC;IAED,IAAI,UAAU;QACZ,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY;SACtC,CAAC;IACJ,CAAC;CACF;AAvBD,kCAuBC;AAQD,IAAiB,YAAY,CAU5B;AAVD,WAAiB,YAAY;IACd,sBAAS,GAAgB;QACpC,UAAU,EAAE,KAAM;KACnB,CAAC;IACW,mBAAM,GAAgB;QACjC,UAAU,EAAE,KAAM;KACnB,CAAC;IACW,kBAAK,GAAgB;QAChC,UAAU,EAAE,KAAM;KACnB,CAAC;AACJ,CAAC,EAVgB,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAU5B;AAED;;GAEG;AACU,QAAA,YAAY,GAAG;IAC1B,IAAI,EAAE,IAAI,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,MAAO,EAAE,EAAE,CAAC;IAC5C,GAAG,EAAE,IAAI,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,MAAO,EAAE,EAAE,CAAC;IAC3C,GAAG,EAAE,IAAI,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,M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"0.13.4";
|
2
2
|
export declare const protocolVersion = 4;
|
package/dist/version.js
CHANGED
package/example/sample.ts
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
import {
|
2
|
-
connect, CreateVideoTrackOptions, DataPacket_Kind, LocalTrack, LogLevel,
|
2
|
+
connect, CreateVideoTrackOptions, DataPacket_Kind, LocalTrack, LocalTrackPublication, LogLevel,
|
3
3
|
Participant,
|
4
4
|
ParticipantEvent,
|
5
5
|
RemoteParticipant,
|
6
6
|
RemoteTrack,
|
7
|
+
RemoteTrackPublication,
|
7
8
|
Room,
|
8
9
|
RoomEvent,
|
9
10
|
Track, TrackPublication, VideoPresets,
|
@@ -59,6 +60,7 @@ function trackSubscribed(
|
|
59
60
|
|
60
61
|
function trackUnsubscribed(
|
61
62
|
track: RemoteTrack | LocalTrack,
|
63
|
+
pub?: RemoteTrackPublication,
|
62
64
|
participant?: Participant,
|
63
65
|
) {
|
64
66
|
let logName = track.name;
|
@@ -121,13 +123,8 @@ function participantConnected(participant: RemoteParticipant) {
|
|
121
123
|
participant.on(ParticipantEvent.TrackSubscribed, (track) => {
|
122
124
|
trackSubscribed(div, track, participant);
|
123
125
|
});
|
124
|
-
participant.on(ParticipantEvent.TrackUnsubscribed, (track) => {
|
125
|
-
trackUnsubscribed(track, participant);
|
126
|
-
});
|
127
|
-
|
128
|
-
participant.tracks.forEach((publication) => {
|
129
|
-
if (!publication.isSubscribed) return;
|
130
|
-
trackSubscribed(div, publication.track!, participant);
|
126
|
+
participant.on(ParticipantEvent.TrackUnsubscribed, (track, pub) => {
|
127
|
+
trackUnsubscribed(track, pub, participant);
|
131
128
|
});
|
132
129
|
}
|
133
130
|
|
@@ -197,22 +194,16 @@ window.connectToRoom = async (
|
|
197
194
|
rtcConfig.iceTransportPolicy = 'relay';
|
198
195
|
}
|
199
196
|
const shouldPublish = (<HTMLInputElement>$('publish-option')).checked;
|
200
|
-
let audioOptions = true;
|
201
|
-
let videoOptions: boolean | CreateVideoTrackOptions = {
|
202
|
-
resolution: VideoPresets.qhd.resolution,
|
203
|
-
};
|
204
|
-
if (!shouldPublish) {
|
205
|
-
audioOptions = false;
|
206
|
-
videoOptions = false;
|
207
|
-
}
|
208
197
|
|
209
198
|
try {
|
210
199
|
room = await connect(url, token, {
|
211
200
|
logLevel: LogLevel.debug,
|
212
|
-
audio: audioOptions,
|
213
|
-
video: videoOptions,
|
214
|
-
simulcast,
|
215
201
|
rtcConfig,
|
202
|
+
audio: shouldPublish,
|
203
|
+
video: shouldPublish,
|
204
|
+
publishDefaults: {
|
205
|
+
simulcast,
|
206
|
+
},
|
216
207
|
});
|
217
208
|
} catch (error) {
|
218
209
|
let message: any = error;
|
@@ -239,6 +230,11 @@ window.connectToRoom = async (
|
|
239
230
|
.on(RoomEvent.Reconnected, () => appendLog('Successfully reconnected!'))
|
240
231
|
.on(RoomEvent.TrackMuted, (pub: TrackPublication, p: Participant) => appendLog('track was muted', pub.trackSid, p.identity))
|
241
232
|
.on(RoomEvent.TrackUnmuted, (pub: TrackPublication, p: Participant) => appendLog('track was unmuted', pub.trackSid, p.identity))
|
233
|
+
.on(RoomEvent.LocalTrackPublished, (pub: LocalTrackPublication) => {
|
234
|
+
if (pub.kind === Track.Kind.Video) {
|
235
|
+
attachLocalVideo();
|
236
|
+
}
|
237
|
+
})
|
242
238
|
.on(RoomEvent.RoomMetadataChanged, (metadata) => {
|
243
239
|
appendLog('new metadata for room', metadata);
|
244
240
|
})
|
@@ -257,7 +253,6 @@ window.connectToRoom = async (
|
|
257
253
|
});
|
258
254
|
|
259
255
|
$('local-video')!.innerHTML = `${room.localParticipant.identity} (me)`;
|
260
|
-
attachLocalVideo();
|
261
256
|
};
|
262
257
|
|
263
258
|
window.toggleVideo = async () => {
|
@@ -356,6 +351,7 @@ window.flipVideo = () => {
|
|
356
351
|
videoPub.videoTrack?.restartTrack(options);
|
357
352
|
};
|
358
353
|
|
354
|
+
const defaultDevices = new Map<MediaDeviceKind, string>();
|
359
355
|
window.handleDeviceSelected = async (e: Event) => {
|
360
356
|
const deviceId = (<HTMLSelectElement>e.target).value;
|
361
357
|
const elementId = (<HTMLSelectElement>e.target).id;
|
@@ -364,7 +360,8 @@ window.handleDeviceSelected = async (e: Event) => {
|
|
364
360
|
return;
|
365
361
|
}
|
366
362
|
|
367
|
-
|
363
|
+
defaultDevices.set(kind, deviceId);
|
364
|
+
|
368
365
|
if (currentRoom) {
|
369
366
|
await currentRoom.switchActiveDevice(kind, deviceId);
|
370
367
|
}
|
@@ -421,7 +418,7 @@ async function handleDevicesChanged() {
|
|
421
418
|
}
|
422
419
|
const devices = await Room.getLocalDevices(kind);
|
423
420
|
const element = <HTMLSelectElement>$(id);
|
424
|
-
populateSelect(kind, element, devices,
|
421
|
+
populateSelect(kind, element, devices, defaultDevices.get(kind));
|
425
422
|
}));
|
426
423
|
}
|
427
424
|
|