livekit-client 0.16.4 → 0.16.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/room/RTCEngine.d.ts +4 -18
- package/dist/room/RTCEngine.js +0 -1
- package/dist/room/RTCEngine.js.map +1 -1
- package/dist/room/Room.d.ts +6 -43
- package/dist/room/Room.js +51 -62
- package/dist/room/Room.js.map +1 -1
- package/dist/room/events.d.ts +1 -8
- package/dist/room/events.js +3 -10
- package/dist/room/events.js.map +1 -1
- package/dist/room/participant/Participant.d.ts +4 -30
- package/dist/room/participant/Participant.js +2 -2
- package/dist/room/participant/Participant.js.map +1 -1
- package/dist/room/participant/RemoteParticipant.d.ts +4 -3
- package/dist/room/participant/RemoteParticipant.js.map +1 -1
- package/dist/room/track/RemoteVideoTrack.js +7 -5
- package/dist/room/track/RemoteVideoTrack.js.map +1 -1
- package/dist/room/track/Track.d.ts +3 -16
- package/dist/room/track/Track.js.map +1 -1
- package/dist/room/track/types.d.ts +4 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -2
- package/src/index.ts +1 -1
- package/src/room/RTCEngine.ts +2 -27
- package/src/room/Room.ts +59 -135
- package/src/room/events.ts +1 -10
- package/src/room/participant/Participant.ts +4 -39
- package/src/room/participant/RemoteParticipant.ts +4 -6
- package/src/room/track/RemoteVideoTrack.ts +5 -3
- package/src/room/track/Track.ts +1 -15
- package/src/room/track/types.ts +4 -4
- package/src/version.ts +1 -1
package/src/room/Room.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
import { EventEmitter } from 'events';
|
2
|
-
import type TypedEmitter from 'typed-emitter';
|
3
2
|
import { toProtoSessionDescription } from '../api/SignalClient';
|
4
3
|
import log from '../logger';
|
5
4
|
import { RoomConnectOptions, RoomOptions } from '../options';
|
@@ -45,7 +44,7 @@ export enum RoomState {
|
|
45
44
|
*
|
46
45
|
* @noInheritDoc
|
47
46
|
*/
|
48
|
-
class Room extends
|
47
|
+
class Room extends EventEmitter {
|
49
48
|
state: RoomState = RoomState.Disconnected;
|
50
49
|
|
51
50
|
/** map of sid: [[RemoteParticipant]] */
|
@@ -146,12 +145,10 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
|
|
146
145
|
.on(EngineEvent.Resuming, () => {
|
147
146
|
this.state = RoomState.Reconnecting;
|
148
147
|
this.emit(RoomEvent.Reconnecting);
|
149
|
-
this.emit(RoomEvent.StateChanged, this.state);
|
150
148
|
})
|
151
149
|
.on(EngineEvent.Resumed, () => {
|
152
150
|
this.state = RoomState.Connected;
|
153
151
|
this.emit(RoomEvent.Reconnected);
|
154
|
-
this.emit(RoomEvent.StateChanged, this.state);
|
155
152
|
this.updateSubscriptions();
|
156
153
|
})
|
157
154
|
.on(EngineEvent.SignalResumed, () => {
|
@@ -208,7 +205,6 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
|
|
208
205
|
}
|
209
206
|
|
210
207
|
this.state = RoomState.Connected;
|
211
|
-
this.emit(RoomEvent.StateChanged, this.state);
|
212
208
|
const pi = joinResponse.participant!;
|
213
209
|
this.localParticipant = new LocalParticipant(
|
214
210
|
pi.sid,
|
@@ -220,10 +216,10 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
|
|
220
216
|
this.localParticipant.updateInfo(pi);
|
221
217
|
// forward metadata changed for the local participant
|
222
218
|
this.localParticipant
|
223
|
-
.on(ParticipantEvent.MetadataChanged, (metadata:
|
219
|
+
.on(ParticipantEvent.MetadataChanged, (metadata: object) => {
|
224
220
|
this.emit(RoomEvent.MetadataChanged, metadata, this.localParticipant);
|
225
221
|
})
|
226
|
-
.on(ParticipantEvent.ParticipantMetadataChanged, (metadata:
|
222
|
+
.on(ParticipantEvent.ParticipantMetadataChanged, (metadata: object) => {
|
227
223
|
this.emit(RoomEvent.ParticipantMetadataChanged, metadata, this.localParticipant);
|
228
224
|
})
|
229
225
|
.on(ParticipantEvent.TrackMuted, (pub: TrackPublication) => {
|
@@ -449,7 +445,6 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
|
|
449
445
|
private handleRestarting = () => {
|
450
446
|
this.state = RoomState.Reconnecting;
|
451
447
|
this.emit(RoomEvent.Reconnecting);
|
452
|
-
this.emit(RoomEvent.StateChanged, this.state);
|
453
448
|
|
454
449
|
// also unwind existing participants & existing subscriptions
|
455
450
|
for (const p of this.participants.values()) {
|
@@ -460,7 +455,6 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
|
|
460
455
|
private handleRestarted = async (joinResponse: JoinResponse) => {
|
461
456
|
this.state = RoomState.Connected;
|
462
457
|
this.emit(RoomEvent.Reconnected);
|
463
|
-
this.emit(RoomEvent.StateChanged, this.state);
|
464
458
|
|
465
459
|
// rehydrate participants
|
466
460
|
if (joinResponse.participant) {
|
@@ -515,7 +509,6 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
|
|
515
509
|
navigator.mediaDevices.removeEventListener('devicechange', this.handleDeviceChange);
|
516
510
|
this.state = RoomState.Disconnected;
|
517
511
|
this.emit(RoomEvent.Disconnected);
|
518
|
-
this.emit(RoomEvent.StateChanged, this.state);
|
519
512
|
}
|
520
513
|
|
521
514
|
private handleParticipantUpdates = (participantInfos: ParticipantInfo[]) => {
|
@@ -724,72 +717,66 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
|
|
724
717
|
}
|
725
718
|
}
|
726
719
|
|
727
|
-
private createParticipant(id: string, info?: ParticipantInfo): RemoteParticipant {
|
728
|
-
let participant: RemoteParticipant;
|
729
|
-
if (info) {
|
730
|
-
participant = RemoteParticipant.fromParticipantInfo(
|
731
|
-
this.engine.client,
|
732
|
-
info,
|
733
|
-
);
|
734
|
-
} else {
|
735
|
-
participant = new RemoteParticipant(this.engine.client, id, '');
|
736
|
-
}
|
737
|
-
return participant;
|
738
|
-
}
|
739
|
-
|
740
720
|
private getOrCreateParticipant(
|
741
721
|
id: string,
|
742
722
|
info?: ParticipantInfo,
|
743
723
|
): RemoteParticipant {
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
.
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
track.on(TrackEvent.AudioPlaybackFailed, this.handleAudioPlaybackFailed);
|
765
|
-
}
|
766
|
-
this.emit(RoomEvent.TrackSubscribed, track, publication, participant);
|
724
|
+
let participant = this.participants.get(id);
|
725
|
+
if (!participant) {
|
726
|
+
// it's possible for the RTC track to arrive before signaling data
|
727
|
+
// when this happens, we'll create the participant and make the track work
|
728
|
+
if (info) {
|
729
|
+
participant = RemoteParticipant.fromParticipantInfo(
|
730
|
+
this.engine.client,
|
731
|
+
info,
|
732
|
+
);
|
733
|
+
} else {
|
734
|
+
participant = new RemoteParticipant(this.engine.client, id, '');
|
735
|
+
}
|
736
|
+
this.participants.set(id, participant);
|
737
|
+
// also forward events
|
738
|
+
|
739
|
+
// trackPublished is only fired for tracks added after both local participant
|
740
|
+
// and remote participant joined the room
|
741
|
+
participant
|
742
|
+
.on(ParticipantEvent.TrackPublished, (trackPublication: RemoteTrackPublication) => {
|
743
|
+
this.emit(RoomEvent.TrackPublished, trackPublication, participant);
|
767
744
|
})
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
745
|
+
.on(ParticipantEvent.TrackSubscribed,
|
746
|
+
(track: RemoteTrack, publication: RemoteTrackPublication) => {
|
747
|
+
// monitor playback status
|
748
|
+
if (track.kind === Track.Kind.Audio) {
|
749
|
+
track.on(TrackEvent.AudioPlaybackStarted, this.handleAudioPlaybackStarted);
|
750
|
+
track.on(TrackEvent.AudioPlaybackFailed, this.handleAudioPlaybackFailed);
|
751
|
+
}
|
752
|
+
this.emit(RoomEvent.TrackSubscribed, track, publication, participant);
|
753
|
+
})
|
754
|
+
.on(ParticipantEvent.TrackUnpublished, (publication: RemoteTrackPublication) => {
|
755
|
+
this.emit(RoomEvent.TrackUnpublished, publication, participant);
|
774
756
|
})
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
757
|
+
.on(ParticipantEvent.TrackUnsubscribed,
|
758
|
+
(track: RemoteTrack, publication: RemoteTrackPublication) => {
|
759
|
+
this.emit(RoomEvent.TrackUnsubscribed, track, publication, participant);
|
760
|
+
})
|
761
|
+
.on(ParticipantEvent.TrackSubscriptionFailed, (sid: string) => {
|
762
|
+
this.emit(RoomEvent.TrackSubscriptionFailed, sid, participant);
|
763
|
+
})
|
764
|
+
.on(ParticipantEvent.TrackMuted, (pub: TrackPublication) => {
|
765
|
+
this.emit(RoomEvent.TrackMuted, pub, participant);
|
766
|
+
})
|
767
|
+
.on(ParticipantEvent.TrackUnmuted, (pub: TrackPublication) => {
|
768
|
+
this.emit(RoomEvent.TrackUnmuted, pub, participant);
|
769
|
+
})
|
770
|
+
.on(ParticipantEvent.MetadataChanged, (metadata: any) => {
|
771
|
+
this.emit(RoomEvent.MetadataChanged, metadata, participant);
|
772
|
+
})
|
773
|
+
.on(ParticipantEvent.ParticipantMetadataChanged, (metadata: any) => {
|
774
|
+
this.emit(RoomEvent.ParticipantMetadataChanged, metadata, participant);
|
775
|
+
})
|
776
|
+
.on(ParticipantEvent.ConnectionQualityChanged, (quality: ConnectionQuality) => {
|
777
|
+
this.emit(RoomEvent.ConnectionQualityChanged, quality, participant);
|
778
|
+
});
|
779
|
+
}
|
793
780
|
return participant;
|
794
781
|
}
|
795
782
|
|
@@ -843,74 +830,11 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
|
|
843
830
|
}
|
844
831
|
}
|
845
832
|
|
846
|
-
|
847
|
-
emit
|
848
|
-
event: E, ...args: Parameters<RoomEventCallbacks[E]>
|
849
|
-
): boolean {
|
833
|
+
/** @internal */
|
834
|
+
emit(event: string | symbol, ...args: any[]): boolean {
|
850
835
|
log.debug('room event', event, ...args);
|
851
836
|
return super.emit(event, ...args);
|
852
837
|
}
|
853
838
|
}
|
854
839
|
|
855
840
|
export default Room;
|
856
|
-
|
857
|
-
export type RoomEventCallbacks = {
|
858
|
-
reconnecting: () => void,
|
859
|
-
reconnected: () => void,
|
860
|
-
disconnected: () => void,
|
861
|
-
stateChanged: (state: RoomState) => void,
|
862
|
-
mediaDevicesChanged: () => void,
|
863
|
-
participantConnected: (participant: RemoteParticipant) => void,
|
864
|
-
participantDisconnected: (participant: RemoteParticipant) => void,
|
865
|
-
trackPublished: (publication: RemoteTrackPublication, participant: RemoteParticipant) => void,
|
866
|
-
trackSubscribed: (
|
867
|
-
track: RemoteTrack,
|
868
|
-
publication: RemoteTrackPublication,
|
869
|
-
participant: RemoteParticipant
|
870
|
-
) => void,
|
871
|
-
trackSubscriptionFailed: (trackSid: string, participant: RemoteParticipant) => void,
|
872
|
-
trackUnpublished: (publication: RemoteTrackPublication, participant: RemoteParticipant) => void,
|
873
|
-
trackUnsubscribed: (
|
874
|
-
track: RemoteTrack,
|
875
|
-
publication: RemoteTrackPublication,
|
876
|
-
participant: RemoteParticipant,
|
877
|
-
) => void,
|
878
|
-
trackMuted: (publication: TrackPublication, participant: Participant) => void,
|
879
|
-
trackUnmuted: (publication: TrackPublication, participant: Participant) => void,
|
880
|
-
localTrackPublished: (publication: LocalTrackPublication, participant: LocalParticipant) => void,
|
881
|
-
localTrackUnpublished: (
|
882
|
-
publication: LocalTrackPublication,
|
883
|
-
participant: LocalParticipant
|
884
|
-
) => void,
|
885
|
-
/**
|
886
|
-
* @deprecated use [[participantMetadataChanged]] instead
|
887
|
-
*/
|
888
|
-
metadataChanged: (
|
889
|
-
metadata: string | undefined,
|
890
|
-
participant?: RemoteParticipant | LocalParticipant
|
891
|
-
) => void,
|
892
|
-
participantMetadataChanged: (
|
893
|
-
metadata: string | undefined,
|
894
|
-
participant: RemoteParticipant | LocalParticipant
|
895
|
-
) => void,
|
896
|
-
activeSpeakersChanged: (speakers: Array<Participant>) => void,
|
897
|
-
roomMetadataChanged: (metadata: string) => void,
|
898
|
-
dataReceived: (
|
899
|
-
payload: Uint8Array,
|
900
|
-
participant?: RemoteParticipant,
|
901
|
-
kind?: DataPacket_Kind
|
902
|
-
) => void,
|
903
|
-
connectionQualityChanged: (quality: ConnectionQuality, participant: Participant) => void,
|
904
|
-
mediaDevicesError: (error: Error) => void,
|
905
|
-
trackStreamStateChanged: (
|
906
|
-
publication: RemoteTrackPublication,
|
907
|
-
streamState: Track.StreamState,
|
908
|
-
participant: RemoteParticipant,
|
909
|
-
) => void,
|
910
|
-
trackSubscriptionPermissionChanged: (
|
911
|
-
publication: RemoteTrackPublication,
|
912
|
-
status: TrackPublication.SubscriptionStatus,
|
913
|
-
participant: RemoteParticipant,
|
914
|
-
) => void,
|
915
|
-
audioPlaybackChanged: (playing: boolean) => void,
|
916
|
-
};
|
package/src/room/events.ts
CHANGED
@@ -7,7 +7,6 @@
|
|
7
7
|
* room.on(RoomEvent.TrackPublished, (track, publication, participant) => {})
|
8
8
|
* ```
|
9
9
|
*/
|
10
|
-
|
11
10
|
export enum RoomEvent {
|
12
11
|
/**
|
13
12
|
* When the connection to the server has been interrupted and it's attempting
|
@@ -26,13 +25,6 @@ export enum RoomEvent {
|
|
26
25
|
*/
|
27
26
|
Disconnected = 'disconnected',
|
28
27
|
|
29
|
-
/**
|
30
|
-
* Whenever the connection state of the room changes
|
31
|
-
*
|
32
|
-
* args: ([[RoomState]])
|
33
|
-
*/
|
34
|
-
StateChanged = 'stateChanged',
|
35
|
-
|
36
28
|
/**
|
37
29
|
* When input or output devices on the machine have changed.
|
38
30
|
*/
|
@@ -154,7 +146,7 @@ export enum RoomEvent {
|
|
154
146
|
* args: (prevMetadata: string, [[Participant]])
|
155
147
|
*
|
156
148
|
*/
|
157
|
-
ParticipantMetadataChanged = '
|
149
|
+
ParticipantMetadataChanged = 'participantMetaDataChanged',
|
158
150
|
|
159
151
|
/**
|
160
152
|
* Room metadata is a simple way for app-specific state to be pushed to
|
@@ -374,7 +366,6 @@ export enum ParticipantEvent {
|
|
374
366
|
|
375
367
|
/** @internal */
|
376
368
|
export enum EngineEvent {
|
377
|
-
TransportsCreated = 'transportsCreated',
|
378
369
|
Connected = 'connected',
|
379
370
|
Disconnected = 'disconnected',
|
380
371
|
Resuming = 'resuming',
|
@@ -1,12 +1,8 @@
|
|
1
1
|
import { EventEmitter } from 'events';
|
2
|
-
import
|
3
|
-
import { ConnectionQuality as ProtoQuality, DataPacket_Kind, ParticipantInfo } from '../../proto/livekit_models';
|
2
|
+
import { ConnectionQuality as ProtoQuality, ParticipantInfo } from '../../proto/livekit_models';
|
4
3
|
import { ParticipantEvent, TrackEvent } from '../events';
|
5
|
-
import LocalTrackPublication from '../track/LocalTrackPublication';
|
6
|
-
import RemoteTrackPublication from '../track/RemoteTrackPublication';
|
7
4
|
import { Track } from '../track/Track';
|
8
5
|
import { TrackPublication } from '../track/TrackPublication';
|
9
|
-
import { RemoteTrack } from '../track/types';
|
10
6
|
|
11
7
|
export enum ConnectionQuality {
|
12
8
|
Excellent = 'excellent',
|
@@ -28,9 +24,7 @@ function qualityFromProto(q: ProtoQuality): ConnectionQuality {
|
|
28
24
|
}
|
29
25
|
}
|
30
26
|
|
31
|
-
export default class Participant extends
|
32
|
-
EventEmitter as new () => TypedEmitter<ParticipantEventCallbacks>
|
33
|
-
) {
|
27
|
+
export default class Participant extends EventEmitter {
|
34
28
|
protected participantInfo?: ParticipantInfo;
|
35
29
|
|
36
30
|
audioTracks: Map<string, TrackPublication>;
|
@@ -164,8 +158,8 @@ export default class Participant extends (
|
|
164
158
|
this.metadata = md;
|
165
159
|
|
166
160
|
if (changed) {
|
167
|
-
this.emit(ParticipantEvent.MetadataChanged, prevMetadata);
|
168
|
-
this.emit(ParticipantEvent.ParticipantMetadataChanged, prevMetadata);
|
161
|
+
this.emit(ParticipantEvent.MetadataChanged, prevMetadata, this);
|
162
|
+
this.emit(ParticipantEvent.ParticipantMetadataChanged, prevMetadata, this);
|
169
163
|
}
|
170
164
|
}
|
171
165
|
|
@@ -218,32 +212,3 @@ export default class Participant extends (
|
|
218
212
|
}
|
219
213
|
}
|
220
214
|
}
|
221
|
-
|
222
|
-
export type ParticipantEventCallbacks = {
|
223
|
-
trackPublished: (publication: RemoteTrackPublication) => void,
|
224
|
-
trackSubscribed: (track: RemoteTrack, publication: RemoteTrackPublication) => void,
|
225
|
-
trackSubscriptionFailed: (trackSid: string) => void,
|
226
|
-
trackUnpublished: (publication: RemoteTrackPublication) => void,
|
227
|
-
trackUnsubscribed: (track: RemoteTrack, publication: RemoteTrackPublication) => void,
|
228
|
-
trackMuted: (publication: TrackPublication) => void,
|
229
|
-
trackUnmuted: (publication: TrackPublication) => void,
|
230
|
-
localTrackPublished: (publication: LocalTrackPublication) => void,
|
231
|
-
localTrackUnpublished: (publication: LocalTrackPublication) => void,
|
232
|
-
/**
|
233
|
-
* @deprecated use [[participantMetadataChanged]] instead
|
234
|
-
*/
|
235
|
-
metadataChanged: (prevMetadata: string | undefined, participant?: any) => void,
|
236
|
-
participantMetadataChanged: (prevMetadata: string | undefined, participant?: any) => void,
|
237
|
-
dataReceived: (payload: Uint8Array, kind: DataPacket_Kind) => void,
|
238
|
-
isSpeakingChanged: (speaking: boolean) => void,
|
239
|
-
connectionQualityChanged: (connectionQuality: ConnectionQuality) => void,
|
240
|
-
trackStreamStateChanged: (
|
241
|
-
publication: RemoteTrackPublication,
|
242
|
-
streamState: Track.StreamState
|
243
|
-
) => void,
|
244
|
-
trackSubscriptionPermissionChanged: (
|
245
|
-
publication: RemoteTrackPublication,
|
246
|
-
status: TrackPublication.SubscriptionStatus
|
247
|
-
) => void,
|
248
|
-
mediaDevicesError: (error: Error) => void,
|
249
|
-
};
|
@@ -10,8 +10,9 @@ import RemoteAudioTrack from '../track/RemoteAudioTrack';
|
|
10
10
|
import RemoteTrackPublication from '../track/RemoteTrackPublication';
|
11
11
|
import RemoteVideoTrack from '../track/RemoteVideoTrack';
|
12
12
|
import { Track } from '../track/Track';
|
13
|
+
import { TrackPublication } from '../track/TrackPublication';
|
13
14
|
import { RemoteTrack } from '../track/types';
|
14
|
-
import Participant
|
15
|
+
import Participant from './Participant';
|
15
16
|
|
16
17
|
export default class RemoteParticipant extends Participant {
|
17
18
|
audioTracks: Map<string, RemoteTrackPublication>;
|
@@ -41,7 +42,7 @@ export default class RemoteParticipant extends Participant {
|
|
41
42
|
this.videoTracks = new Map();
|
42
43
|
}
|
43
44
|
|
44
|
-
protected addTrackPublication(publication:
|
45
|
+
protected addTrackPublication(publication: TrackPublication) {
|
45
46
|
super.addTrackPublication(publication);
|
46
47
|
|
47
48
|
// register action events
|
@@ -233,10 +234,7 @@ export default class RemoteParticipant extends Participant {
|
|
233
234
|
}
|
234
235
|
|
235
236
|
/** @internal */
|
236
|
-
emit
|
237
|
-
event: E,
|
238
|
-
...args: Parameters<ParticipantEventCallbacks[E]>
|
239
|
-
): boolean {
|
237
|
+
emit(event: string | symbol, ...args: any[]): boolean {
|
240
238
|
log.trace('participant event', this.sid, event, ...args);
|
241
239
|
return super.emit(event, ...args);
|
242
240
|
}
|
@@ -195,9 +195,11 @@ export default class RemoteVideoTrack extends RemoteTrack {
|
|
195
195
|
let maxWidth = 0;
|
196
196
|
let maxHeight = 0;
|
197
197
|
for (const info of this.elementInfos) {
|
198
|
-
|
199
|
-
|
200
|
-
|
198
|
+
const currentElementWidth = info.element.clientWidth * (window.devicePixelRatio ?? 1);
|
199
|
+
const currentElementHeight = info.element.clientHeight * (window.devicePixelRatio ?? 1);
|
200
|
+
if (currentElementWidth + currentElementHeight > maxWidth + maxHeight) {
|
201
|
+
maxWidth = currentElementWidth;
|
202
|
+
maxHeight = currentElementHeight;
|
201
203
|
}
|
202
204
|
}
|
203
205
|
|
package/src/room/track/Track.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
import { EventEmitter } from 'events';
|
2
|
-
import type TypedEventEmitter from 'typed-emitter';
|
3
2
|
import { TrackSource, TrackType } from '../../proto/livekit_models';
|
4
3
|
import { StreamState as ProtoStreamState } from '../../proto/livekit_rtc';
|
5
4
|
import { TrackEvent } from '../events';
|
@@ -9,7 +8,7 @@ import { isFireFox, isSafari } from '../utils';
|
|
9
8
|
// Safari tracks which audio elements have been "blessed" by the user.
|
10
9
|
const recycledElements: Array<HTMLAudioElement> = [];
|
11
10
|
|
12
|
-
export class Track extends
|
11
|
+
export class Track extends EventEmitter {
|
13
12
|
kind: Track.Kind;
|
14
13
|
|
15
14
|
mediaStreamTrack: MediaStreamTrack;
|
@@ -308,16 +307,3 @@ export namespace Track {
|
|
308
307
|
}
|
309
308
|
}
|
310
309
|
}
|
311
|
-
|
312
|
-
export type TrackEventCallbacks = {
|
313
|
-
message: () => void,
|
314
|
-
muted: (track?: any) => void,
|
315
|
-
unmuted: (track?: any) => void,
|
316
|
-
ended: (track?: any) => void,
|
317
|
-
updateSettings: () => void,
|
318
|
-
updateSubscription: () => void,
|
319
|
-
audioPlaybackStarted: () => void,
|
320
|
-
audioPlaybackFailed: (error: Error) => void,
|
321
|
-
visibilityChanged: (visible: boolean, track?: any) => void,
|
322
|
-
videoDimensionsChanged: (dimensions: Track.Dimensions, track?: any) => void,
|
323
|
-
};
|
package/src/room/track/types.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import
|
2
|
-
import
|
3
|
-
import
|
4
|
-
import
|
1
|
+
import LocalAudioTrack from './LocalAudioTrack';
|
2
|
+
import LocalVideoTrack from './LocalVideoTrack';
|
3
|
+
import RemoteAudioTrack from './RemoteAudioTrack';
|
4
|
+
import RemoteVideoTrack from './RemoteVideoTrack';
|
5
5
|
|
6
6
|
export type RemoteTrack = RemoteAudioTrack | RemoteVideoTrack;
|
7
7
|
export type AudioTrack = RemoteAudioTrack | LocalAudioTrack;
|
package/src/version.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export const version = '0.16.
|
1
|
+
export const version = '0.16.5';
|
2
2
|
export const protocolVersion = 6;
|