livekit-client 1.2.5 → 1.2.8
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/livekit-client.esm.mjs +30 -17
- 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/room/Room.d.ts.map +1 -1
- package/dist/src/room/track/RemoteAudioTrack.d.ts +1 -1
- package/dist/src/room/track/RemoteAudioTrack.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/room/Room.ts +9 -10
- package/src/room/track/RemoteAudioTrack.ts +15 -5
@@ -10357,7 +10357,7 @@ function computeBitrate(currentStats, prevStats) {
|
|
10357
10357
|
return (bytesNow - bytesPrev) * 8 * 1000 / (currentStats.timestamp - prevStats.timestamp);
|
10358
10358
|
}
|
10359
10359
|
|
10360
|
-
var version$1 = "1.2.
|
10360
|
+
var version$1 = "1.2.8";
|
10361
10361
|
|
10362
10362
|
const version = version$1;
|
10363
10363
|
const protocolVersion = 8;
|
@@ -12558,8 +12558,6 @@ class RemoteAudioTrack extends RemoteTrack {
|
|
12558
12558
|
this.monitorReceiver();
|
12559
12559
|
}, monitorFrequency);
|
12560
12560
|
};
|
12561
|
-
|
12562
|
-
this.elementVolume = 1;
|
12563
12561
|
}
|
12564
12562
|
/**
|
12565
12563
|
* sets the volume for all attached audio elements
|
@@ -12574,12 +12572,22 @@ class RemoteAudioTrack extends RemoteTrack {
|
|
12574
12572
|
this.elementVolume = volume;
|
12575
12573
|
}
|
12576
12574
|
/**
|
12577
|
-
* gets the volume
|
12575
|
+
* gets the volume of attached audio elements (loudest)
|
12578
12576
|
*/
|
12579
12577
|
|
12580
12578
|
|
12581
12579
|
getVolume() {
|
12582
|
-
|
12580
|
+
if (this.elementVolume) {
|
12581
|
+
return this.elementVolume;
|
12582
|
+
}
|
12583
|
+
|
12584
|
+
let highestVolume = 0;
|
12585
|
+
this.attachedElements.forEach(element => {
|
12586
|
+
if (element.volume > highestVolume) {
|
12587
|
+
highestVolume = element.volume;
|
12588
|
+
}
|
12589
|
+
});
|
12590
|
+
return highestVolume;
|
12583
12591
|
}
|
12584
12592
|
|
12585
12593
|
attach(element) {
|
@@ -12589,7 +12597,10 @@ class RemoteAudioTrack extends RemoteTrack {
|
|
12589
12597
|
super.attach(element);
|
12590
12598
|
}
|
12591
12599
|
|
12592
|
-
|
12600
|
+
if (this.elementVolume) {
|
12601
|
+
element.volume = this.elementVolume;
|
12602
|
+
}
|
12603
|
+
|
12593
12604
|
return element;
|
12594
12605
|
}
|
12595
12606
|
|
@@ -21097,6 +21108,7 @@ class Room extends events.exports.EventEmitter {
|
|
21097
21108
|
this.recreateEngine();
|
21098
21109
|
this.handleDisconnect(this.options.stopLocalTrackOnUnpublish);
|
21099
21110
|
reject(new ConnectionError('could not establish signal connection'));
|
21111
|
+
return;
|
21100
21112
|
} // don't return until ICE connected
|
21101
21113
|
|
21102
21114
|
|
@@ -21134,9 +21146,8 @@ class Room extends events.exports.EventEmitter {
|
|
21134
21146
|
this.setAndEmitConnectionState(ConnectionState.Connected);
|
21135
21147
|
resolve();
|
21136
21148
|
});
|
21137
|
-
});
|
21149
|
+
}).finally(() => this.connectFuture = undefined);
|
21138
21150
|
this.connectFuture = new Future(connectPromise);
|
21139
|
-
this.connectFuture.promise.finally(() => this.connectFuture = undefined);
|
21140
21151
|
return this.connectFuture.promise;
|
21141
21152
|
};
|
21142
21153
|
/**
|
@@ -21265,10 +21276,7 @@ class Room extends events.exports.EventEmitter {
|
|
21265
21276
|
|
21266
21277
|
if (info.state === ParticipantInfo_State.DISCONNECTED) {
|
21267
21278
|
this.handleParticipantDisconnected(info.sid, remoteParticipant);
|
21268
|
-
} else if (isNewParticipant) {
|
21269
|
-
// fire connected event
|
21270
|
-
this.emitWhenConnected(RoomEvent.ParticipantConnected, remoteParticipant);
|
21271
|
-
} else {
|
21279
|
+
} else if (!isNewParticipant) {
|
21272
21280
|
// just update, no events
|
21273
21281
|
remoteParticipant.updateInfo(info);
|
21274
21282
|
}
|
@@ -21712,13 +21720,15 @@ class Room extends events.exports.EventEmitter {
|
|
21712
21720
|
}
|
21713
21721
|
|
21714
21722
|
onTrackAdded(mediaTrack, stream, receiver) {
|
21715
|
-
// don't fire onSubscribed when connecting
|
21723
|
+
var _a, _b; // don't fire onSubscribed when connecting
|
21716
21724
|
// WebRTC fires onTrack as soon as setRemoteDescription is called on the offer
|
21717
21725
|
// at that time, ICE connectivity has not been established so the track is not
|
21718
21726
|
// technically subscribed.
|
21719
21727
|
// We'll defer these events until when the room is connected or eventually disconnected.
|
21720
|
-
|
21721
|
-
|
21728
|
+
|
21729
|
+
|
21730
|
+
if (this.connectFuture || this.reconnectFuture) {
|
21731
|
+
Promise.allSettled([(_a = this.connectFuture) === null || _a === void 0 ? void 0 : _a.promise, (_b = this.reconnectFuture) === null || _b === void 0 ? void 0 : _b.promise]).then(() => {
|
21722
21732
|
this.onTrackAdded(mediaTrack, stream, receiver);
|
21723
21733
|
});
|
21724
21734
|
return;
|
@@ -21767,9 +21777,9 @@ class Room extends events.exports.EventEmitter {
|
|
21767
21777
|
if (this.connectFuture === this.reconnectFuture) {
|
21768
21778
|
(_a = this.connectFuture) === null || _a === void 0 ? void 0 : _a.reject(undefined);
|
21769
21779
|
this.connectFuture = undefined;
|
21770
|
-
this.reconnectFuture = undefined;
|
21771
21780
|
}
|
21772
21781
|
|
21782
|
+
this.reconnectFuture = undefined;
|
21773
21783
|
this.participants.forEach(p => {
|
21774
21784
|
p.tracks.forEach(pub => {
|
21775
21785
|
p.unpublishTrack(pub.trackSid);
|
@@ -21860,7 +21870,10 @@ class Room extends events.exports.EventEmitter {
|
|
21860
21870
|
this.participants.set(id, participant);
|
21861
21871
|
|
21862
21872
|
if (info) {
|
21863
|
-
this.identityToSid.set(info.identity, info.sid);
|
21873
|
+
this.identityToSid.set(info.identity, info.sid); // if we have valid info and the participant wasn't in the map before, we can assume the participant is new
|
21874
|
+
// firing here to make sure that `ParticipantConnected` fires before the initial track events
|
21875
|
+
|
21876
|
+
this.emitWhenConnected(RoomEvent.ParticipantConnected, participant);
|
21864
21877
|
} // also forward events
|
21865
21878
|
// trackPublished is only fired for tracks added after both local participant
|
21866
21879
|
// and remote participant joined the room
|