livekit-client 1.9.7 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/livekit-client.esm.mjs +2972 -2583
- 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 +2 -1
- package/dist/src/api/SignalClient.d.ts.map +1 -1
- package/dist/src/connectionHelper/ConnectionCheck.d.ts +2 -3
- package/dist/src/connectionHelper/ConnectionCheck.d.ts.map +1 -1
- package/dist/src/connectionHelper/checks/Checker.d.ts +2 -3
- package/dist/src/connectionHelper/checks/Checker.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/proto/livekit_models.d.ts +108 -10
- package/dist/src/proto/livekit_models.d.ts.map +1 -1
- package/dist/src/proto/livekit_rtc.d.ts +513 -194
- package/dist/src/proto/livekit_rtc.d.ts.map +1 -1
- package/dist/src/room/PCTransport.d.ts +1 -1
- package/dist/src/room/PCTransport.d.ts.map +1 -1
- package/dist/src/room/RTCEngine.d.ts +2 -4
- package/dist/src/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/Room.d.ts +6 -6
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/src/room/events.d.ts +5 -1
- package/dist/src/room/events.d.ts.map +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/Participant.d.ts +4 -6
- package/dist/src/room/participant/Participant.d.ts.map +1 -1
- package/dist/src/room/participant/RemoteParticipant.d.ts +2 -1
- package/dist/src/room/participant/RemoteParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/publishUtils.d.ts +8 -0
- package/dist/src/room/participant/publishUtils.d.ts.map +1 -1
- package/dist/src/room/track/LocalTrack.d.ts +33 -0
- package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
- package/dist/src/room/track/LocalVideoTrack.d.ts +1 -1
- package/dist/src/room/track/LocalVideoTrack.d.ts.map +1 -1
- package/dist/src/room/track/RemoteTrackPublication.d.ts +4 -1
- package/dist/src/room/track/RemoteTrackPublication.d.ts.map +1 -1
- package/dist/src/room/track/RemoteVideoTrack.d.ts +1 -0
- package/dist/src/room/track/RemoteVideoTrack.d.ts.map +1 -1
- package/dist/src/room/track/Track.d.ts +2 -4
- package/dist/src/room/track/Track.d.ts.map +1 -1
- package/dist/src/room/track/TrackPublication.d.ts +4 -5
- package/dist/src/room/track/TrackPublication.d.ts.map +1 -1
- package/dist/src/room/track/options.d.ts +14 -5
- package/dist/src/room/track/options.d.ts.map +1 -1
- package/dist/src/room/track/processor/types.d.ts +19 -0
- package/dist/src/room/track/processor/types.d.ts.map +1 -0
- package/dist/src/room/track/types.d.ts +2 -1
- package/dist/src/room/track/types.d.ts.map +1 -1
- package/dist/src/room/utils.d.ts.map +1 -1
- package/dist/ts4.2/src/api/SignalClient.d.ts +2 -1
- package/dist/ts4.2/src/connectionHelper/ConnectionCheck.d.ts +2 -3
- package/dist/ts4.2/src/connectionHelper/checks/Checker.d.ts +2 -3
- package/dist/ts4.2/src/index.d.ts +1 -0
- package/dist/ts4.2/src/proto/livekit_models.d.ts +126 -12
- package/dist/ts4.2/src/proto/livekit_rtc.d.ts +617 -254
- package/dist/ts4.2/src/room/PCTransport.d.ts +1 -1
- package/dist/ts4.2/src/room/RTCEngine.d.ts +2 -4
- package/dist/ts4.2/src/room/Room.d.ts +6 -6
- package/dist/ts4.2/src/room/events.d.ts +5 -1
- package/dist/ts4.2/src/room/participant/Participant.d.ts +4 -6
- package/dist/ts4.2/src/room/participant/RemoteParticipant.d.ts +2 -1
- package/dist/ts4.2/src/room/participant/publishUtils.d.ts +8 -0
- package/dist/ts4.2/src/room/track/LocalTrack.d.ts +33 -0
- package/dist/ts4.2/src/room/track/LocalVideoTrack.d.ts +1 -1
- package/dist/ts4.2/src/room/track/RemoteTrackPublication.d.ts +4 -1
- package/dist/ts4.2/src/room/track/RemoteVideoTrack.d.ts +1 -0
- package/dist/ts4.2/src/room/track/Track.d.ts +2 -4
- package/dist/ts4.2/src/room/track/TrackPublication.d.ts +4 -5
- package/dist/ts4.2/src/room/track/options.d.ts +14 -5
- package/dist/ts4.2/src/room/track/processor/types.d.ts +19 -0
- package/dist/ts4.2/src/room/track/types.d.ts +2 -1
- package/package.json +14 -15
- package/src/api/SignalClient.ts +8 -1
- package/src/connectionHelper/ConnectionCheck.ts +2 -3
- package/src/connectionHelper/checks/Checker.ts +2 -3
- package/src/index.ts +1 -0
- package/src/logger.ts +4 -4
- package/src/proto/google/protobuf/timestamp.ts +3 -3
- package/src/proto/livekit_models.ts +254 -161
- package/src/proto/livekit_rtc.ts +334 -180
- package/src/room/PCTransport.ts +1 -1
- package/src/room/RTCEngine.ts +4 -4
- package/src/room/Room.ts +67 -12
- package/src/room/events.ts +4 -0
- package/src/room/participant/LocalParticipant.ts +33 -5
- package/src/room/participant/Participant.ts +4 -5
- package/src/room/participant/RemoteParticipant.ts +8 -4
- package/src/room/participant/publishUtils.ts +47 -20
- package/src/room/track/LocalTrack.ts +180 -57
- package/src/room/track/LocalVideoTrack.ts +98 -33
- package/src/room/track/RemoteTrackPublication.ts +8 -1
- package/src/room/track/RemoteVideoTrack.ts +23 -6
- package/src/room/track/Track.ts +5 -7
- package/src/room/track/TrackPublication.ts +4 -5
- package/src/room/track/options.ts +14 -5
- package/src/room/track/processor/types.ts +20 -0
- package/src/room/track/types.ts +2 -1
- package/src/room/utils.ts +6 -3
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import EventEmitter from 'eventemitter3';
|
2
2
|
import { SignalClient } from '../api/SignalClient';
|
3
3
|
import type { SignalOptions } from '../api/SignalClient';
|
4
4
|
import type { InternalRoomOptions } from '../options';
|
@@ -9,9 +9,8 @@ import type LocalTrack from './track/LocalTrack';
|
|
9
9
|
import type LocalVideoTrack from './track/LocalVideoTrack';
|
10
10
|
import type { SimulcastTrackInfo } from './track/LocalVideoTrack';
|
11
11
|
import type { TrackPublishOptions } from './track/options';
|
12
|
-
declare const RTCEngine_base: new () => TypedEventEmitter<EngineEventCallbacks>;
|
13
12
|
/** @internal */
|
14
|
-
export default class RTCEngine extends
|
13
|
+
export default class RTCEngine extends EventEmitter<EngineEventCallbacks> {
|
15
14
|
private options;
|
16
15
|
publisher?: PCTransport;
|
17
16
|
subscriber?: PCTransport;
|
@@ -123,5 +122,4 @@ export type EngineEventCallbacks = {
|
|
123
122
|
transportsCreated: (publisher: PCTransport, subscriber: PCTransport) => void;
|
124
123
|
dcBufferStatusChanged: (isLow: boolean, kind: DataPacket_Kind) => void;
|
125
124
|
};
|
126
|
-
export {};
|
127
125
|
//# sourceMappingURL=RTCEngine.d.ts.map
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import
|
1
|
+
import EventEmitter from 'eventemitter3';
|
2
2
|
import 'webrtc-adapter';
|
3
3
|
import type { InternalRoomOptions, RoomConnectOptions, RoomOptions } from '../options';
|
4
|
-
import { DataPacket_Kind, DisconnectReason, ParticipantPermission } from '../proto/livekit_models';
|
4
|
+
import { DataPacket_Kind, DisconnectReason, ParticipantPermission, SubscriptionError } from '../proto/livekit_models';
|
5
5
|
import RTCEngine from './RTCEngine';
|
6
6
|
import LocalParticipant from './participant/LocalParticipant';
|
7
7
|
import type Participant from './participant/Participant';
|
@@ -21,7 +21,6 @@ export declare enum ConnectionState {
|
|
21
21
|
}
|
22
22
|
/** @deprecated RoomState has been renamed to [[ConnectionState]] */
|
23
23
|
export declare const RoomState: typeof ConnectionState;
|
24
|
-
declare const Room_base: new () => TypedEmitter<RoomEventCallbacks>;
|
25
24
|
/**
|
26
25
|
* In LiveKit, a room is the logical grouping for a list of participants.
|
27
26
|
* Participants in a room can publish tracks, and subscribe to others' tracks.
|
@@ -30,7 +29,7 @@ declare const Room_base: new () => TypedEmitter<RoomEventCallbacks>;
|
|
30
29
|
*
|
31
30
|
* @noInheritDoc
|
32
31
|
*/
|
33
|
-
declare class Room extends
|
32
|
+
declare class Room extends EventEmitter<RoomEventCallbacks> {
|
34
33
|
state: ConnectionState;
|
35
34
|
/** map of sid: [[RemoteParticipant]] */
|
36
35
|
participants: Map<string, RemoteParticipant>;
|
@@ -157,6 +156,7 @@ declare class Room extends Room_base {
|
|
157
156
|
private handleSpeakersChanged;
|
158
157
|
private handleStreamStateUpdate;
|
159
158
|
private handleSubscriptionPermissionUpdate;
|
159
|
+
private handleSubscriptionError;
|
160
160
|
private handleDataPacket;
|
161
161
|
private handleAudioPlaybackStarted;
|
162
162
|
private handleAudioPlaybackFailed;
|
@@ -191,7 +191,7 @@ declare class Room extends Room_base {
|
|
191
191
|
* @experimental
|
192
192
|
*/
|
193
193
|
simulateParticipants(options: SimulationOptions): Promise<void>;
|
194
|
-
emit<
|
194
|
+
emit<T extends EventEmitter.EventNames<RoomEventCallbacks>>(event: T, ...args: EventEmitter.EventArgs<RoomEventCallbacks, T>): boolean;
|
195
195
|
}
|
196
196
|
export default Room;
|
197
197
|
export type RoomEventCallbacks = {
|
@@ -207,7 +207,7 @@ export type RoomEventCallbacks = {
|
|
207
207
|
participantDisconnected: (participant: RemoteParticipant) => void;
|
208
208
|
trackPublished: (publication: RemoteTrackPublication, participant: RemoteParticipant) => void;
|
209
209
|
trackSubscribed: (track: RemoteTrack, publication: RemoteTrackPublication, participant: RemoteParticipant) => void;
|
210
|
-
trackSubscriptionFailed: (trackSid: string, participant: RemoteParticipant) => void;
|
210
|
+
trackSubscriptionFailed: (trackSid: string, participant: RemoteParticipant, reason?: SubscriptionError) => void;
|
211
211
|
trackUnpublished: (publication: RemoteTrackPublication, participant: RemoteParticipant) => void;
|
212
212
|
trackUnsubscribed: (track: RemoteTrack, publication: RemoteTrackPublication, participant: RemoteParticipant) => void;
|
213
213
|
trackMuted: (publication: TrackPublication, participant: Participant) => void;
|
@@ -451,6 +451,10 @@ export declare enum TrackEvent {
|
|
451
451
|
/**
|
452
452
|
* Fires on RemoteTrackPublication
|
453
453
|
*/
|
454
|
-
SubscriptionStatusChanged = "subscriptionStatusChanged"
|
454
|
+
SubscriptionStatusChanged = "subscriptionStatusChanged",
|
455
|
+
/**
|
456
|
+
* Fires on RemoteTrackPublication
|
457
|
+
*/
|
458
|
+
SubscriptionFailed = "subscriptionFailed"
|
455
459
|
}
|
456
460
|
//# sourceMappingURL=events.d.ts.map
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import
|
2
|
-
import { DataPacket_Kind, ParticipantInfo, ParticipantPermission, ConnectionQuality as ProtoQuality } from '../../proto/livekit_models';
|
1
|
+
import EventEmitter from 'eventemitter3';
|
2
|
+
import { DataPacket_Kind, ParticipantInfo, ParticipantPermission, ConnectionQuality as ProtoQuality, SubscriptionError } from '../../proto/livekit_models';
|
3
3
|
import type LocalTrackPublication from '../track/LocalTrackPublication';
|
4
4
|
import type RemoteTrack from '../track/RemoteTrack';
|
5
5
|
import type RemoteTrackPublication from '../track/RemoteTrackPublication';
|
@@ -11,8 +11,7 @@ export declare enum ConnectionQuality {
|
|
11
11
|
Poor = "poor",
|
12
12
|
Unknown = "unknown"
|
13
13
|
}
|
14
|
-
|
15
|
-
export default class Participant extends Participant_base {
|
14
|
+
export default class Participant extends EventEmitter<ParticipantEventCallbacks> {
|
16
15
|
protected participantInfo?: ParticipantInfo;
|
17
16
|
audioTracks: Map<string, TrackPublication>;
|
18
17
|
videoTracks: Map<string, TrackPublication>;
|
@@ -72,7 +71,7 @@ export default class Participant extends Participant_base {
|
|
72
71
|
export type ParticipantEventCallbacks = {
|
73
72
|
trackPublished: (publication: RemoteTrackPublication) => void;
|
74
73
|
trackSubscribed: (track: RemoteTrack, publication: RemoteTrackPublication) => void;
|
75
|
-
trackSubscriptionFailed: (trackSid: string) => void;
|
74
|
+
trackSubscriptionFailed: (trackSid: string, reason?: SubscriptionError) => void;
|
76
75
|
trackUnpublished: (publication: RemoteTrackPublication) => void;
|
77
76
|
trackUnsubscribed: (track: RemoteTrack, publication: RemoteTrackPublication) => void;
|
78
77
|
trackMuted: (publication: TrackPublication) => void;
|
@@ -90,5 +89,4 @@ export type ParticipantEventCallbacks = {
|
|
90
89
|
participantPermissionsChanged: (prevPermissions?: ParticipantPermission) => void;
|
91
90
|
trackSubscriptionStatusChanged: (publication: RemoteTrackPublication, status: TrackPublication.SubscriptionStatus) => void;
|
92
91
|
};
|
93
|
-
export {};
|
94
92
|
//# sourceMappingURL=Participant.d.ts.map
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import type EventEmitter from 'eventemitter3';
|
1
2
|
import type { SignalClient } from '../../api/SignalClient';
|
2
3
|
import type { ParticipantInfo } from '../../proto/livekit_models';
|
3
4
|
import RemoteTrackPublication from '../track/RemoteTrackPublication';
|
@@ -48,6 +49,6 @@ export default class RemoteParticipant extends Participant {
|
|
48
49
|
*/
|
49
50
|
setAudioOutput(output: AudioOutputOptions): Promise<void>;
|
50
51
|
/** @internal */
|
51
|
-
emit<
|
52
|
+
emit<T extends EventEmitter.EventNames<ParticipantEventCallbacks>>(event: T, ...args: EventEmitter.EventArgs<ParticipantEventCallbacks, T>): boolean;
|
52
53
|
}
|
53
54
|
//# sourceMappingURL=RemoteParticipant.d.ts.map
|
@@ -17,4 +17,12 @@ export declare function presetsForResolution(isScreenShare: boolean, width: numb
|
|
17
17
|
export declare function defaultSimulcastLayers(isScreenShare: boolean, original: VideoPreset): VideoPreset[];
|
18
18
|
/** @internal */
|
19
19
|
export declare function sortPresets(presets: Array<VideoPreset> | undefined): VideoPreset[] | undefined;
|
20
|
+
/** @internal */
|
21
|
+
export declare class ScalabilityMode {
|
22
|
+
spatial: number;
|
23
|
+
temporal: number;
|
24
|
+
suffix: undefined | 'h' | '_KEY' | '_KEY_SHIFT';
|
25
|
+
constructor(scalabilityMode: string);
|
26
|
+
toString(): string;
|
27
|
+
}
|
20
28
|
//# sourceMappingURL=publishUtils.d.ts.map
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { Mutex } from '../utils';
|
2
2
|
import { Track } from './Track';
|
3
3
|
import type { VideoCodec } from './options';
|
4
|
+
import type { TrackProcessor } from './processor/types';
|
4
5
|
export default abstract class LocalTrack extends Track {
|
5
6
|
/** @internal */
|
6
7
|
sender?: RTCRtpSender;
|
@@ -11,6 +12,9 @@ export default abstract class LocalTrack extends Track {
|
|
11
12
|
protected providedByUser: boolean;
|
12
13
|
protected muteLock: Mutex;
|
13
14
|
protected pauseUpstreamLock: Mutex;
|
15
|
+
protected processorElement?: HTMLMediaElement;
|
16
|
+
protected processor?: TrackProcessor<typeof this.kind>;
|
17
|
+
protected isSettingUpProcessor: boolean;
|
14
18
|
/**
|
15
19
|
*
|
16
20
|
* @param mediaTrack
|
@@ -24,6 +28,8 @@ export default abstract class LocalTrack extends Track {
|
|
24
28
|
private _isUpstreamPaused;
|
25
29
|
get isUpstreamPaused(): boolean;
|
26
30
|
get isUserProvided(): boolean;
|
31
|
+
get mediaStreamTrack(): MediaStreamTrack;
|
32
|
+
private setMediaStreamTrack;
|
27
33
|
waitForDimensions(timeout?: number): Promise<Track.Dimensions>;
|
28
34
|
/**
|
29
35
|
* @returns DeviceID of the device that is currently being used for this track
|
@@ -37,8 +43,35 @@ export default abstract class LocalTrack extends Track {
|
|
37
43
|
protected get needsReAcquisition(): boolean;
|
38
44
|
protected handleAppVisibilityChanged(): Promise<void>;
|
39
45
|
private handleEnded;
|
46
|
+
stop(): void;
|
47
|
+
/**
|
48
|
+
* pauses publishing to the server without disabling the local MediaStreamTrack
|
49
|
+
* this is used to display a user's own video locally while pausing publishing to
|
50
|
+
* the server.
|
51
|
+
* this API is unsupported on Safari < 12 due to a bug
|
52
|
+
**/
|
40
53
|
pauseUpstream(): Promise<void>;
|
41
54
|
resumeUpstream(): Promise<void>;
|
55
|
+
/**
|
56
|
+
* Sets a processor on this track.
|
57
|
+
* See https://github.com/livekit/track-processors-js for example usage
|
58
|
+
*
|
59
|
+
* @experimental
|
60
|
+
*
|
61
|
+
* @param processor
|
62
|
+
* @param showProcessedStreamLocally
|
63
|
+
* @returns
|
64
|
+
*/
|
65
|
+
setProcessor(processor: TrackProcessor<typeof this.kind>, showProcessedStreamLocally?: boolean): Promise<void>;
|
66
|
+
getProcessor(): TrackProcessor<Track.Kind> | undefined;
|
67
|
+
/**
|
68
|
+
* Stops the track processor
|
69
|
+
* See https://github.com/livekit/track-processors-js for example usage
|
70
|
+
*
|
71
|
+
* @experimental
|
72
|
+
* @returns
|
73
|
+
*/
|
74
|
+
stopProcessor(): Promise<void>;
|
42
75
|
protected abstract monitorSender(): void;
|
43
76
|
}
|
44
77
|
//# sourceMappingURL=LocalTrack.d.ts.map
|
@@ -50,5 +50,5 @@ export default class LocalVideoTrack extends LocalTrack {
|
|
50
50
|
protected handleAppVisibilityChanged(): Promise<void>;
|
51
51
|
}
|
52
52
|
export declare function videoQualityForRid(rid: string): VideoQuality;
|
53
|
-
export declare function videoLayersFromEncodings(width: number, height: number, encodings?: RTCRtpEncodingParameters[]): VideoLayer[];
|
53
|
+
export declare function videoLayersFromEncodings(width: number, height: number, encodings?: RTCRtpEncodingParameters[], svc?: boolean): VideoLayer[];
|
54
54
|
//# sourceMappingURL=LocalVideoTrack.d.ts.map
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { TrackInfo, VideoQuality } from '../../proto/livekit_models';
|
1
|
+
import { SubscriptionError, TrackInfo, VideoQuality } from '../../proto/livekit_models';
|
2
2
|
import type RemoteTrack from './RemoteTrack';
|
3
3
|
import { Track } from './Track';
|
4
4
|
import { TrackPublication } from './TrackPublication';
|
@@ -11,6 +11,7 @@ export default class RemoteTrackPublication extends TrackPublication {
|
|
11
11
|
protected currentVideoQuality?: VideoQuality;
|
12
12
|
protected videoDimensions?: Track.Dimensions;
|
13
13
|
protected fps?: number;
|
14
|
+
protected subscriptionError?: SubscriptionError;
|
14
15
|
constructor(kind: Track.Kind, ti: TrackInfo, autoSubscribe: boolean | undefined);
|
15
16
|
/**
|
16
17
|
* Subscribe or unsubscribe to this remote track
|
@@ -48,6 +49,8 @@ export default class RemoteTrackPublication extends TrackPublication {
|
|
48
49
|
/** @internal */
|
49
50
|
setAllowed(allowed: boolean): void;
|
50
51
|
/** @internal */
|
52
|
+
setSubscriptionError(error: SubscriptionError): void;
|
53
|
+
/** @internal */
|
51
54
|
updateInfo(info: TrackInfo): void;
|
52
55
|
private emitSubscriptionUpdateIfChanged;
|
53
56
|
private emitPermissionUpdateIfChanged;
|
@@ -1,9 +1,8 @@
|
|
1
|
-
import
|
1
|
+
import EventEmitter from 'eventemitter3';
|
2
2
|
import type { SignalClient } from '../../api/SignalClient';
|
3
3
|
import { TrackSource, TrackType } from '../../proto/livekit_models';
|
4
4
|
import { StreamState as ProtoStreamState } from '../../proto/livekit_rtc';
|
5
|
-
declare
|
6
|
-
export declare abstract class Track extends Track_base {
|
5
|
+
export declare abstract class Track extends EventEmitter<TrackEventCallbacks> {
|
7
6
|
kind: Track.Kind;
|
8
7
|
attachedElements: HTMLMediaElement[];
|
9
8
|
isMuted: boolean;
|
@@ -121,5 +120,4 @@ export type TrackEventCallbacks = {
|
|
121
120
|
upstreamPaused: (track: any) => void;
|
122
121
|
upstreamResumed: (track: any) => void;
|
123
122
|
};
|
124
|
-
export {};
|
125
123
|
//# sourceMappingURL=Track.d.ts.map
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import
|
2
|
-
import type { TrackInfo } from '../../proto/livekit_models';
|
1
|
+
import EventEmitter from 'eventemitter3';
|
2
|
+
import type { SubscriptionError, TrackInfo } from '../../proto/livekit_models';
|
3
3
|
import type { UpdateSubscription, UpdateTrackSettings } from '../../proto/livekit_rtc';
|
4
4
|
import LocalAudioTrack from './LocalAudioTrack';
|
5
5
|
import LocalVideoTrack from './LocalVideoTrack';
|
@@ -7,8 +7,7 @@ import RemoteAudioTrack from './RemoteAudioTrack';
|
|
7
7
|
import type RemoteTrack from './RemoteTrack';
|
8
8
|
import RemoteVideoTrack from './RemoteVideoTrack';
|
9
9
|
import { Track } from './Track';
|
10
|
-
declare
|
11
|
-
export declare class TrackPublication extends TrackPublication_base {
|
10
|
+
export declare class TrackPublication extends EventEmitter<PublicationEventCallbacks> {
|
12
11
|
kind: Track.Kind;
|
13
12
|
trackName: string;
|
14
13
|
trackSid: Track.SID;
|
@@ -63,6 +62,6 @@ export type PublicationEventCallbacks = {
|
|
63
62
|
subscribed: (track: RemoteTrack) => void;
|
64
63
|
unsubscribed: (track: RemoteTrack) => void;
|
65
64
|
subscriptionStatusChanged: (status: TrackPublication.SubscriptionStatus, prevStatus: TrackPublication.SubscriptionStatus) => void;
|
65
|
+
subscriptionFailed: (error: SubscriptionError) => void;
|
66
66
|
};
|
67
|
-
export {};
|
68
67
|
//# sourceMappingURL=TrackPublication.d.ts.map
|
@@ -54,10 +54,19 @@ export interface TrackPublishDefaults {
|
|
54
54
|
*/
|
55
55
|
scalabilityMode?: ScalabilityMode;
|
56
56
|
/**
|
57
|
-
*
|
58
|
-
*
|
59
|
-
*
|
60
|
-
*
|
57
|
+
* Up to two additional simulcast layers to publish in addition to the original
|
58
|
+
* Track.
|
59
|
+
* When left blank, it defaults to h180, h360.
|
60
|
+
* If a SVC codec is used (VP9 or AV1), this field has no effect.
|
61
|
+
*
|
62
|
+
* To publish three total layers, you would specify:
|
63
|
+
* {
|
64
|
+
* videoEncoding: {...}, // encoding of the primary layer
|
65
|
+
* videoSimulcastLayers: [
|
66
|
+
* VideoPresets.h540,
|
67
|
+
* VideoPresets.h216,
|
68
|
+
* ],
|
69
|
+
* }
|
61
70
|
*/
|
62
71
|
videoSimulcastLayers?: Array<VideoPreset>;
|
63
72
|
/**
|
@@ -216,7 +225,7 @@ export declare function isCodecEqual(c1: string | undefined, c2: string | undefi
|
|
216
225
|
/**
|
217
226
|
* scalability modes for svc, only supprot l3t3 now.
|
218
227
|
*/
|
219
|
-
export type ScalabilityMode = 'L3T3';
|
228
|
+
export type ScalabilityMode = 'L3T3' | 'L3T3_KEY';
|
220
229
|
export declare namespace AudioPresets {
|
221
230
|
const telephone: AudioPreset;
|
222
231
|
const speech: AudioPreset;
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import type { Track } from '../Track';
|
2
|
+
/**
|
3
|
+
* @experimental
|
4
|
+
*/
|
5
|
+
export type ProcessorOptions<T extends Track.Kind> = {
|
6
|
+
kind: T;
|
7
|
+
track: MediaStreamTrack;
|
8
|
+
element?: HTMLMediaElement;
|
9
|
+
};
|
10
|
+
/**
|
11
|
+
* @experimental
|
12
|
+
*/
|
13
|
+
export interface TrackProcessor<T extends Track.Kind> {
|
14
|
+
name: string;
|
15
|
+
init: (opts: ProcessorOptions<T>) => void;
|
16
|
+
destroy: () => Promise<void>;
|
17
|
+
processedTrack?: MediaStreamTrack;
|
18
|
+
}
|
19
|
+
//# sourceMappingURL=types.d.ts.map
|
@@ -6,7 +6,8 @@ export type AudioTrack = RemoteAudioTrack | LocalAudioTrack;
|
|
6
6
|
export type VideoTrack = RemoteVideoTrack | LocalVideoTrack;
|
7
7
|
export type AdaptiveStreamSettings = {
|
8
8
|
/**
|
9
|
-
* Set a custom pixel density
|
9
|
+
* Set a custom pixel density. Defaults to 2 for high density screens (3+) or
|
10
|
+
* 1 otherwise.
|
10
11
|
* When streaming videos on a ultra high definition screen this setting
|
11
12
|
* let's you account for the devicePixelRatio of those screens.
|
12
13
|
* Set it to `screen` to use the actual pixel density of the screen
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "livekit-client",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.11.0",
|
4
4
|
"description": "JavaScript/TypeScript client SDK for LiveKit",
|
5
5
|
"main": "./dist/livekit-client.umd.js",
|
6
6
|
"unpkg": "./dist/livekit-client.umd.js",
|
@@ -42,35 +42,34 @@
|
|
42
42
|
"size-limit": "size-limit"
|
43
43
|
},
|
44
44
|
"dependencies": {
|
45
|
-
"
|
45
|
+
"eventemitter3": "^5.0.1",
|
46
46
|
"loglevel": "^1.8.0",
|
47
47
|
"protobufjs": "^7.0.0",
|
48
48
|
"sdp-transform": "^2.14.1",
|
49
49
|
"ts-debounce": "^4.0.0",
|
50
|
-
"typed-emitter": "^2.1.0",
|
51
50
|
"webrtc-adapter": "^8.1.1"
|
52
51
|
},
|
53
52
|
"devDependencies": {
|
54
|
-
"@babel/core": "7.
|
55
|
-
"@babel/preset-env": "7.
|
53
|
+
"@babel/core": "7.22.1",
|
54
|
+
"@babel/preset-env": "7.22.4",
|
56
55
|
"@changesets/cli": "2.26.1",
|
57
56
|
"@livekit/changesets-changelog-github": "^0.0.4",
|
58
57
|
"@rollup/plugin-babel": "6.0.3",
|
59
58
|
"@rollup/plugin-commonjs": "24.1.0",
|
60
59
|
"@rollup/plugin-json": "6.0.0",
|
61
|
-
"@rollup/plugin-node-resolve": "15.0
|
60
|
+
"@rollup/plugin-node-resolve": "15.1.0",
|
62
61
|
"@rollup/plugin-terser": "^0.4.0",
|
63
62
|
"@size-limit/file": "^8.2.4",
|
64
63
|
"@size-limit/webpack": "^8.2.4",
|
65
64
|
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
|
66
65
|
"@types/events": "^3.0.0",
|
67
|
-
"@types/jest": "29.5.
|
66
|
+
"@types/jest": "29.5.2",
|
68
67
|
"@types/sdp-transform": "2.4.6",
|
69
68
|
"@types/ua-parser-js": "0.7.36",
|
70
|
-
"@typescript-eslint/eslint-plugin": "5.59.
|
71
|
-
"@typescript-eslint/parser": "5.59.
|
69
|
+
"@typescript-eslint/eslint-plugin": "5.59.8",
|
70
|
+
"@typescript-eslint/parser": "5.59.8",
|
72
71
|
"downlevel-dts": "^0.11.0",
|
73
|
-
"eslint": "8.
|
72
|
+
"eslint": "8.42.0",
|
74
73
|
"eslint-config-airbnb-typescript": "17.0.0",
|
75
74
|
"eslint-config-prettier": "8.8.0",
|
76
75
|
"eslint-plugin-ecmascript-compat": "^3.0.0",
|
@@ -79,16 +78,16 @@
|
|
79
78
|
"jest": "29.5.0",
|
80
79
|
"jest-environment-jsdom": "^29.5.0",
|
81
80
|
"prettier": "^2.8.8",
|
82
|
-
"rollup": "3.
|
81
|
+
"rollup": "3.23.1",
|
83
82
|
"rollup-plugin-delete": "^2.0.0",
|
84
83
|
"rollup-plugin-re": "1.0.7",
|
85
84
|
"rollup-plugin-typescript2": "0.34.1",
|
86
85
|
"size-limit": "^8.2.4",
|
87
86
|
"ts-jest": "29.1.0",
|
88
|
-
"ts-proto": "1.
|
89
|
-
"typedoc": "0.24.
|
87
|
+
"ts-proto": "1.148.2",
|
88
|
+
"typedoc": "0.24.8",
|
90
89
|
"typedoc-plugin-no-inherit": "1.4.0",
|
91
|
-
"typescript": "5.
|
92
|
-
"vite": "4.3.
|
90
|
+
"typescript": "5.1.3",
|
91
|
+
"vite": "4.3.9"
|
93
92
|
}
|
94
93
|
}
|
package/src/api/SignalClient.ts
CHANGED
@@ -22,6 +22,7 @@ import {
|
|
22
22
|
StreamStateUpdate,
|
23
23
|
SubscribedQualityUpdate,
|
24
24
|
SubscriptionPermissionUpdate,
|
25
|
+
SubscriptionResponse,
|
25
26
|
SyncState,
|
26
27
|
TrackPermission,
|
27
28
|
TrackPublishedResponse,
|
@@ -127,6 +128,8 @@ export class SignalClient {
|
|
127
128
|
|
128
129
|
onSubscriptionPermissionUpdate?: (update: SubscriptionPermissionUpdate) => void;
|
129
130
|
|
131
|
+
onSubscriptionError?: (update: SubscriptionResponse) => void;
|
132
|
+
|
130
133
|
onLocalTrackUnpublished?: (res: TrackUnpublishedResponse) => void;
|
131
134
|
|
132
135
|
onTokenRefresh?: (token: string) => void;
|
@@ -214,7 +217,7 @@ export class SignalClient {
|
|
214
217
|
|
215
218
|
return new Promise<JoinResponse | ReconnectResponse | void>(async (resolve, reject) => {
|
216
219
|
const abortHandler = async () => {
|
217
|
-
|
220
|
+
this.close();
|
218
221
|
reject(new ConnectionError('room connection has been cancelled (signal)'));
|
219
222
|
};
|
220
223
|
|
@@ -593,6 +596,10 @@ export class SignalClient {
|
|
593
596
|
if (this.onLocalTrackUnpublished) {
|
594
597
|
this.onLocalTrackUnpublished(msg.trackUnpublished);
|
595
598
|
}
|
599
|
+
} else if (msg.$case === 'subscriptionResponse') {
|
600
|
+
if (this.onSubscriptionError) {
|
601
|
+
this.onSubscriptionError(msg.subscriptionResponse);
|
602
|
+
}
|
596
603
|
} else if (msg.$case === 'pong') {
|
597
604
|
this.resetPingTimeout();
|
598
605
|
} else if (msg.$case === 'pongResp') {
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import
|
2
|
-
import type TypedEmitter from 'typed-emitter';
|
1
|
+
import EventEmitter from 'eventemitter3';
|
3
2
|
import { CheckStatus, Checker } from './checks/Checker';
|
4
3
|
import type { CheckInfo, InstantiableCheck } from './checks/Checker';
|
5
4
|
import { PublishAudioCheck } from './checks/publishAudio';
|
@@ -11,7 +10,7 @@ import { WebSocketCheck } from './checks/websocket';
|
|
11
10
|
|
12
11
|
export type { CheckInfo, CheckStatus };
|
13
12
|
|
14
|
-
export class ConnectionCheck extends
|
13
|
+
export class ConnectionCheck extends EventEmitter<ConnectionCheckCallbacks> {
|
15
14
|
token: string;
|
16
15
|
|
17
16
|
url: string;
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import
|
2
|
-
import type TypedEmitter from 'typed-emitter';
|
1
|
+
import EventEmitter from 'eventemitter3';
|
3
2
|
import type { RoomConnectOptions, RoomOptions } from '../../options';
|
4
3
|
import type RTCEngine from '../../room/RTCEngine';
|
5
4
|
import Room, { ConnectionState } from '../../room/Room';
|
@@ -30,7 +29,7 @@ export interface CheckerOptions {
|
|
30
29
|
connectOptions?: RoomConnectOptions;
|
31
30
|
}
|
32
31
|
|
33
|
-
export abstract class Checker extends
|
32
|
+
export abstract class Checker extends EventEmitter<CheckerCallbacks> {
|
34
33
|
protected url: string;
|
35
34
|
|
36
35
|
protected token: string;
|
package/src/index.ts
CHANGED
@@ -40,6 +40,7 @@ export * from './room/track/options';
|
|
40
40
|
export * from './room/track/types';
|
41
41
|
export type { DataPublishOptions, SimulationScenario } from './room/types';
|
42
42
|
export * from './version';
|
43
|
+
export * from './room/track/processor/types';
|
43
44
|
export {
|
44
45
|
setLogLevel,
|
45
46
|
setLogExtension,
|
package/src/logger.ts
CHANGED
@@ -21,7 +21,7 @@ type StructuredLogger = {
|
|
21
21
|
|
22
22
|
const livekitLogger = log.getLogger('livekit');
|
23
23
|
|
24
|
-
livekitLogger.
|
24
|
+
livekitLogger.setDefaultLevel(LogLevel.info);
|
25
25
|
|
26
26
|
export default livekitLogger as StructuredLogger;
|
27
27
|
|
@@ -38,10 +38,10 @@ export type LogExtension = (level: LogLevel, msg: string, context?: object) => v
|
|
38
38
|
export function setLogExtension(extension: LogExtension) {
|
39
39
|
const originalFactory = livekitLogger.methodFactory;
|
40
40
|
|
41
|
-
livekitLogger.methodFactory = (methodName,
|
42
|
-
const rawMethod = originalFactory(methodName,
|
41
|
+
livekitLogger.methodFactory = (methodName, configLevel, loggerName) => {
|
42
|
+
const rawMethod = originalFactory(methodName, configLevel, loggerName);
|
43
43
|
|
44
|
-
const
|
44
|
+
const logLevel = LogLevel[methodName as LogLevelString];
|
45
45
|
const needLog = logLevel >= configLevel && logLevel < LogLevel.silent;
|
46
46
|
|
47
47
|
return (msg, context?: [msg: string, context: object]) => {
|
@@ -134,21 +134,21 @@ export const Timestamp = {
|
|
134
134
|
const tag = reader.uint32();
|
135
135
|
switch (tag >>> 3) {
|
136
136
|
case 1:
|
137
|
-
if (tag
|
137
|
+
if (tag !== 8) {
|
138
138
|
break;
|
139
139
|
}
|
140
140
|
|
141
141
|
message.seconds = longToNumber(reader.int64() as Long);
|
142
142
|
continue;
|
143
143
|
case 2:
|
144
|
-
if (tag
|
144
|
+
if (tag !== 16) {
|
145
145
|
break;
|
146
146
|
}
|
147
147
|
|
148
148
|
message.nanos = reader.int32();
|
149
149
|
continue;
|
150
150
|
}
|
151
|
-
if ((tag & 7)
|
151
|
+
if ((tag & 7) === 4 || tag === 0) {
|
152
152
|
break;
|
153
153
|
}
|
154
154
|
reader.skipType(tag & 7);
|