@vkontakte/calls-sdk 2.8.12-dev.c60cf16f.0 → 2.8.12-dev.dd6d67c5.0
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/CallsSDK.d.ts +3 -0
- package/abstract/BaseApi.d.ts +1 -1
- package/calls-sdk.cjs.js +9 -9
- package/calls-sdk.esm.js +258 -283
- package/classes/Conversation.d.ts +3 -2
- package/classes/DisplayLayoutRequester.d.ts +1 -1
- package/default/Api.d.ts +1 -1
- package/package.json +1 -1
- package/types/ExternalId.d.ts +2 -1
package/calls-sdk.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @vkontakte/calls-sdk v2.8.12-dev.
|
|
3
|
-
* Mon, 03 Aug 2026
|
|
2
|
+
* @vkontakte/calls-sdk v2.8.12-dev.dd6d67c5.0
|
|
3
|
+
* Mon, 03 Aug 2026 18:45:54 GMT
|
|
4
4
|
* https://calls-sdk.cdn-vk.ru/doc/latest/index.html
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -1781,7 +1781,7 @@ var on = 533, sn = "a=fmtp:", cn = "sps-pps-idr-in-keyframe=1", ln;
|
|
|
1781
1781
|
}
|
|
1782
1782
|
}
|
|
1783
1783
|
e.getPeerConnectionHostInfo = te;
|
|
1784
|
-
let ne =
|
|
1784
|
+
let ne = /^-?[0-9]+$/, re = /^([gu])(-?[0-9]+)$/;
|
|
1785
1785
|
function ie(e, t = A.USER) {
|
|
1786
1786
|
let n = String(e);
|
|
1787
1787
|
return re.test(n) ? (R.warn(`Already composite id [${e}] type supplied [${t}]`), n) : t === A.GROUP ? "g" + n : t === A.USER ? "u" + n : (R.warn(`Unknown type [${t}] for id [${e}]`), n.match(ne) ? "u" + n : n);
|
|
@@ -2159,7 +2159,7 @@ var mn = pn.getInstance(), M = class e {
|
|
|
2159
2159
|
return 1.1;
|
|
2160
2160
|
}
|
|
2161
2161
|
static get sdkVersion() {
|
|
2162
|
-
return "2.8.12-dev.
|
|
2162
|
+
return "2.8.12-dev.dd6d67c5.0";
|
|
2163
2163
|
}
|
|
2164
2164
|
static get debug() {
|
|
2165
2165
|
return e._params.debug;
|
|
@@ -4021,10 +4021,10 @@ var Tr = class {
|
|
|
4021
4021
|
setRemoteHold(e) {
|
|
4022
4022
|
if (this._remoteHold !== e) {
|
|
4023
4023
|
if (this._remoteHold = e, e) {
|
|
4024
|
-
this._stopReconnection(), this._stopStatInterval(), this._stopSettingsInterval(), this.
|
|
4024
|
+
this._stopReconnection(), this._stopStatInterval(), this._stopSettingsInterval(), this._disposePeerConnection(), this._remoteSDP = {}, this._remoteCandidates = {}, this._lastRemoteSDP = null;
|
|
4025
4025
|
return;
|
|
4026
4026
|
}
|
|
4027
|
-
this.
|
|
4027
|
+
this._recreatePeerConnection();
|
|
4028
4028
|
}
|
|
4029
4029
|
}
|
|
4030
4030
|
_recreatePeerConnection() {
|
|
@@ -7598,14 +7598,15 @@ var Wa = Ua, Ga = /* @__PURE__ */ function(e) {
|
|
|
7598
7598
|
e.fromId = n;
|
|
7599
7599
|
function r(e, t = !0, n = !1) {
|
|
7600
7600
|
let r = t ? e.decorativeExternalUserId : e.externalId, a = e.deviceIdx ?? 0;
|
|
7601
|
-
if (r) return i(r, a);
|
|
7602
|
-
if (n && t && e.externalId) return i(e.externalId, a);
|
|
7601
|
+
if (r) return i(r, a, e.idType);
|
|
7602
|
+
if (n && t && e.externalId) return i(e.externalId, a, e.idType);
|
|
7603
7603
|
}
|
|
7604
7604
|
e.fromSignalingParticipant = r;
|
|
7605
|
-
function i(e, t = 0) {
|
|
7605
|
+
function i(e, t = 0, n) {
|
|
7606
|
+
let r = n === A.GROUP ? "GROUP" : e.type === "ANONYM" ? "ANONYM" : "USER";
|
|
7606
7607
|
return {
|
|
7607
7608
|
id: e.id,
|
|
7608
|
-
type:
|
|
7609
|
+
type: r,
|
|
7609
7610
|
deviceIdx: t
|
|
7610
7611
|
};
|
|
7611
7612
|
}
|
|
@@ -7920,7 +7921,7 @@ var oo = 90, so = 3, co = class extends y {
|
|
|
7920
7921
|
this._pendingRequests = null, this._pendingPromises = [];
|
|
7921
7922
|
let r = {};
|
|
7922
7923
|
try {
|
|
7923
|
-
r =
|
|
7924
|
+
r = this._getRequestLayouts(t);
|
|
7924
7925
|
let i = this._forceNextFlush || Object.keys(this._uncertainLayouts).length > 0;
|
|
7925
7926
|
this._forceNextFlush = !1;
|
|
7926
7927
|
let a = this._getDiff(r, i);
|
|
@@ -7934,8 +7935,8 @@ var oo = 90, so = 3, co = class extends y {
|
|
|
7934
7935
|
e === this._generation && (this._lastFlushAt = Date.now(), this._inFlight = !1, this._pendingRequests && this._schedule());
|
|
7935
7936
|
}
|
|
7936
7937
|
}
|
|
7937
|
-
|
|
7938
|
-
let t = {}, n =
|
|
7938
|
+
_getRequestLayouts(e) {
|
|
7939
|
+
let t = {}, n = this._getParticipants();
|
|
7939
7940
|
for (let r of e) {
|
|
7940
7941
|
let e = typeof r.uid == "object" ? r.uid : Z.fromId(r.uid), i = this._api.getCachedOkIdByExternalId(e);
|
|
7941
7942
|
if (!i) {
|
|
@@ -8791,12 +8792,12 @@ var Eo = class {
|
|
|
8791
8792
|
conversationId: u
|
|
8792
8793
|
});
|
|
8793
8794
|
if (!this._conversation) throw new O(D.UNKNOWN_ERROR);
|
|
8794
|
-
if (this._participantState = X.ACCEPTED, this._changeMediaSettings(l), await this._processConnection(d),
|
|
8795
|
+
if (this._participantState = X.ACCEPTED, this._changeMediaSettings(l), await this._processConnection(d), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener(), this._signaling.readyToSend(), this._delayedHangup) throw new O(D.CANCELED);
|
|
8795
8796
|
return this._debug.debug("Outgoing call", {
|
|
8796
8797
|
opponentIds: e,
|
|
8797
8798
|
opponentType: t,
|
|
8798
8799
|
mediaOptions: n
|
|
8799
|
-
}),
|
|
8800
|
+
}), this._processConnectionSharedMovieInfo(d), this._processConversationUrlSharingInfo(d), L.onLocalStream(this._mediaSource.getStream(), this._mediaSource.mediaSettings, this.id), L.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), this._getMainRoomParticipants(), void 0, this.id), this._onConversationParticipantListChunk(d), this._processPinnedParticipants(d), L.onLocalStatus(N.WAITING, this.id), this._toggleJoinAvailability(), this._changeFeatureSet(), this._changeNeedRate(), z.add(this), await z.setActive(this.id), zo = null, this._conversation.concurrent && await this._acceptConcurrent(), f && !this._registeredPeerReceived && this._state !== "CLOSE" && (this._calleeUnavailableTimer = window.setTimeout(() => {
|
|
8800
8801
|
this._calleeUnavailableTimer = null, this._signaling.ready && this._signaling.hangup(D.CANCELED), this._close(new O(D.CALLEE_UNAVAILABLE));
|
|
8801
8802
|
}, f)), this._conversation;
|
|
8802
8803
|
} catch (e) {
|
|
@@ -8825,28 +8826,27 @@ var Eo = class {
|
|
|
8825
8826
|
this._debug.debug("Join conversation part 2");
|
|
8826
8827
|
try {
|
|
8827
8828
|
if (this._participantState = X.ACCEPTED, !this._conversation || !this._mediaSource) throw new O(D.UNKNOWN_ERROR);
|
|
8828
|
-
if (this._statFirstMediaReceived.markOnJoin(this._conversation.topology), !n && !this._conversation.observer && !this._isAudienceModeListener() && this._changeMediaSettings(this._mediaSource.mediaSettings), await this._processConnection(e), t && (
|
|
8829
|
+
if (this._statFirstMediaReceived.markOnJoin(this._conversation.topology), !n && !this._conversation.observer && !this._isAudienceModeListener() && this._changeMediaSettings(this._mediaSource.mediaSettings), await this._processConnection(e), t && (this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener()), this._signaling.readyToSend(), this._state === "CLOSE") return this._conversation;
|
|
8829
8830
|
if (this._delayedHangup) throw new O(D.CANCELED);
|
|
8830
|
-
|
|
8831
|
-
let r =
|
|
8832
|
-
L.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(),
|
|
8831
|
+
this._processConnectionSharedMovieInfo(e), this._processConversationUrlSharingInfo(e), this._processConnectionAsrInfo(e);
|
|
8832
|
+
let r = this._extractExternalRoomsData(e.rooms?.rooms, e.rooms?.roomId);
|
|
8833
|
+
L.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), this._getMainRoomParticipants(), r, this.id), this._onConversationParticipantListChunk(e), this._processPinnedParticipants(e), L.onLocalStatus(N.WAITING, this.id), this._toggleJoinAvailability(), this._changeNeedRate(), t && (this._state = "ACTIVE"), this._changeFeatureSet(), t && (z.has(this.id) || z.add(this), n ? await this._holdLocally() : await z.setActive(this.id), zo = null);
|
|
8833
8834
|
let i = this._extractLocalParticipantFromConnection(e);
|
|
8834
8835
|
if (i) {
|
|
8835
8836
|
let e = j.mapParticipantState(i);
|
|
8836
8837
|
Object.keys(e).length > 0 && L.onLocalParticipantState(e, !1, this.id);
|
|
8837
8838
|
}
|
|
8838
|
-
return t && this._openTransport(Object.values(
|
|
8839
|
+
return t && this._openTransport(Object.values(this._getParticipants()), !1), this._conversation;
|
|
8839
8840
|
} catch (e) {
|
|
8840
8841
|
throw zo = null, this._close(e, "Unable to join conversation"), e;
|
|
8841
8842
|
}
|
|
8842
8843
|
}
|
|
8843
|
-
|
|
8844
|
-
|
|
8845
|
-
return (await Promise.all(t)).filter((e) => !!e);
|
|
8844
|
+
_extractExternalRooms(e) {
|
|
8845
|
+
return e.map(this._convertRoomToExternal.bind(this)).filter((e) => !!e);
|
|
8846
8846
|
}
|
|
8847
|
-
|
|
8847
|
+
_extractExternalRoomsData(e, t) {
|
|
8848
8848
|
if (!e || !e.length) return;
|
|
8849
|
-
let n = { rooms:
|
|
8849
|
+
let n = { rooms: this._extractExternalRooms(e) };
|
|
8850
8850
|
return t && (n.roomId = t), n;
|
|
8851
8851
|
}
|
|
8852
8852
|
async onPush(e, t = A.USER, n, r, i) {
|
|
@@ -8860,7 +8860,7 @@ var Eo = class {
|
|
|
8860
8860
|
let a = await this._prepareConversation(e, t, n, r, i);
|
|
8861
8861
|
if (this._mediaSource = this._createMediaSource(), !this._conversation) throw new O(D.UNKNOWN_ERROR);
|
|
8862
8862
|
if (!a.conversation.participants.find((e) => e.state === X.CALLED && e.id === this._conversation?.userId)) throw this._debug.log("Push rejected (there is an active call)"), this._stats.logger.log(S.PUSH, "rejected"), new O(D.REJECTED);
|
|
8863
|
-
if (await this._processConnection(a), this._extractConnectionUrlSharingInfo(a),
|
|
8863
|
+
if (await this._processConnection(a), this._extractConnectionUrlSharingInfo(a), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener(), this._processPinnedParticipants(a), this._signaling.readyToSend(), this._stats.lifecycle.markCallStarted(), this._stats.logger.log(S.PUSH, "accepted"), z.add(this), zo = null, this._delayedHangup) throw new O(D.CANCELED);
|
|
8864
8864
|
} catch (e) {
|
|
8865
8865
|
throw zo = null, this._close(e, "Unable to handle inbound call push"), e;
|
|
8866
8866
|
}
|
|
@@ -8889,13 +8889,13 @@ var Eo = class {
|
|
|
8889
8889
|
let e = this._mediaSource.mediaSettings;
|
|
8890
8890
|
this._logWithMediaSettings(S.ACCEPT_CONCURRENT, e), this._debug.debug("Concurrent call", { conversationId: this._conversation.id });
|
|
8891
8891
|
try {
|
|
8892
|
-
this._statFirstMediaReceived.markAcceptCall(this._transport.getTopology()), await this._signaling.acceptCall(this._mediaSource.mediaSettings), this._stats.lifecycle.markIncomingAccepted(!0), L.onCallAccepted(this.id), this._state = "ACTIVE", this._participantState = X.ACCEPTED, this._changeFeatureSet(), this._openTransport(Object.values(
|
|
8892
|
+
this._statFirstMediaReceived.markAcceptCall(this._transport.getTopology()), await this._signaling.acceptCall(this._mediaSource.mediaSettings), this._stats.lifecycle.markIncomingAccepted(!0), L.onCallAccepted(this.id), this._state = "ACTIVE", this._participantState = X.ACCEPTED, this._changeFeatureSet(), this._openTransport(Object.values(this._getParticipants()), !0);
|
|
8893
8893
|
} catch (e) {
|
|
8894
8894
|
this._close(e, "Unable to accept concurrent call");
|
|
8895
8895
|
}
|
|
8896
8896
|
}
|
|
8897
|
-
|
|
8898
|
-
let e =
|
|
8897
|
+
_getMainRoomParticipants() {
|
|
8898
|
+
let e = this._getParticipants();
|
|
8899
8899
|
return j.mapSharedParticipants(Object.values(e).filter((e) => !e.isInRoom));
|
|
8900
8900
|
}
|
|
8901
8901
|
_decodeExternalConversationParams(e) {
|
|
@@ -8938,7 +8938,7 @@ var Eo = class {
|
|
|
8938
8938
|
}), this._registerParticipantLocalMuteState({ muteStates: this._conversation.muteStatesPersonal });
|
|
8939
8939
|
let i = await this._signaling.getRooms(this._isCallAdmin());
|
|
8940
8940
|
if (i.rooms?.rooms) {
|
|
8941
|
-
let e =
|
|
8941
|
+
let e = this._getParticipants();
|
|
8942
8942
|
i.rooms.rooms.forEach((t) => {
|
|
8943
8943
|
t.participantIds?.forEach((t) => {
|
|
8944
8944
|
e[t] && (e[t].isInRoom = !0);
|
|
@@ -8946,15 +8946,15 @@ var Eo = class {
|
|
|
8946
8946
|
});
|
|
8947
8947
|
}
|
|
8948
8948
|
this._conversation.roomId = i.rooms?.roomId || null;
|
|
8949
|
-
let a =
|
|
8950
|
-
if (L.onCallAccepted(this.id), L.onLocalStream(this._mediaSource.getStream(), t, this.id), L.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(),
|
|
8951
|
-
let e = await this._getInitialParticiapntListChunk(), t =
|
|
8949
|
+
let a = this._extractExternalRoomsData(i.rooms?.rooms, i.rooms?.roomId);
|
|
8950
|
+
if (L.onCallAccepted(this.id), L.onLocalStream(this._mediaSource.getStream(), t, this.id), L.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), this._getMainRoomParticipants(), a, this.id), await this._emitHeldParticipantsStatus(), M.useParticipantListChunk) {
|
|
8951
|
+
let e = await this._getInitialParticiapntListChunk(), t = this._getParticipants();
|
|
8952
8952
|
e?.participants?.forEach((e) => {
|
|
8953
8953
|
let n = t[j.composeId(e)];
|
|
8954
8954
|
n && (n.movieShareInfos = e.movieShareInfos);
|
|
8955
|
-
}),
|
|
8955
|
+
}), this._onConversationParticipantListChunk({ participants: e });
|
|
8956
8956
|
}
|
|
8957
|
-
return L.onLocalStatus(N.WAITING, this.id), this._toggleJoinAvailability(), this._changeNeedRate(), this._state = "ACTIVE", this._changeFeatureSet(), this._openTransport(Object.values(
|
|
8957
|
+
return L.onLocalStatus(N.WAITING, this.id), this._toggleJoinAvailability(), this._changeNeedRate(), this._state = "ACTIVE", this._changeFeatureSet(), this._openTransport(Object.values(this._getParticipants()), !0), this._processConversationUrlSharingInfo(), this._processConnectionAsrInfo(), z.setActive(this.id).catch((e) => {
|
|
8958
8958
|
this._debug.error(e), this._close(e, "Unable to activated accepted call");
|
|
8959
8959
|
}), this._conversation;
|
|
8960
8960
|
} catch (e) {
|
|
@@ -9052,12 +9052,12 @@ var Eo = class {
|
|
|
9052
9052
|
this._cleanupSignaling(), this._cleanupMediaSource();
|
|
9053
9053
|
return;
|
|
9054
9054
|
}
|
|
9055
|
-
this._state = "CLOSE", this._participantState = X.HUNGUP, this._changeFeatureSet(), this._cleanupMediaSource(),
|
|
9055
|
+
this._state = "CLOSE", this._participantState = X.HUNGUP, this._changeFeatureSet(), this._cleanupMediaSource(), this._cleanupParticipants(), this._cleanupParticipantAgnosticStreams(), this._cleanupTransport(), this._cleanupSpeakerDetector(), this._cleanupSpecListener(), this._cleanupSignaling(), this._api.cleanup(), this._api.setAbortSignal(void 0), this._signaling.setAbortSignal(void 0), this._stats.destroy(), z.remove(this.id), this._conversation = null, this._myLastRequestedLayouts = {}, this._displayLayoutRequester.clear(), this._delayedHangup = !1, this._abortController = null, L.onHangup(e || new O(D.UNKNOWN_ERROR), n);
|
|
9056
9056
|
}
|
|
9057
|
-
|
|
9057
|
+
destroy() {
|
|
9058
9058
|
this._clearCalleeUnavailableWatchdog();
|
|
9059
9059
|
let e = this._conversation && this._conversation.id;
|
|
9060
|
-
if (this._debug.debug("Destroy conversation", { conversationId: e }), this._stopFirstMediaSentProbe(), this._cooldownQueueCleanupTimer !== null && (window.clearInterval(this._cooldownQueueCleanupTimer), this._cooldownQueueCleanupTimer = null), this._state = "CLOSE", this._participantState = X.HUNGUP, this._cleanupMediaSource(),
|
|
9060
|
+
if (this._debug.debug("Destroy conversation", { conversationId: e }), this._stopFirstMediaSentProbe(), this._cooldownQueueCleanupTimer !== null && (window.clearInterval(this._cooldownQueueCleanupTimer), this._cooldownQueueCleanupTimer = null), this._state = "CLOSE", this._participantState = X.HUNGUP, this._cleanupMediaSource(), this._cleanupParticipants(), this._cleanupParticipantAgnosticStreams(), this._cleanupTransport(), this._cleanupSpeakerDetector(), this._cleanupSpecListener(), this._cleanupSignaling(), this._api.cleanup(), this._api.setAbortSignal(void 0), this._signaling.setAbortSignal(void 0), this._delayedHangup && e) try {
|
|
9061
9061
|
this._api.hangupConversation(e, D.CANCELED);
|
|
9062
9062
|
} catch {}
|
|
9063
9063
|
this._cleanupListeners(), this._stats.destroy(), z.remove(this.id), this._conversation = null, this._myLastRequestedLayouts = {}, this._displayLayoutRequester.clear(), this._delayedHangup = !1, this._abortController = null;
|
|
@@ -9152,7 +9152,7 @@ var Eo = class {
|
|
|
9152
9152
|
} else p = await this._api.startConversation(d, e, t, f, i, a, o, { onlyAdminCanShareMovie: s }, c), this._debug.debug("Api.startConversation", p);
|
|
9153
9153
|
this._setConversationParams(p), this._stats.lifecycle.bindConversationId(p.id), this._stats.lifecycle.markWarmupCompleted();
|
|
9154
9154
|
let m = await this._connectSignaling(dr.START, p);
|
|
9155
|
-
return
|
|
9155
|
+
return this._setConversation(p, m, n), this._stats.lifecycle.markCallStarted(), m;
|
|
9156
9156
|
}
|
|
9157
9157
|
async _joinConversation(e) {
|
|
9158
9158
|
W.setMark(H.SIGNALING_CONNECTED);
|
|
@@ -9205,7 +9205,7 @@ var Eo = class {
|
|
|
9205
9205
|
if (this._debug.debug("Api.joinConversation", l), l.id && this._stats.lifecycle.bindConversationId(l.id), ro(l, u), l.id && z.has(l.id)) throw new O(D.HAS_ACTIVE_CALL);
|
|
9206
9206
|
this._setConversationParams(l), this._stats.lifecycle.markWarmupCompleted();
|
|
9207
9207
|
let d = await this._connectSignaling(dr.JOIN, l);
|
|
9208
|
-
return
|
|
9208
|
+
return this._setConversation(l, d, Aa.JOINING), this._stats.lifecycle.markCallStarted(), d;
|
|
9209
9209
|
}
|
|
9210
9210
|
async _prepareConversation(e, t = A.USER, n, r, i) {
|
|
9211
9211
|
W.setMark(H.SIGNALING_CONNECTED), this._debug.debug("Conversation: push", {
|
|
@@ -9264,9 +9264,9 @@ var Eo = class {
|
|
|
9264
9264
|
}
|
|
9265
9265
|
this._stats.lifecycle.markWarmupCompleted();
|
|
9266
9266
|
let u = await this._connectSignaling(dr.ACCEPT, l);
|
|
9267
|
-
return z.callsLength >= M.maxParallelCalls || !M.hold && z.callsLength > 0 ? (this._debug.log("Push rejected (busy)"), this._stats.logger.log(S.PUSH, "busy"), this._signaling.ready && this._signaling.hangup(D.BUSY), Promise.reject(new O(D.BUSY))) : (
|
|
9267
|
+
return z.callsLength >= M.maxParallelCalls || !M.hold && z.callsLength > 0 ? (this._debug.log("Push rejected (busy)"), this._stats.logger.log(S.PUSH, "busy"), this._signaling.ready && this._signaling.hangup(D.BUSY), Promise.reject(new O(D.BUSY))) : (this._setConversation(l, u, Aa.INCOMING, t), u);
|
|
9268
9268
|
}
|
|
9269
|
-
|
|
9269
|
+
_createParticipant(e, t, n = !0) {
|
|
9270
9270
|
let r = Object.assign({
|
|
9271
9271
|
id: null,
|
|
9272
9272
|
externalId: null,
|
|
@@ -9286,12 +9286,12 @@ var Eo = class {
|
|
|
9286
9286
|
observedIds: [],
|
|
9287
9287
|
isInRoom: !1,
|
|
9288
9288
|
markers: null
|
|
9289
|
-
}, e);
|
|
9290
|
-
return
|
|
9289
|
+
}, e), i = !!r.externalId;
|
|
9290
|
+
return i || (r.externalId = this._getParticipantId(t ?? r.id)), n && i && this._api.cacheExternalId(t ?? r.id, r.externalId), t && this._api.mapDecorativeId(t, r.id), r.observedIds?.length && (r.externalId.observer = !0), e.markers && (r.markers = this._denormalizeMarkers(r.id, e.markers)), r.connectionStatus = Wa.create(r.connectionStatus), r;
|
|
9291
9291
|
}
|
|
9292
|
-
|
|
9292
|
+
_getParticipantId(e) {
|
|
9293
9293
|
try {
|
|
9294
|
-
return
|
|
9294
|
+
return this._api.userId(e);
|
|
9295
9295
|
} catch (e) {
|
|
9296
9296
|
throw this._close(new O(D.NETWORK_ERROR), e), e;
|
|
9297
9297
|
}
|
|
@@ -9306,7 +9306,7 @@ var Eo = class {
|
|
|
9306
9306
|
}
|
|
9307
9307
|
});
|
|
9308
9308
|
}
|
|
9309
|
-
|
|
9309
|
+
_setConversation(e, t, n, r = A.USER) {
|
|
9310
9310
|
let { participants: i } = t.conversation;
|
|
9311
9311
|
t.conversationParams?.serverTime && (this._serverTimeOffset = t.conversationParams.serverTime - Date.now()), this._cacheParticipantExternalIds(i);
|
|
9312
9312
|
let a = this._api.getUserId(), o = this._extractLocalParticipantFromConnection(t), s = e.device_idx || 0;
|
|
@@ -9318,7 +9318,7 @@ var Eo = class {
|
|
|
9318
9318
|
this._conversation = {
|
|
9319
9319
|
userId: a,
|
|
9320
9320
|
compositeUserId: c,
|
|
9321
|
-
externalId:
|
|
9321
|
+
externalId: this._getExternalIdByParticipantId(c),
|
|
9322
9322
|
acceptTime: t.conversation.acceptTime,
|
|
9323
9323
|
features: t.conversation.features || [],
|
|
9324
9324
|
featuresPerRole: t.conversation.featuresPerRole,
|
|
@@ -9365,9 +9365,9 @@ var Eo = class {
|
|
|
9365
9365
|
async _processConnection(e) {
|
|
9366
9366
|
await this._registerConnectionParticipants(e), this._processRooms(e), this._processMuteStates(e), this._processRecordInfos(e), this._onOptionsChanged(e.conversation.options), e.chatRoom && e.chatRoom.totalCount && this._onChatRoomUpdated(Ma.ATTENDEE, e.chatRoom.totalCount, e.chatRoom.firstParticipants, null, null);
|
|
9367
9367
|
}
|
|
9368
|
-
|
|
9368
|
+
_onConversationParticipantListChunk(e) {
|
|
9369
9369
|
let t = e.participants;
|
|
9370
|
-
t && L.onConversationParticipantListChunk(
|
|
9370
|
+
t && L.onConversationParticipantListChunk(this._participantListChunkToExternalChunk(this._createParticipantListChunk(t)), this.id);
|
|
9371
9371
|
}
|
|
9372
9372
|
_createParticipantListChunk(e) {
|
|
9373
9373
|
return {
|
|
@@ -9378,8 +9378,8 @@ var Eo = class {
|
|
|
9378
9378
|
...e
|
|
9379
9379
|
};
|
|
9380
9380
|
}
|
|
9381
|
-
|
|
9382
|
-
let t =
|
|
9381
|
+
_participantListChunkToExternalChunk(e) {
|
|
9382
|
+
let t = this._getParticipants(), n = j.mapSharedParticipants(e.participants.reduce((e, n) => {
|
|
9383
9383
|
let r = j.composeId(n);
|
|
9384
9384
|
return t[r] && e.push(t[r]), e;
|
|
9385
9385
|
}, []));
|
|
@@ -9397,7 +9397,7 @@ var Eo = class {
|
|
|
9397
9397
|
if (!this._conversation) return;
|
|
9398
9398
|
let n = e[0]?.externalId?.type;
|
|
9399
9399
|
n && (M.externalUserType = n);
|
|
9400
|
-
let r =
|
|
9400
|
+
let r = this._getParticipants();
|
|
9401
9401
|
for (let n of e) {
|
|
9402
9402
|
let e = j.composeId(n);
|
|
9403
9403
|
if (R.test("Conversation:RegisterParticipant", e), this._isMe(e)) {
|
|
@@ -9425,7 +9425,7 @@ var Eo = class {
|
|
|
9425
9425
|
movieShareInfos: n.movieShareInfos,
|
|
9426
9426
|
isInRoom: t
|
|
9427
9427
|
}, i);
|
|
9428
|
-
let a =
|
|
9428
|
+
let a = this._getParticipant(e);
|
|
9429
9429
|
a && n.roles && n.roles.length && (this._debug.debug(`Roles for participant [${e}] changed: ${n.roles}`), L.onRolesChanged(a.externalId, n.roles, !0, this.id)), a && a.isOnHold && L.onRemoteStatus([a.externalId], N.ONHOLD, null, this.id);
|
|
9430
9430
|
}
|
|
9431
9431
|
}
|
|
@@ -9470,10 +9470,10 @@ var Eo = class {
|
|
|
9470
9470
|
_registerParticipantInCache(e) {
|
|
9471
9471
|
return this._participants[e.id] = e, e;
|
|
9472
9472
|
}
|
|
9473
|
-
|
|
9474
|
-
let t =
|
|
9473
|
+
_getExistedParticipantByIdOrCreate(e) {
|
|
9474
|
+
let t = this._getParticipants()[e];
|
|
9475
9475
|
if (t) return t;
|
|
9476
|
-
let n = this._api.getDecorativeIdByInitialId(j.decomposeId(e).id), r = n ? j.composeUserId(n) : void 0, i =
|
|
9476
|
+
let n = this._api.getDecorativeIdByInitialId(j.decomposeId(e).id), r = n ? j.composeUserId(n) : void 0, i = this._getParticipantId(e), { deviceIdx: a } = j.decomposeParticipantId(e);
|
|
9477
9477
|
return this._createParticipant({
|
|
9478
9478
|
id: e,
|
|
9479
9479
|
externalId: {
|
|
@@ -9482,25 +9482,31 @@ var Eo = class {
|
|
|
9482
9482
|
}
|
|
9483
9483
|
}, r, !1);
|
|
9484
9484
|
}
|
|
9485
|
-
|
|
9485
|
+
_getExternalIdByParticipantId(e) {
|
|
9486
9486
|
if (this._isMe(e)) return this._conversation?.externalId;
|
|
9487
|
-
if (M.useParticipantListChunk) return
|
|
9488
|
-
let t =
|
|
9487
|
+
if (M.useParticipantListChunk) return this._getExistedParticipantByIdOrCreate(e).externalId;
|
|
9488
|
+
let t = this._getParticipants();
|
|
9489
9489
|
if (t[e]?.externalId) return t[e].externalId;
|
|
9490
9490
|
{
|
|
9491
|
-
let t =
|
|
9491
|
+
let t = this._getParticipantId(e);
|
|
9492
9492
|
return this._api.cacheExternalId(e, t), t;
|
|
9493
9493
|
}
|
|
9494
9494
|
}
|
|
9495
9495
|
_getExternalIdsByOkIdsFromCache(e) {
|
|
9496
9496
|
return e.map((e) => this._api.getCachedExternalIdByOkId(e) ?? Z.fromId(String(e)));
|
|
9497
9497
|
}
|
|
9498
|
-
|
|
9498
|
+
_getOrCacheExternalIdByCompositeId(e) {
|
|
9499
|
+
let t = j.extractOkId(e), n = this._api.getCachedExternalIdByOkId(t);
|
|
9500
|
+
if (n) return n;
|
|
9501
|
+
let { type: r } = j.decomposeId(e), i = Z.fromId(String(t), r === A.GROUP ? Ga.GROUP : Ga.USER);
|
|
9502
|
+
return this._api.cacheExternalId(e, i), i;
|
|
9503
|
+
}
|
|
9504
|
+
_registerParticipantAndSetMarkersIfChunkEnabled(e, t) {
|
|
9499
9505
|
if (M.useParticipantListChunk) {
|
|
9500
|
-
let n = this._registerParticipantInCache(
|
|
9506
|
+
let n = this._registerParticipantInCache(this._getExistedParticipantByIdOrCreate(e));
|
|
9501
9507
|
return n.markers = this._denormalizeMarkers(n.id, t), n;
|
|
9502
9508
|
}
|
|
9503
|
-
return
|
|
9509
|
+
return this._getParticipants()[e];
|
|
9504
9510
|
}
|
|
9505
9511
|
_warnParticipantNotInConversation(e) {
|
|
9506
9512
|
this._debug.warn(`Participant [${e}] isn't in conversation`);
|
|
@@ -9537,21 +9543,21 @@ var Eo = class {
|
|
|
9537
9543
|
this._onRecordInfo(e.conversation?.recordInfo ?? null);
|
|
9538
9544
|
for (let t of e.rooms?.rooms ?? []) this._onRecordInfo(t.recordInfo ?? null, t.id);
|
|
9539
9545
|
}
|
|
9540
|
-
|
|
9541
|
-
e.conversation.pinnedParticipantId ?
|
|
9542
|
-
for (let t of e.rooms?.rooms ?? []) t.pinnedParticipantId ?
|
|
9546
|
+
_processPinnedParticipants(e) {
|
|
9547
|
+
e.conversation.pinnedParticipantId ? this._onPinParticipant(e.conversation.pinnedParticipantId) : this._conversation?.pinnedParticipantIdByRoom.delete(null);
|
|
9548
|
+
for (let t of e.rooms?.rooms ?? []) t.pinnedParticipantId ? this._onPinParticipant(t.pinnedParticipantId, !1, void 0, t.id) : this._conversation?.pinnedParticipantIdByRoom.delete(t.id);
|
|
9543
9549
|
}
|
|
9544
|
-
|
|
9550
|
+
_allocateTransport() {
|
|
9545
9551
|
if (!this._conversation || !this._mediaSource) return;
|
|
9546
9552
|
this._transport = new na(this._conversation.topology, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._stats.logger, this._stats.statAggregator, this._stats.codecStatsAggregator, this._getFirstMediaSentCallback()), this._debugInfo = new co(this._debug), this.subscribe(this._transport, Y.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(this._transport, Y.LOCAL_STATE_CHANGED, this._onTransportLocalStateChanged.bind(this)), this.subscribe(this._transport, Y.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(this._transport, Y.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(this._transport, Y.AUDIO_MIX_STALL, this._onAudioMixStall.bind(this)), this.subscribe(this._transport, Y.REMOTE_DATA_STATS, this._onRemoteDataStats.bind(this)), this.subscribe(this._transport, Y.SIGNALLED_STALLED_PARTICIPANTS, this._onRemoteSignalledStall.bind(this)), this.subscribe(this._transport, Y.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this)), this.subscribe(this._transport, Y.NETWORK_STATUS, this._onNetworkStatus.bind(this)), this.subscribe(this._transport, Y.REMOTE_STREAM_SECOND, this._onRemoteStreamSecond.bind(this)), this.subscribe(this._transport, Y.PEER_CONNECTION_CLOSED, this._onPeerConnectionClosed.bind(this)), this.subscribe(this._transport, Y.ASR_TRANSCRIPTION, this._onAsrTranscription.bind(this)), this.subscribe(this._transport, Y.ANIMOJI_STREAM, this._onAnimojiStream.bind(this)), this.subscribe(this._transport, Y.ANIMOJI_ERROR, this._onAnimojiError.bind(this));
|
|
9547
|
-
let e = this._conversation.direction === Aa.OUTGOING && !this._conversation.concurrent, t =
|
|
9553
|
+
let e = this._conversation.direction === Aa.OUTGOING && !this._conversation.concurrent, t = this._getParticipants();
|
|
9548
9554
|
for (let n of Object.values(t)) (n.state === X.ACCEPTED || n.state === X.CALLED) && this._allocateParticipantTransport(n.id, e);
|
|
9549
9555
|
}
|
|
9550
9556
|
_createSpeakerDetector() {
|
|
9551
9557
|
this._transport && this._conversation && (this._volumesDetector = new go(this._transport), this.subscribe(this._volumesDetector, ho.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this._speakerDetector = new vo(this._volumesDetector, this._transport, this._conversation.topology), this.subscribe(this._speakerDetector, _o.SPEAKER_CHANGED, this._onSpeakerChanged.bind(this)), this._localVolumeDetector = new po(this._mediaSource));
|
|
9552
9558
|
}
|
|
9553
|
-
|
|
9554
|
-
this._transport && this._volumesDetector && (this._specListener = new xo(this._transport, this._volumesDetector,
|
|
9559
|
+
_createSpecListener() {
|
|
9560
|
+
this._transport && this._volumesDetector && (this._specListener = new xo(this._transport, this._volumesDetector, this._getParticipants(), this._debug, this._stats.logger));
|
|
9555
9561
|
}
|
|
9556
9562
|
_logDevices() {
|
|
9557
9563
|
let e = T.getCameras().length, t = T.getMicrophones().length;
|
|
@@ -9563,7 +9569,7 @@ var Eo = class {
|
|
|
9563
9569
|
async _removeParticipant(e, t) {
|
|
9564
9570
|
if (e.state === X.CALLED || e.state === X.ACCEPTED || this._state === "CLOSE") return;
|
|
9565
9571
|
e.id === this._lastSignalledActiveSpeakerId && (this._lastSignalledActiveSpeakerId = null);
|
|
9566
|
-
let n =
|
|
9572
|
+
let n = this._getParticipants();
|
|
9567
9573
|
if (n[e.id]) {
|
|
9568
9574
|
t === D.HUNGUP ? this._setParticipantsStatus([e], N.HANGUP) : this._setParticipantsStatus([e], N.ERROR, t), e.mediaSource?.disconnect(), this._displayLayoutRequester.cleanupParticipant(e.id), this._conversation && this._conversation.pinnedParticipantIdByRoom.get(null) === e.id && this._conversation.pinnedParticipantIdByRoom.delete(null), this._conversation && this._conversation.roomId && this._conversation.pinnedParticipantIdByRoom.get(this._conversation.roomId) === e.id && this._conversation.pinnedParticipantIdByRoom.delete(this._conversation.roomId);
|
|
9569
9575
|
for (let [t, n] of Object.entries(e.lastRequestedLayouts)) this._streamIdByStreamDescription.delete(t), this._sequenceNumberByStreamDescription.delete(t), this._cooldownTimestampByStreamDescription.delete(t), this._streamWaitTimerByStreamDescription.has(t) && (window.clearTimeout(this._streamWaitTimerByStreamDescription.get(t)), this._streamWaitTimerByStreamDescription.delete(t)), this._sendUpdateDisplayLayout({ [t]: { stopStream: !0 } }, !1);
|
|
@@ -9576,8 +9582,8 @@ var Eo = class {
|
|
|
9576
9582
|
_cleanupMediaSource() {
|
|
9577
9583
|
this._mediaSource && (this._mediaSource.destroy(), this._mediaSource = null);
|
|
9578
9584
|
}
|
|
9579
|
-
|
|
9580
|
-
Object.values(
|
|
9585
|
+
_cleanupParticipants() {
|
|
9586
|
+
Object.values(this._getParticipants()).forEach((e) => {
|
|
9581
9587
|
e.remoteStream?.getTracks().forEach((e) => e.stop()), e.remoteAudioTrack?.stop(), e.secondStream?.getTracks().forEach((e) => e.stop()), e.mediaSource?.disconnect();
|
|
9582
9588
|
}), this._participants = {}, this._audioOutput && this._audioOutput.destroy();
|
|
9583
9589
|
}
|
|
@@ -9617,7 +9623,7 @@ var Eo = class {
|
|
|
9617
9623
|
}
|
|
9618
9624
|
async _onAddParticipant(e, t, n) {
|
|
9619
9625
|
this._debug.debug(`Add new participant [${e}]`);
|
|
9620
|
-
let r =
|
|
9626
|
+
let r = this._getParticipant(e);
|
|
9621
9627
|
r && this._updateParticipantExternalId(r, t);
|
|
9622
9628
|
let i = !r;
|
|
9623
9629
|
if (r && (r.state === X.ACCEPTED || r.state === X.CALLED)) {
|
|
@@ -9637,13 +9643,13 @@ var Eo = class {
|
|
|
9637
9643
|
muteStates: t.muteStates || {},
|
|
9638
9644
|
unmuteOptions: t.unmuteOptions || [],
|
|
9639
9645
|
observedIds: t.observedIds || []
|
|
9640
|
-
}, n), r =
|
|
9646
|
+
}, n), r = this._getParticipant(e);
|
|
9641
9647
|
}
|
|
9642
9648
|
this._setParticipantsStatus([r], N.WAITING), i && this._emitParticipantEffectiveStatusIfSessionOverridesTransport(r), n ? (r.state = X.HUNGUP, await this._removeParticipant(r, n)) : this._transport && (r.state = X.CALLED, this._allocateParticipantTransport(r.id, !0), this._stats.logger.log(S.ADD_PARTICIPANT), this._invokeRolesChangedCallbackIfNeeded(r));
|
|
9643
9649
|
}
|
|
9644
|
-
|
|
9650
|
+
_onRemoveParticipant(e) {
|
|
9645
9651
|
this._debug.debug(`Remove participant [${e}]`);
|
|
9646
|
-
let t = [], n =
|
|
9652
|
+
let t = [], n = this._getParticipants();
|
|
9647
9653
|
for (let r = 0; r <= Ro; r++) {
|
|
9648
9654
|
let i = n[j.compose(e, r)];
|
|
9649
9655
|
i && t.push(i);
|
|
@@ -9709,7 +9715,7 @@ var Eo = class {
|
|
|
9709
9715
|
let e = typeof t.uid == "object" ? t.uid : Z.fromId(t.uid), r = Z.toString(e);
|
|
9710
9716
|
n[r] = t.priority;
|
|
9711
9717
|
}
|
|
9712
|
-
let r =
|
|
9718
|
+
let r = this._getParticipants();
|
|
9713
9719
|
for (let e of Object.values(r)) {
|
|
9714
9720
|
let r = Z.toString(e.externalId);
|
|
9715
9721
|
Object.hasOwn(n, r) && (t[e.id] = n[r]);
|
|
@@ -9731,15 +9737,15 @@ var Eo = class {
|
|
|
9731
9737
|
return;
|
|
9732
9738
|
}
|
|
9733
9739
|
if (this._isWaitingForPromotion()) {
|
|
9734
|
-
this._waitingHallHoldPending = !1,
|
|
9740
|
+
this._waitingHallHoldPending = !1, this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener(), await this._resumeLocalMedia(t, this._getWaitingForPromotionStatus());
|
|
9735
9741
|
return;
|
|
9736
9742
|
}
|
|
9737
9743
|
let n = fa.get();
|
|
9738
9744
|
await this._signaling.hold(!1, n), this._restoreStateAfterHold();
|
|
9739
9745
|
let r = null;
|
|
9740
|
-
if (this._state === "IDLE" && this._participantState === X.ACCEPTED && (r = Object.values(
|
|
9746
|
+
if (this._state === "IDLE" && this._participantState === X.ACCEPTED && (r = Object.values(this._getParticipants()), r.some((e) => e.state === X.ACCEPTED) && (this._state = "ACTIVE", this._changeFeatureSet())), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener(), await this._resumeLocalMedia(t, N.WAITING), this._state === "ACTIVE") {
|
|
9741
9747
|
let e = this._conversation?.direction === Aa.OUTGOING && !this._conversation.concurrent;
|
|
9742
|
-
this._openTransport(r ?? Object.values(
|
|
9748
|
+
this._openTransport(r ?? Object.values(this._getParticipants()), e);
|
|
9743
9749
|
}
|
|
9744
9750
|
}
|
|
9745
9751
|
async _holdLocally() {
|
|
@@ -9772,7 +9778,7 @@ var Eo = class {
|
|
|
9772
9778
|
async updateDisplayLayout(e) {
|
|
9773
9779
|
if (e.length < 1 || !this._signaling.ready) return;
|
|
9774
9780
|
this._debug.log(`Update display layout request [${this._signaling.getNextCommandSequenceNumber()}]`, e);
|
|
9775
|
-
let t = {}, n = [], r =
|
|
9781
|
+
let t = {}, n = [], r = this._getParticipants();
|
|
9776
9782
|
for (let i of e) {
|
|
9777
9783
|
let e = typeof i.uid == "object" ? i.uid : Z.fromId(i.uid), a = this._api.getCachedOkIdByExternalId(e);
|
|
9778
9784
|
if (!a) {
|
|
@@ -9800,7 +9806,7 @@ var Eo = class {
|
|
|
9800
9806
|
this._debug.error("Cannot accommodate all streaming requests: tracks available " + M.videoTracksCount + "; requested streams: " + Array.from(this._streamIdByStreamDescription.keys()));
|
|
9801
9807
|
break;
|
|
9802
9808
|
}
|
|
9803
|
-
|
|
9809
|
+
this._stopStreaming(e.value), t[e.value] = { stopStream: !0 };
|
|
9804
9810
|
}
|
|
9805
9811
|
if (this._transport?.getTopology() !== J.SERVER) {
|
|
9806
9812
|
n.forEach((e) => e());
|
|
@@ -9814,9 +9820,9 @@ var Eo = class {
|
|
|
9814
9820
|
async feedback(e) {
|
|
9815
9821
|
return this._signaling.feedback(e);
|
|
9816
9822
|
}
|
|
9817
|
-
|
|
9823
|
+
_stopStreaming(e) {
|
|
9818
9824
|
if (this._cooldownTimestampByStreamDescription.delete(e), this._sequenceNumberByStreamDescription.set(e, this._signaling.getNextCommandSequenceNumber()), this._streamWaitTimerByStreamDescription.has(e) && (this._debug.log("Client asked to stop streaming before stream became available", e), window.clearTimeout(this._streamWaitTimerByStreamDescription.get(e)), this._streamWaitTimerByStreamDescription.delete(e)), this._streamIdByStreamDescription.get(e)) {
|
|
9819
|
-
let t =
|
|
9825
|
+
let t = this._getParticipants(), n = En(e), r = t[n.participantId], i = this._conversation?.externalId, a = this._isMe(n.participantId);
|
|
9820
9826
|
if (r || a) {
|
|
9821
9827
|
switch (n.mediaType) {
|
|
9822
9828
|
case V.STREAM:
|
|
@@ -9852,7 +9858,7 @@ var Eo = class {
|
|
|
9852
9858
|
if (this._debug.warn(`Failed to update display layout ${JSON.stringify(e)}. ${n}`), t) throw n;
|
|
9853
9859
|
return;
|
|
9854
9860
|
}
|
|
9855
|
-
let r = [], i =
|
|
9861
|
+
let r = [], i = this._getParticipants();
|
|
9856
9862
|
for (let [e, t] of Object.entries(n.errorCodeByParticipantId || {})) {
|
|
9857
9863
|
let n = En(e), a = i[n.participantId];
|
|
9858
9864
|
if (a) {
|
|
@@ -9889,74 +9895,61 @@ var Eo = class {
|
|
|
9889
9895
|
}
|
|
9890
9896
|
async _onChatRoomUpdated(e, t = 0, n = [], r, i) {
|
|
9891
9897
|
this._debug.log(`Chat room updated: ${e}`);
|
|
9892
|
-
let a = []
|
|
9893
|
-
|
|
9898
|
+
let a = [];
|
|
9899
|
+
n.length && n.forEach((e) => {
|
|
9894
9900
|
if (e.externalId) {
|
|
9895
|
-
let t = Z.fromSignaling(e.externalId);
|
|
9896
|
-
|
|
9897
|
-
} else
|
|
9898
|
-
|
|
9899
|
-
|
|
9900
|
-
|
|
9901
|
-
}), r?.length && r.forEach((e) => {
|
|
9902
|
-
let t = j.decomposeId(e).id;
|
|
9903
|
-
a.push(t), o.push(t);
|
|
9904
|
-
}), i?.length && i.forEach((e) => {
|
|
9905
|
-
let t = j.decomposeId(e).id;
|
|
9906
|
-
a.push(t), s.push(t);
|
|
9907
|
-
}), !a.length) {
|
|
9908
|
-
L.onChatRoomUpdated(e, t, l, [], [], this.id);
|
|
9909
|
-
return;
|
|
9910
|
-
}
|
|
9911
|
-
c.length && l.push(...this._getExternalIdsByOkIdsFromCache(c));
|
|
9912
|
-
let u = this._getExternalIdsByOkIdsFromCache(o), d = this._getExternalIdsByOkIdsFromCache(s);
|
|
9913
|
-
L.onChatRoomUpdated(e, t, l, u, d, this.id);
|
|
9901
|
+
let { type: t } = j.decomposeId(e.id.id), n = Z.fromSignaling(e.externalId, 0, t);
|
|
9902
|
+
a.push(n), this._api.cacheExternalId(e.id.id, n);
|
|
9903
|
+
} else a.push(this._getOrCacheExternalIdByCompositeId(e.id.id));
|
|
9904
|
+
});
|
|
9905
|
+
let o = r?.map((e) => this._getOrCacheExternalIdByCompositeId(e)) ?? [], s = i?.map((e) => this._getOrCacheExternalIdByCompositeId(e)) ?? [];
|
|
9906
|
+
L.onChatRoomUpdated(e, t, a, o, s, this.id);
|
|
9914
9907
|
}
|
|
9915
|
-
|
|
9908
|
+
_onSharedMovieUpdate(e) {
|
|
9916
9909
|
let t = this._conversation?.externalId;
|
|
9917
9910
|
for (let n of e.data) if (this._isMe(n.participantId)) L.onLocalLiveUpdate(t, n, this.id);
|
|
9918
9911
|
else {
|
|
9919
|
-
let e =
|
|
9912
|
+
let e = this._getExternalIdByParticipantId(n.participantId);
|
|
9920
9913
|
e && L.onRemoteLiveUpdate(e, n, this.id);
|
|
9921
9914
|
}
|
|
9922
9915
|
}
|
|
9923
|
-
|
|
9924
|
-
this._debug.log(`Shared movie started data received: ${e.notification}`),
|
|
9916
|
+
_onSharedMovieInfoStarted(e) {
|
|
9917
|
+
this._debug.log(`Shared movie started data received: ${e.notification}`), this._processSharedMovieInfo(e.movieShareInfo, e.roomId);
|
|
9925
9918
|
}
|
|
9926
|
-
|
|
9927
|
-
e &&
|
|
9919
|
+
_processSharedMovieInfos(e, t = null) {
|
|
9920
|
+
e && e.forEach((e) => this._processSharedMovieInfo(e, t));
|
|
9928
9921
|
}
|
|
9929
|
-
|
|
9922
|
+
_processSharedMovieInfo(e, t = null) {
|
|
9930
9923
|
if (!e) return;
|
|
9931
9924
|
let n = this._conversation?.externalId;
|
|
9932
9925
|
if (this._isMe(e.initiatorId)) L.onLocalSharedMovieInfo(n, e, t, this.id);
|
|
9933
9926
|
else {
|
|
9934
|
-
let n =
|
|
9927
|
+
let n = this._getExternalIdByParticipantId(e.initiatorId);
|
|
9935
9928
|
n && L.onRemoteSharedMovieInfo(n, e, t, this.id);
|
|
9936
9929
|
}
|
|
9937
9930
|
}
|
|
9938
|
-
|
|
9931
|
+
_processConnectionSharedMovieInfo(e) {
|
|
9939
9932
|
let t = e.conversation.participants.find((e) => this._isMe(j.composeId(e)));
|
|
9940
|
-
|
|
9933
|
+
this._processSharedMovieInfos(t?.movieShareInfos, e?.rooms?.roomId ?? null);
|
|
9941
9934
|
}
|
|
9942
|
-
|
|
9935
|
+
_processConnectionAsrInfo(e) {
|
|
9943
9936
|
let t = e?.conversation.asrInfo ?? this._conversation?.asrInfo;
|
|
9944
9937
|
if (t && this._conversation?.asrInfoByRoom.set(null, t), e?.rooms?.rooms) for (let t of e.rooms.rooms) t.asrInfo && this._conversation?.asrInfoByRoom.set(t.id, t.asrInfo);
|
|
9945
9938
|
let n = e?.rooms?.roomId ?? this._conversation?.roomId ?? null, r = this._conversation?.asrInfoByRoom.get(n);
|
|
9946
9939
|
if (r) {
|
|
9947
|
-
let e =
|
|
9940
|
+
let e = this._getExternalIdByParticipantId(r.initiatorId);
|
|
9948
9941
|
e && L.onAsrSet({
|
|
9949
9942
|
externalId: e,
|
|
9950
9943
|
movieId: r.movieId
|
|
9951
9944
|
}, n, this.id);
|
|
9952
9945
|
} else n && L.onAsrSet(null, n, this.id);
|
|
9953
9946
|
}
|
|
9954
|
-
|
|
9947
|
+
_processConversationUrlSharingInfo(e) {
|
|
9955
9948
|
if (!this._conversation) return;
|
|
9956
9949
|
e && this._extractConnectionUrlSharingInfo(e);
|
|
9957
9950
|
let { urlSharingInfoByRoom: t } = this._conversation, n = this._conversation.roomId, r = t.get(n);
|
|
9958
9951
|
if (r && !this._isMe(r.initiatorId)) {
|
|
9959
|
-
let e =
|
|
9952
|
+
let e = this._getExternalIdByParticipantId(r.initiatorId);
|
|
9960
9953
|
e && L.onRemoteSharedUrl(e, r.sharedUrl, n, this.id);
|
|
9961
9954
|
}
|
|
9962
9955
|
}
|
|
@@ -9965,7 +9958,7 @@ var Eo = class {
|
|
|
9965
9958
|
let { urlSharingInfoByRoom: t } = this._conversation;
|
|
9966
9959
|
if (e.conversation.urlSharingInfo ? t.set(null, e.conversation.urlSharingInfo) : t.delete(null), e.rooms?.rooms) for (let n of e.rooms.rooms) n.urlSharingInfo ? t.set(n.id, n.urlSharingInfo) : t.delete(n.id);
|
|
9967
9960
|
}
|
|
9968
|
-
|
|
9961
|
+
_onSharedMovieInfoStopped(e) {
|
|
9969
9962
|
this._debug.log(`Shared movie stopped data received: ${e.notification}`);
|
|
9970
9963
|
let t = this._conversation?.externalId, { initiatorId: n, movieId: r, source: i, roomId: a = null } = e, o = {
|
|
9971
9964
|
initiatorId: n,
|
|
@@ -9974,21 +9967,21 @@ var Eo = class {
|
|
|
9974
9967
|
};
|
|
9975
9968
|
if (this._isMe(n)) L.onLocalSharedMovieStoppedInfo(t, o, a, this.id);
|
|
9976
9969
|
else {
|
|
9977
|
-
let e =
|
|
9970
|
+
let e = this._getExternalIdByParticipantId(n);
|
|
9978
9971
|
if (e) {
|
|
9979
|
-
let t =
|
|
9972
|
+
let t = this._getParticipants()[n];
|
|
9980
9973
|
t?.movieShareInfos && (t.movieShareInfos = t.movieShareInfos.filter((e) => e && e.movieId !== r)), L.onRemoteSharedMovieStoppedInfo(e, o, a, this.id);
|
|
9981
9974
|
}
|
|
9982
9975
|
}
|
|
9983
9976
|
}
|
|
9984
|
-
|
|
9977
|
+
_onUrlSharingInfoUpdated(e) {
|
|
9985
9978
|
if (this._debug.log(`Shared URL data received: ${e.notification}`), !this._conversation) return;
|
|
9986
9979
|
let { urlSharingInfoByRoom: t, roomId: n } = this._conversation, { initiatorId: r, sharedUrl: i, roomId: a = null } = e;
|
|
9987
9980
|
if (i ? t.set(a, {
|
|
9988
9981
|
sharedUrl: i,
|
|
9989
9982
|
initiatorId: r
|
|
9990
9983
|
}) : t.delete(a), !(!i && a !== n && t.has(n)) && (!i || !this._isMe(r))) {
|
|
9991
|
-
let e =
|
|
9984
|
+
let e = this._getExternalIdByParticipantId(r);
|
|
9992
9985
|
e && L.onRemoteSharedUrl(e, i, a, this.id);
|
|
9993
9986
|
}
|
|
9994
9987
|
}
|
|
@@ -9999,7 +9992,7 @@ var Eo = class {
|
|
|
9999
9992
|
if (e.fastScreenShare && !e.participantStreamDescription) {
|
|
10000
9993
|
let t = this._getStreamDescriptionById(e.streamId);
|
|
10001
9994
|
if (t) {
|
|
10002
|
-
let e = En(t), n =
|
|
9995
|
+
let e = En(t), n = this._getParticipant(e.participantId);
|
|
10003
9996
|
L.onRemoteScreenStream(n.externalId, null, this.id);
|
|
10004
9997
|
return;
|
|
10005
9998
|
}
|
|
@@ -10008,7 +10001,7 @@ var Eo = class {
|
|
|
10008
10001
|
if (!t) return;
|
|
10009
10002
|
let { mediaType: n, participantId: r } = t;
|
|
10010
10003
|
if (n === V.ANIMOJI) return;
|
|
10011
|
-
let i =
|
|
10004
|
+
let i = this._getParticipant(r);
|
|
10012
10005
|
if (n === V.SCREEN && !e.fastScreenShare) {
|
|
10013
10006
|
this._debug.log("skipping participant-sources-update notification since screenshare will be received over datachannel");
|
|
10014
10007
|
return;
|
|
@@ -10145,22 +10138,15 @@ var Eo = class {
|
|
|
10145
10138
|
};
|
|
10146
10139
|
}
|
|
10147
10140
|
async _resolveWaitingHallExternalIds(e) {
|
|
10148
|
-
let t =
|
|
10149
|
-
|
|
10150
|
-
|
|
10151
|
-
|
|
10152
|
-
|
|
10153
|
-
|
|
10154
|
-
|
|
10155
|
-
|
|
10156
|
-
|
|
10157
|
-
let n = this._api.getCachedOkIdByExternalId(e);
|
|
10158
|
-
return (n ? t.get(n) : void 0) || Date.now();
|
|
10159
|
-
}));
|
|
10160
|
-
}
|
|
10161
|
-
return {
|
|
10162
|
-
externalIds: r,
|
|
10163
|
-
timestamps: n
|
|
10141
|
+
let t = [], n = [];
|
|
10142
|
+
return e.length && e.forEach((e) => {
|
|
10143
|
+
if (e.externalId) {
|
|
10144
|
+
let { type: r } = j.decomposeId(e.id.id), i = Z.fromSignaling(e.externalId, 0, r);
|
|
10145
|
+
t.push(e.id.addedTs), n.push(i), this._api.cacheExternalId(e.id.id, i);
|
|
10146
|
+
} else n.push(this._getOrCacheExternalIdByCompositeId(e.id.id)), t.push(e.id.addedTs);
|
|
10147
|
+
}), {
|
|
10148
|
+
externalIds: n,
|
|
10149
|
+
timestamps: t
|
|
10164
10150
|
};
|
|
10165
10151
|
}
|
|
10166
10152
|
async getAudienceModeHands() {
|
|
@@ -10197,7 +10183,7 @@ var Eo = class {
|
|
|
10197
10183
|
let t = await this._signaling.chatHistory(e);
|
|
10198
10184
|
for (let e = t.messages.length - 1; e >= 0; e--) {
|
|
10199
10185
|
let n = t.messages[e];
|
|
10200
|
-
|
|
10186
|
+
this._onChatMessage(n);
|
|
10201
10187
|
}
|
|
10202
10188
|
}
|
|
10203
10189
|
}
|
|
@@ -10321,7 +10307,7 @@ var Eo = class {
|
|
|
10321
10307
|
let t = this._convertExternalIdsToServerExternalIds(e.externalIds), n = await this._signaling.getParticipants(t);
|
|
10322
10308
|
if (n.error) throw Error(n.error);
|
|
10323
10309
|
let r = n.participants, i = this._transport?.getState();
|
|
10324
|
-
return
|
|
10310
|
+
return j.mapSharedParticipants(r.map((e) => {
|
|
10325
10311
|
let t = j.composeId(e);
|
|
10326
10312
|
return this._createParticipant({
|
|
10327
10313
|
id: t,
|
|
@@ -10337,13 +10323,13 @@ var Eo = class {
|
|
|
10337
10323
|
observedIds: e.observedIds || [],
|
|
10338
10324
|
markers: this._denormalizeMarkers(t, e.markers)
|
|
10339
10325
|
}, e.decorativeUserId);
|
|
10340
|
-
}))
|
|
10326
|
+
}));
|
|
10341
10327
|
}
|
|
10342
10328
|
async getParticipantListChunk(e) {
|
|
10343
10329
|
this._debug.log("Request participant list chunk", e);
|
|
10344
10330
|
let t = await this._signaling.getParticipantListChunk(e);
|
|
10345
10331
|
if (t.error) throw Error(t.error);
|
|
10346
|
-
let n = this._createParticipantListChunk(t.chunk), r =
|
|
10332
|
+
let n = this._createParticipantListChunk(t.chunk), r = this._getParticipants(), i = n.participants.filter((e) => !r[j.composeId(e)]);
|
|
10347
10333
|
await this._registerParticipants(i);
|
|
10348
10334
|
let a = this._transport?.getState();
|
|
10349
10335
|
return n.participants.forEach((e) => {
|
|
@@ -10370,14 +10356,14 @@ var Eo = class {
|
|
|
10370
10356
|
let n = e.track ? new MediaStream([e.track]) : null;
|
|
10371
10357
|
L.onScreenStream(n, t, this.id);
|
|
10372
10358
|
}
|
|
10373
|
-
|
|
10359
|
+
_changeRemoteMediaSettings(e, t) {
|
|
10374
10360
|
this._debug.debug(`Remote media settings changed [${e}]`, t);
|
|
10375
10361
|
let n = this._conversation?.externalId;
|
|
10376
10362
|
if (this._isMe(e) && n) {
|
|
10377
10363
|
L.onLocalMediaSettings(n, t, this.id);
|
|
10378
10364
|
return;
|
|
10379
10365
|
}
|
|
10380
|
-
let r =
|
|
10366
|
+
let r = this._getParticipant(e);
|
|
10381
10367
|
if (!r) {
|
|
10382
10368
|
this._warnParticipantNotInConversation(e);
|
|
10383
10369
|
return;
|
|
@@ -10393,16 +10379,16 @@ var Eo = class {
|
|
|
10393
10379
|
}
|
|
10394
10380
|
async _changeRemoteParticipantState(e, t) {
|
|
10395
10381
|
this._debug.debug(`Remote participant state changed [${e}]`, t);
|
|
10396
|
-
let n =
|
|
10382
|
+
let n = this._getParticipant(e);
|
|
10397
10383
|
if (!n) {
|
|
10398
10384
|
this._warnParticipantNotInConversation(e);
|
|
10399
10385
|
return;
|
|
10400
10386
|
}
|
|
10401
10387
|
n.participantState = t || {}, ["ACTIVE", "HELD"].includes(this._state) && L.onRemoteParticipantState(n.externalId, n.participantState, n.markers, this.id);
|
|
10402
10388
|
}
|
|
10403
|
-
|
|
10389
|
+
_changeMultipleParticipantState(e, t) {
|
|
10404
10390
|
this._debug.debug("Multiple participants state changed", e);
|
|
10405
|
-
let n = [], r, i =
|
|
10391
|
+
let n = [], r, i = this._getParticipants();
|
|
10406
10392
|
e.forEach((e, t) => {
|
|
10407
10393
|
if (this._isMe(t)) r = e;
|
|
10408
10394
|
else {
|
|
@@ -10475,8 +10461,8 @@ var Eo = class {
|
|
|
10475
10461
|
_onSignalingTopologyChanged(e) {
|
|
10476
10462
|
this._conversation && e.topology !== this._conversation.topology && (this._debug.log(`Signaling topology changed while transport is down: ${this._conversation.topology} -> ${e.topology}`), this._conversation.topology = e.topology);
|
|
10477
10463
|
}
|
|
10478
|
-
|
|
10479
|
-
let t =
|
|
10464
|
+
_onPromotionApproved(e) {
|
|
10465
|
+
let t = this._getExternalIdByParticipantId(e.adminId);
|
|
10480
10466
|
if (!t) {
|
|
10481
10467
|
this._warnParticipantNotInConversation(e.adminId);
|
|
10482
10468
|
return;
|
|
@@ -10485,10 +10471,10 @@ var Eo = class {
|
|
|
10485
10471
|
}
|
|
10486
10472
|
async _onSignalingReconnect(e) {
|
|
10487
10473
|
if (!this._conversation) return;
|
|
10488
|
-
e.conversationParams?.serverTime && (this._serverTimeOffset = e.conversationParams.serverTime - Date.now()), e.conversation.acceptTime && (this._conversation.acceptTime = e.conversation.acceptTime), e.conversation.participantsLimit && (this._conversation.participantsLimit = e.conversation.participantsLimit), e.conversation.features && (this._conversation.features = e.conversation.features, this._conversation.featuresPerRole = e.conversation.featuresPerRole, this._changeFeatureSet(), this._changeFeaturesPerRole()),
|
|
10474
|
+
e.conversationParams?.serverTime && (this._serverTimeOffset = e.conversationParams.serverTime - Date.now()), e.conversation.acceptTime && (this._conversation.acceptTime = e.conversation.acceptTime), e.conversation.participantsLimit && (this._conversation.participantsLimit = e.conversation.participantsLimit), e.conversation.features && (this._conversation.features = e.conversation.features, this._conversation.featuresPerRole = e.conversation.featuresPerRole, this._changeFeatureSet(), this._changeFeaturesPerRole()), this._processPinnedParticipants(e), e.conversation.state;
|
|
10489
10475
|
let t = null;
|
|
10490
10476
|
if (e.conversation.participants) {
|
|
10491
|
-
let n = Object.keys(
|
|
10477
|
+
let n = Object.keys(this._getParticipants()), r = [];
|
|
10492
10478
|
for (let n of e.conversation.participants) {
|
|
10493
10479
|
let e = j.composeId(n), i = n.roles || [];
|
|
10494
10480
|
if (this._isMe(e)) {
|
|
@@ -10501,7 +10487,7 @@ var Eo = class {
|
|
|
10501
10487
|
continue;
|
|
10502
10488
|
}
|
|
10503
10489
|
r.push(e);
|
|
10504
|
-
let a =
|
|
10490
|
+
let a = this._getParticipant(e);
|
|
10505
10491
|
if (!a) await this._onJoinedParticipant({
|
|
10506
10492
|
participantId: n.id,
|
|
10507
10493
|
participant: n,
|
|
@@ -10510,12 +10496,12 @@ var Eo = class {
|
|
|
10510
10496
|
else {
|
|
10511
10497
|
this._updateParticipantSessionState(a, e, n.sessionState);
|
|
10512
10498
|
let t = E(n.mediaSettings);
|
|
10513
|
-
Ut(t, a.mediaSettings) ||
|
|
10499
|
+
Ut(t, a.mediaSettings) || this._changeRemoteMediaSettings(e, t);
|
|
10514
10500
|
let r = j.mapParticipantState(n), o = a.participantState;
|
|
10515
10501
|
j.isEqualParticipantState(r, o) || await this._changeRemoteParticipantState(e, r), Ha(i, a.roles) || this._onRolesChanged(a.id, i), !!n.onHold != !!a.isOnHold && (a.isOnHold = !!n.onHold, this._setParticipantsStatus([a], n.onHold ? N.ONHOLD : N.CONNECTED));
|
|
10516
10502
|
}
|
|
10517
10503
|
}
|
|
10518
|
-
let i =
|
|
10504
|
+
let i = this._getParticipants();
|
|
10519
10505
|
for (let e of n) r.indexOf(e) < 0 && i[e] && this._removeParticipant(i[e], D.HUNGUP);
|
|
10520
10506
|
}
|
|
10521
10507
|
let n = [...e.participants?.participants ?? [], ...e.rooms?.rooms.flatMap((e) => e.participants?.participants ?? []) ?? []];
|
|
@@ -10537,15 +10523,15 @@ var Eo = class {
|
|
|
10537
10523
|
return;
|
|
10538
10524
|
}
|
|
10539
10525
|
this._conversation?.direction === Aa.OUTGOING && !this._conversation.concurrent && this._stats.lifecycle.markOutgoingAccepted();
|
|
10540
|
-
let r =
|
|
10526
|
+
let r = this._getParticipant(t);
|
|
10541
10527
|
if (!r) {
|
|
10542
10528
|
let n = this._api.getDecorativeIdByInitialId(t), i = n ? j.composeUserId(n, e.participantType) : void 0;
|
|
10543
|
-
r = this._registerParticipantInCache(
|
|
10529
|
+
r = this._registerParticipantInCache(this._createParticipant({
|
|
10544
10530
|
id: t,
|
|
10545
10531
|
mediaSettings: E(e.mediaSettings)
|
|
10546
10532
|
}, i));
|
|
10547
10533
|
}
|
|
10548
|
-
r.state = X.ACCEPTED, r.mediaSettings = E(e.mediaSettings), this._logWithMediaSettings(S.ACCEPTED_OUTGOING, r.mediaSettings), this._conversation && this._conversation.direction === Aa.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), this._state === "ACTIVE" && this._transport && this._transport.open([r.id], n),
|
|
10534
|
+
r.state = X.ACCEPTED, r.mediaSettings = E(e.mediaSettings), this._logWithMediaSettings(S.ACCEPTED_OUTGOING, r.mediaSettings), this._conversation && this._conversation.direction === Aa.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), this._state === "ACTIVE" && this._transport && this._transport.open([r.id], n), this._changeRemoteMediaSettings(t, r.mediaSettings), await this._changeRemoteParticipantState(t);
|
|
10549
10535
|
let i = Object.keys(r.muteStates);
|
|
10550
10536
|
i.length && this._onMuteParticipant({
|
|
10551
10537
|
muteStates: r.muteStates,
|
|
@@ -10562,8 +10548,8 @@ var Eo = class {
|
|
|
10562
10548
|
e.reason === D.OBSOLETE_CLIENT && e.errorCode && (t.message = e.errorCode), this._close(new O(e.reason, t));
|
|
10563
10549
|
return;
|
|
10564
10550
|
}
|
|
10565
|
-
|
|
10566
|
-
let n =
|
|
10551
|
+
this._registerParticipantAndSetMarkersIfChunkEnabled(t, e.markers);
|
|
10552
|
+
let n = this._getParticipant(t);
|
|
10567
10553
|
if (!n) {
|
|
10568
10554
|
this._warnParticipantNotInConversation(t);
|
|
10569
10555
|
return;
|
|
@@ -10573,12 +10559,12 @@ var Eo = class {
|
|
|
10573
10559
|
this._removeParticipant(n, t);
|
|
10574
10560
|
}
|
|
10575
10561
|
}
|
|
10576
|
-
|
|
10562
|
+
_onSessionState(e) {
|
|
10577
10563
|
if (!M.enableSessionStateUpdates) return;
|
|
10578
10564
|
let t = j.composeMessageId(e);
|
|
10579
10565
|
if (this._isMe(t)) return;
|
|
10580
|
-
|
|
10581
|
-
let n =
|
|
10566
|
+
this._registerParticipantAndSetMarkersIfChunkEnabled(t, e.markers);
|
|
10567
|
+
let n = this._getParticipant(t);
|
|
10582
10568
|
if (!n) {
|
|
10583
10569
|
this._warnParticipantNotInConversation(t);
|
|
10584
10570
|
return;
|
|
@@ -10591,7 +10577,7 @@ var Eo = class {
|
|
|
10591
10577
|
}
|
|
10592
10578
|
async _reconcileParticipantSessionStates(e) {
|
|
10593
10579
|
if (!M.enableSessionStateUpdates || !e.length) return;
|
|
10594
|
-
let t =
|
|
10580
|
+
let t = this._getParticipants();
|
|
10595
10581
|
for (let n of e) {
|
|
10596
10582
|
let e = j.composeId(n), r = t[e];
|
|
10597
10583
|
r && !this._isMe(e) && (this._updateParticipantExternalId(r, n), this._updateParticipantSessionState(r, e, n.sessionState));
|
|
@@ -10609,7 +10595,7 @@ var Eo = class {
|
|
|
10609
10595
|
}
|
|
10610
10596
|
async _onAddedParticipant(e) {
|
|
10611
10597
|
this._debug.debug(`Participant added [${e.participantId}]`);
|
|
10612
|
-
let t = j.composeMessageId(e), n =
|
|
10598
|
+
let t = j.composeMessageId(e), n = this._getParticipant(t);
|
|
10613
10599
|
n && this._updateParticipantExternalId(n, e.participant);
|
|
10614
10600
|
let r = !n;
|
|
10615
10601
|
if (n && n.state !== X.HUNGUP && n.state !== X.REJECTED) {
|
|
@@ -10630,13 +10616,13 @@ var Eo = class {
|
|
|
10630
10616
|
muteStates: r.muteStates || {},
|
|
10631
10617
|
unmuteOptions: r.unmuteOptions || [],
|
|
10632
10618
|
observedIds: r.observedIds || []
|
|
10633
|
-
}, i), n =
|
|
10619
|
+
}, i), n = this._getParticipant(t);
|
|
10634
10620
|
}
|
|
10635
|
-
n.state = X.CALLED, n.mediaSettings = E(e.participant?.mediaSettings), n.participantState = j.mapParticipantState(e.participant), n.roles = e.participant?.roles || [], this._updateParticipantSessionState(n, t, e.participant.sessionState), this._setParticipantsStatus([n], N.WAITING), r && this._emitParticipantEffectiveStatusIfSessionOverridesTransport(n), this._state !== "IDLE" && this._transport && this._allocateParticipantTransport(n.id, !0), L.onParticipantAdded(n.externalId, n.markers, this.id),
|
|
10621
|
+
n.state = X.CALLED, n.mediaSettings = E(e.participant?.mediaSettings), n.participantState = j.mapParticipantState(e.participant), n.roles = e.participant?.roles || [], this._updateParticipantSessionState(n, t, e.participant.sessionState), this._setParticipantsStatus([n], N.WAITING), r && this._emitParticipantEffectiveStatusIfSessionOverridesTransport(n), this._state !== "IDLE" && this._transport && this._allocateParticipantTransport(n.id, !0), L.onParticipantAdded(n.externalId, n.markers, this.id), this._changeRemoteMediaSettings(t, n.mediaSettings), await this._changeRemoteParticipantState(t, n.participantState), this._invokeRolesChangedCallbackIfNeeded(n);
|
|
10636
10622
|
}
|
|
10637
10623
|
async _onJoinedParticipant(e) {
|
|
10638
10624
|
this._debug.debug(`Participant joined [${e.participantId}]`), this._statFirstMediaReceived.markOnJoin(this._transport?.getTopology());
|
|
10639
|
-
let t = j.composeMessageId(e), n =
|
|
10625
|
+
let t = j.composeMessageId(e), n = this._getParticipant(t);
|
|
10640
10626
|
n && this._updateParticipantExternalId(n, e.participant);
|
|
10641
10627
|
let r = !n;
|
|
10642
10628
|
if (n && n.state === X.ACCEPTED) {
|
|
@@ -10659,36 +10645,36 @@ var Eo = class {
|
|
|
10659
10645
|
connectionStatus: this._buildConnectionStatus(t, r.sessionState, this._transport?.getState(), r.onHold),
|
|
10660
10646
|
markers: this._denormalizeMarkers(t, r.markers),
|
|
10661
10647
|
isOnHold: !!r.onHold
|
|
10662
|
-
}, i), n =
|
|
10648
|
+
}, i), n = this._getParticipant(t);
|
|
10663
10649
|
}
|
|
10664
|
-
this._conversation && this._conversation.direction === Aa.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), n.state = X.ACCEPTED, n.mediaSettings = E(e.mediaSettings), n.participantState = j.mapParticipantState(e.participant), n.roles = e.participant.roles || [], this._updateParticipantSessionState(n, t, e.participant.sessionState), e.participant.onHold ? (n.isOnHold = !0, this._setParticipantsStatus([n], N.ONHOLD)) : this._transport?.isAllocated(n.id) ? this._setParticipantsStatus([n], N.CONNECTED) : this._setParticipantsStatus([n], N.WAITING), r && this._emitParticipantEffectiveStatusIfSessionOverridesTransport(n), this._state !== "IDLE" && this._transport && (this._transport.isAllocated(n.id) || this._allocateParticipantTransport(n.id, !0), this._transport.open([n.id], null, !!this._conversation?.observer)), L.onParticipantJoined(n.externalId, n.markers, this.id),
|
|
10650
|
+
this._conversation && this._conversation.direction === Aa.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), n.state = X.ACCEPTED, n.mediaSettings = E(e.mediaSettings), n.participantState = j.mapParticipantState(e.participant), n.roles = e.participant.roles || [], this._updateParticipantSessionState(n, t, e.participant.sessionState), e.participant.onHold ? (n.isOnHold = !0, this._setParticipantsStatus([n], N.ONHOLD)) : this._transport?.isAllocated(n.id) ? this._setParticipantsStatus([n], N.CONNECTED) : this._setParticipantsStatus([n], N.WAITING), r && this._emitParticipantEffectiveStatusIfSessionOverridesTransport(n), this._state !== "IDLE" && this._transport && (this._transport.isAllocated(n.id) || this._allocateParticipantTransport(n.id, !0), this._transport.open([n.id], null, !!this._conversation?.observer)), L.onParticipantJoined(n.externalId, n.markers, this.id), this._changeRemoteMediaSettings(t, n.mediaSettings), await this._changeRemoteParticipantState(t, n.participantState), this._invokeRolesChangedCallbackIfNeeded(n);
|
|
10665
10651
|
let i = Object.keys(n.muteStates);
|
|
10666
10652
|
i.length && this._onMuteParticipant({
|
|
10667
10653
|
muteStates: n.muteStates,
|
|
10668
10654
|
mediaOptions: i,
|
|
10669
10655
|
stateUpdated: !0,
|
|
10670
10656
|
participantId: t
|
|
10671
|
-
}),
|
|
10657
|
+
}), this._processSharedMovieInfos(n.movieShareInfos);
|
|
10672
10658
|
}
|
|
10673
10659
|
_onClosedConversation(e) {
|
|
10674
10660
|
this._toggleJoinAvailability(), this._close(new O(e.reason, { remote: !0 }));
|
|
10675
10661
|
}
|
|
10676
|
-
|
|
10662
|
+
_onMediaSettingsChanged(e) {
|
|
10677
10663
|
let t = j.composeMessageId(e);
|
|
10678
|
-
|
|
10664
|
+
this._registerParticipantAndSetMarkersIfChunkEnabled(t, e.markers), this._changeRemoteMediaSettings(t, E(e.mediaSettings));
|
|
10679
10665
|
}
|
|
10680
10666
|
async _onParticipantStateChanged(e) {
|
|
10681
10667
|
let t = j.composeMessageId(e), n = j.mapParticipantState(e);
|
|
10682
|
-
this._isMe(t) ? this._changeLocalParticipantState(n) : (
|
|
10668
|
+
this._isMe(t) ? this._changeLocalParticipantState(n) : (this._registerParticipantAndSetMarkersIfChunkEnabled(t, e.markers), await this._changeRemoteParticipantState(t, n));
|
|
10683
10669
|
}
|
|
10684
|
-
|
|
10685
|
-
let { participants: t, roomId: n } = e
|
|
10686
|
-
|
|
10687
|
-
let
|
|
10670
|
+
_onParticipantsStateChanged(e) {
|
|
10671
|
+
let { participants: t, roomId: n } = e;
|
|
10672
|
+
t.map(({ id: e, markers: t }) => this._registerParticipantAndSetMarkersIfChunkEnabled(e, t));
|
|
10673
|
+
let r = /* @__PURE__ */ new Map(), i = t.map(({ id: e, participantState: t }) => [e, this._getExternalIdByParticipantId(e) && j.mapParticipantState({ participantState: t })]);
|
|
10688
10674
|
try {
|
|
10689
|
-
|
|
10690
|
-
t &&
|
|
10691
|
-
}),
|
|
10675
|
+
i.forEach(([e, t]) => {
|
|
10676
|
+
t && r.set(e, t);
|
|
10677
|
+
}), this._changeMultipleParticipantState(r, n);
|
|
10692
10678
|
} catch (e) {
|
|
10693
10679
|
this._debug.warn(`_onParticipantsStateChanged: Failed to get external ids. ${e}`);
|
|
10694
10680
|
}
|
|
@@ -10738,84 +10724,84 @@ var Eo = class {
|
|
|
10738
10724
|
}
|
|
10739
10725
|
async _onPeerRegistered(e) {
|
|
10740
10726
|
this._registeredPeerReceived = !0, this._clearCalleeUnavailableWatchdog();
|
|
10741
|
-
let t = j.composeMessageId(e), n =
|
|
10727
|
+
let t = j.composeMessageId(e), n = this._getParticipant(t);
|
|
10742
10728
|
n && (n.clientType = e.clientType, n.platform = e.platform), L.onPeerRegistered(this.id);
|
|
10743
10729
|
}
|
|
10744
10730
|
async _onMicSwitched(e) {
|
|
10745
10731
|
L.onDeviceSwitched(x.AUDIO, !e.mute, this.id), await this.toggleLocalAudio(!e.mute);
|
|
10746
10732
|
}
|
|
10747
|
-
|
|
10748
|
-
let t = j.composeMessageId(e), n =
|
|
10733
|
+
_onChatMessage(e) {
|
|
10734
|
+
let t = j.composeMessageId(e), n = this._getExternalIdByParticipantId(t);
|
|
10749
10735
|
if (!n) {
|
|
10750
10736
|
this._warnParticipantNotInConversation(t);
|
|
10751
10737
|
return;
|
|
10752
10738
|
}
|
|
10753
10739
|
L.onChatMessage(e.message, n, e.direct, this.id);
|
|
10754
10740
|
}
|
|
10755
|
-
|
|
10741
|
+
_onCustomData(e) {
|
|
10756
10742
|
if (Object.hasOwn(e.data, "sdk")) return;
|
|
10757
|
-
let t = j.composeMessageId(e), n =
|
|
10743
|
+
let t = j.composeMessageId(e), n = this._getExternalIdByParticipantId(t);
|
|
10758
10744
|
if (!n) {
|
|
10759
10745
|
this._warnParticipantNotInConversation(t);
|
|
10760
10746
|
return;
|
|
10761
10747
|
}
|
|
10762
10748
|
L.onCustomData(e.data, n, e.direct, this.id);
|
|
10763
10749
|
}
|
|
10764
|
-
|
|
10750
|
+
_onRecordInfo(e, t = null) {
|
|
10765
10751
|
if (!this._conversation || !e) return;
|
|
10766
10752
|
let n = this._conversation.recordsInfoByRoom.get(t);
|
|
10767
10753
|
if (n?.recordMovieId !== e?.recordMovieId || n?.recordStartTime !== e?.recordStartTime) {
|
|
10768
10754
|
this._conversation.recordsInfoByRoom.set(t, e);
|
|
10769
|
-
let n =
|
|
10755
|
+
let n = this._getExternalIdByParticipantId(e.initiator);
|
|
10770
10756
|
n ? L.onRecordStarted(n, e.recordMovieId, e.recordStartTime, e.recordType, e.recordExternalMovieId, e.recordExternalOwnerId, t, this.id) : this._warnParticipantNotInConversation(e.initiator);
|
|
10771
10757
|
}
|
|
10772
10758
|
}
|
|
10773
|
-
|
|
10759
|
+
_onStopRecordInfo({ participant: e, recordMovieId: t }, n = null) {
|
|
10774
10760
|
if (!this._conversation) return;
|
|
10775
10761
|
let r = this._conversation.recordsInfoByRoom.get(n);
|
|
10776
10762
|
if (!(!r || r.recordMovieId !== t)) if (this._conversation.recordsInfoByRoom.set(n, null), e) {
|
|
10777
|
-
let t =
|
|
10763
|
+
let t = this._getExternalIdByParticipantId(e);
|
|
10778
10764
|
L.onRecordStopped(n, t ?? null, this.id);
|
|
10779
10765
|
} else L.onRecordStopped(n, null, this.id);
|
|
10780
10766
|
}
|
|
10781
|
-
|
|
10767
|
+
_changePinnedParticipantForRoom() {
|
|
10782
10768
|
if (!this._conversation) return;
|
|
10783
10769
|
let e = this._conversation.roomId, t = this._conversation.pinnedParticipantIdByRoom.get(e);
|
|
10784
10770
|
if (t && !this._isMe(t)) {
|
|
10785
|
-
let n =
|
|
10771
|
+
let n = this._getExternalIdByParticipantId(t);
|
|
10786
10772
|
n && L.onPinnedParticipant(n, !1, null, e, this.id);
|
|
10787
10773
|
}
|
|
10788
10774
|
}
|
|
10789
|
-
|
|
10775
|
+
_changeRecordInfoForRoom() {
|
|
10790
10776
|
if (!this._conversation) return;
|
|
10791
10777
|
let e = this._conversation.roomId, t = this._conversation.recordsInfoByRoom.get(e);
|
|
10792
10778
|
if (t) {
|
|
10793
|
-
let n =
|
|
10779
|
+
let n = this._getExternalIdByParticipantId(t.initiator);
|
|
10794
10780
|
n ? L.onRecordStarted(n, t.recordMovieId, t.recordStartTime, t.recordType, t.recordExternalMovieId, t.recordExternalOwnerId, e, this.id) : this._warnParticipantNotInConversation(t.initiator);
|
|
10795
10781
|
} else L.onRecordStopped(e, null, this.id);
|
|
10796
10782
|
}
|
|
10797
|
-
|
|
10783
|
+
_changeAsrInfoForRoom() {
|
|
10798
10784
|
if (!this._conversation) return;
|
|
10799
10785
|
let e = this._conversation.roomId, t = this._conversation.asrInfoByRoom.get(e);
|
|
10800
10786
|
if (t) {
|
|
10801
|
-
let n =
|
|
10787
|
+
let n = this._getExternalIdByParticipantId(t.initiatorId);
|
|
10802
10788
|
n && L.onAsrSet({
|
|
10803
10789
|
externalId: n,
|
|
10804
10790
|
movieId: t.movieId
|
|
10805
10791
|
}, e, this.id);
|
|
10806
10792
|
} else L.onAsrSet(null, e, this.id);
|
|
10807
10793
|
}
|
|
10808
|
-
|
|
10794
|
+
_changeUrlSharingInfoForRoom() {
|
|
10809
10795
|
if (!this._conversation) return;
|
|
10810
10796
|
let { roomId: e } = this._conversation, { urlSharingInfoByRoom: t } = this._conversation, n = t.get(e);
|
|
10811
10797
|
if (n) {
|
|
10812
|
-
let t =
|
|
10798
|
+
let t = this._getExternalIdByParticipantId(n.initiatorId);
|
|
10813
10799
|
t && L.onRemoteSharedUrl(t, n.sharedUrl, e, this.id);
|
|
10814
10800
|
}
|
|
10815
10801
|
}
|
|
10816
|
-
|
|
10802
|
+
_onParticipantAnimojiChanged(e) {
|
|
10817
10803
|
if (this._conversation) {
|
|
10818
|
-
let t =
|
|
10804
|
+
let t = this._getExternalIdByParticipantId(e.participantId);
|
|
10819
10805
|
if (!t) {
|
|
10820
10806
|
this._warnParticipantNotInConversation(e.participantId);
|
|
10821
10807
|
return;
|
|
@@ -10823,11 +10809,11 @@ var Eo = class {
|
|
|
10823
10809
|
L.onParticipantVmojiUpdate(t, this.id);
|
|
10824
10810
|
}
|
|
10825
10811
|
}
|
|
10826
|
-
|
|
10812
|
+
_onAsrStart(e) {
|
|
10827
10813
|
if (!this._conversation) return;
|
|
10828
10814
|
let t = e.asrInfo, n = e.roomId || null;
|
|
10829
10815
|
this._conversation.asrInfoByRoom.set(n, t);
|
|
10830
|
-
let r =
|
|
10816
|
+
let r = this._getExternalIdByParticipantId(t.initiatorId);
|
|
10831
10817
|
if (!r) {
|
|
10832
10818
|
this._warnParticipantNotInConversation(t.initiatorId);
|
|
10833
10819
|
return;
|
|
@@ -10839,9 +10825,9 @@ var Eo = class {
|
|
|
10839
10825
|
let t = e.roomId || null;
|
|
10840
10826
|
t === null && (this._conversation.asrInfo = null), this._conversation.asrInfoByRoom.delete(t), L.onAsrStopped(t, this.id);
|
|
10841
10827
|
}
|
|
10842
|
-
|
|
10828
|
+
_onAsrTranscription(e) {
|
|
10843
10829
|
if (!this._conversation) return;
|
|
10844
|
-
let t =
|
|
10830
|
+
let t = this._getExternalIdByParticipantId(e.participantId);
|
|
10845
10831
|
if (!t) {
|
|
10846
10832
|
this._warnParticipantNotInConversation(e.participantId);
|
|
10847
10833
|
return;
|
|
@@ -10856,7 +10842,7 @@ var Eo = class {
|
|
|
10856
10842
|
}), j.includesOneOf(t, [Va.ADMIN, Va.CREATOR]) ? this._refreshRooms(!0) : t.length || this._onRoomSwitched(null);
|
|
10857
10843
|
return;
|
|
10858
10844
|
}
|
|
10859
|
-
let n =
|
|
10845
|
+
let n = this._getParticipant(e);
|
|
10860
10846
|
n && !Ha(n.roles, t) && (this._debug.debug(`Roles for participant [${e}] changed: ${t}`), n.roles = t, L.onRolesChanged(n.externalId, t, !1, this.id));
|
|
10861
10847
|
}
|
|
10862
10848
|
async _onMuteParticipant(e, t = !1) {
|
|
@@ -10867,10 +10853,10 @@ var Eo = class {
|
|
|
10867
10853
|
this._debug.warn(`Not admin got mute states for participant [${e.participantId}]`);
|
|
10868
10854
|
return;
|
|
10869
10855
|
}
|
|
10870
|
-
let t =
|
|
10856
|
+
let t = this._getParticipant(e.participantId);
|
|
10871
10857
|
if (t) {
|
|
10872
10858
|
this._debug.debug(`Mute states for participant [${e.participantId}] changed`, r);
|
|
10873
|
-
let o = e.adminId ?
|
|
10859
|
+
let o = e.adminId ? this._getExternalIdByParticipantId(e.adminId) : null;
|
|
10874
10860
|
L.onMuteStates(r, i, a, n, e.unmute, t.externalId, o, e.stateUpdated, e.requestedMedia, e.roomId, this.id);
|
|
10875
10861
|
}
|
|
10876
10862
|
return;
|
|
@@ -10903,7 +10889,7 @@ var Eo = class {
|
|
|
10903
10889
|
}
|
|
10904
10890
|
async _processMuteState(e) {
|
|
10905
10891
|
if (!this._conversation || !this._mediaSource || this._participantState !== X.ACCEPTED) return;
|
|
10906
|
-
let { mediaOptions: t = [], muteAll: n, unmute: r, stateUpdated: i, requestedMedia: a, roomId: o = null, unmuteOptions: s = [] } = e, c = e.adminId ?
|
|
10892
|
+
let { mediaOptions: t = [], muteAll: n, unmute: r, stateUpdated: i, requestedMedia: a, roomId: o = null, unmuteOptions: s = [] } = e, c = e.adminId ? this._getExternalIdByParticipantId(e.adminId) : null, l = Object.assign({}, e.muteStates ?? this._getMuteStatesForRoomId(o)), u = this._mediaSource.mediaSettings, d = Object.entries(l);
|
|
10907
10893
|
for (let [e, i] of d) {
|
|
10908
10894
|
let a = this._isCallAdmin() && n;
|
|
10909
10895
|
if (!(i !== La.MUTE && i !== La.MUTE_PERMANENT || a) && (this._isCallAdmin() && i === La.MUTE_PERMANENT && !n && (l[e] = La.MUTE), !(!t.includes(e) || r))) switch (e) {
|
|
@@ -10927,17 +10913,17 @@ var Eo = class {
|
|
|
10927
10913
|
}
|
|
10928
10914
|
L.onMuteStates(l, s, t, n, r, null, c, i, a, o, this.id);
|
|
10929
10915
|
}
|
|
10930
|
-
|
|
10916
|
+
_onPinParticipant(e, t = !1, n, r = null) {
|
|
10931
10917
|
if (!this._conversation) return;
|
|
10932
10918
|
let i = this._conversation.pinnedParticipantIdByRoom.get(r);
|
|
10933
10919
|
if (i && i !== e) if (this._isMe(i)) L.onLocalPin(!0, r, this.id);
|
|
10934
10920
|
else {
|
|
10935
|
-
let t =
|
|
10921
|
+
let t = this._getExternalIdByParticipantId(i);
|
|
10936
10922
|
t && L.onPinnedParticipant(t, !0, this._denormalizeMarkers(e, n), r, this.id);
|
|
10937
10923
|
}
|
|
10938
10924
|
if (this._isMe(e)) L.onLocalPin(t, r, this.id);
|
|
10939
10925
|
else {
|
|
10940
|
-
let i =
|
|
10926
|
+
let i = this._getExternalIdByParticipantId(e);
|
|
10941
10927
|
i && L.onPinnedParticipant(i, t, this._denormalizeMarkers(e, n), r, this.id);
|
|
10942
10928
|
}
|
|
10943
10929
|
this._conversation.pinnedParticipantIdByRoom.set(r, t ? null : e);
|
|
@@ -10947,7 +10933,7 @@ var Eo = class {
|
|
|
10947
10933
|
}
|
|
10948
10934
|
async _onNetworkStatus(e) {
|
|
10949
10935
|
if (this._conversation) {
|
|
10950
|
-
let t = [], n =
|
|
10936
|
+
let t = [], n = this._getParticipants();
|
|
10951
10937
|
for (let [r, i] of Object.entries(e)) {
|
|
10952
10938
|
let e;
|
|
10953
10939
|
if (this._isMe(r) || r === "") e = this._conversation.networkRating;
|
|
@@ -10967,11 +10953,11 @@ var Eo = class {
|
|
|
10967
10953
|
}
|
|
10968
10954
|
}
|
|
10969
10955
|
async _emitHeldParticipantsStatus() {
|
|
10970
|
-
let e = Object.values(
|
|
10956
|
+
let e = Object.values(this._getParticipants()).filter((e) => e.isOnHold).map((e) => e.externalId);
|
|
10971
10957
|
e.length && L.onRemoteStatus(e, N.ONHOLD, null, this.id);
|
|
10972
10958
|
}
|
|
10973
10959
|
async _onRemoteStreamSecond(e, t) {
|
|
10974
|
-
let n =
|
|
10960
|
+
let n = this._getParticipant(e);
|
|
10975
10961
|
n && L.onRemoteScreenStream(n.externalId, t, this.id);
|
|
10976
10962
|
}
|
|
10977
10963
|
async _onAnimojiStream(e, t) {
|
|
@@ -10979,12 +10965,12 @@ var Eo = class {
|
|
|
10979
10965
|
L.onVmojiStream(t, this._mediaSource.mediaSettings, this.id);
|
|
10980
10966
|
return;
|
|
10981
10967
|
}
|
|
10982
|
-
let n =
|
|
10968
|
+
let n = this._getParticipant(e);
|
|
10983
10969
|
n && L.onRemoteVmojiStream(n.externalId, t, this.id);
|
|
10984
10970
|
}
|
|
10985
|
-
|
|
10971
|
+
_onAnimojiError(e) {
|
|
10986
10972
|
try {
|
|
10987
|
-
let t =
|
|
10973
|
+
let t = this._getExternalIdByParticipantId(e.participantId);
|
|
10988
10974
|
t && (delete e.participantId, L.onVmojiError({
|
|
10989
10975
|
...e,
|
|
10990
10976
|
externalId: t
|
|
@@ -11011,7 +10997,7 @@ var Eo = class {
|
|
|
11011
10997
|
async _onVolumesDetected(e) {
|
|
11012
10998
|
let t = [];
|
|
11013
10999
|
for (let [n, r] of Object.entries(e)) {
|
|
11014
|
-
let e =
|
|
11000
|
+
let e = this._getParticipant(n);
|
|
11015
11001
|
e && e.externalId && t.push({
|
|
11016
11002
|
uid: e.externalId,
|
|
11017
11003
|
volume: r.real
|
|
@@ -11022,14 +11008,14 @@ var Eo = class {
|
|
|
11022
11008
|
async _onSpeakerChanged(e) {
|
|
11023
11009
|
let t = this._activeSpeakerId;
|
|
11024
11010
|
if (this._activeSpeakerId = e, t && t !== e) {
|
|
11025
|
-
let e =
|
|
11011
|
+
let e = this._getParticipant(t);
|
|
11026
11012
|
if (e?.connectionStatus.sessionStateConnectedBySpeaker) {
|
|
11027
11013
|
e.connectionStatus.sessionStateConnectedBySpeaker = !1;
|
|
11028
11014
|
let t = this._setTransportStatus(e, e.connectionStatus.transport);
|
|
11029
11015
|
this._emitParticipantTransition(e, t);
|
|
11030
11016
|
}
|
|
11031
11017
|
}
|
|
11032
|
-
let n =
|
|
11018
|
+
let n = this._getParticipant(e);
|
|
11033
11019
|
if (n) {
|
|
11034
11020
|
if (n.connectionStatus.sessionStateApplicable && n.connectionStatus.sessionState?.connected === !1) {
|
|
11035
11021
|
let e = Wa.fromTransportState(this._transport?.getState());
|
|
@@ -11044,7 +11030,7 @@ var Eo = class {
|
|
|
11044
11030
|
this._debug.debug(`Transport state has changed: ${t}`, e);
|
|
11045
11031
|
let n = Wa.fromTransportState(t);
|
|
11046
11032
|
if (!n) return;
|
|
11047
|
-
let r =
|
|
11033
|
+
let r = this._getParticipants(), i = [], a = e.reduce((e, n) => {
|
|
11048
11034
|
if (n in r) {
|
|
11049
11035
|
let a = r[n];
|
|
11050
11036
|
e.push(a), t === q.CONNECTED && (a.remoteStream || (a.mediaSettings && this._changeRemoteMediaSettings(n, a.mediaSettings), this._changeRemoteParticipantState(n, a.participantState)), i.push(...Object.values(a.lastRequestedLayouts)));
|
|
@@ -11058,25 +11044,25 @@ var Eo = class {
|
|
|
11058
11044
|
let e = Object.values(this._myLastRequestedLayouts);
|
|
11059
11045
|
await this.updateDisplayLayout(e), this._displayLayoutRequester.resend();
|
|
11060
11046
|
}
|
|
11061
|
-
this._state !== "HELD" && ((e === q.CONNECTING || e === q.RECONNECTING) &&
|
|
11047
|
+
this._state !== "HELD" && ((e === q.CONNECTING || e === q.RECONNECTING) && this._areTransportParticipantsOnHold() || (e === q.CONNECTING && L.onLocalStatus(N.CONNECTING, this.id), e === q.RECONNECTING && L.onLocalStatus(N.RECONNECT, this.id), e === q.FAILED && this._transport && this._transport.allocated().length === 0 && (this._signaling.ready && await this._signaling.hangup(D.FAILED), this._close(new O(D.FAILED), "Transport failed"))));
|
|
11062
11048
|
}
|
|
11063
|
-
|
|
11049
|
+
_areTransportParticipantsOnHold() {
|
|
11064
11050
|
if (!M.hold || !this._transport) return !1;
|
|
11065
11051
|
let e = this._transport.opened().length ? this._transport.opened() : this._transport.allocated();
|
|
11066
11052
|
if (!e.length) return !1;
|
|
11067
|
-
let t =
|
|
11053
|
+
let t = this._getParticipants();
|
|
11068
11054
|
return e.every((e) => t[e]?.isOnHold);
|
|
11069
11055
|
}
|
|
11070
|
-
|
|
11056
|
+
_onRemoteTrackAdded(e, t, n) {
|
|
11071
11057
|
if (e.endsWith(Br.AUDIO_MIX)) this._debug.debug("Remote audio mix track added"), this._audioOutput.add(e, n), L.onRemoteMixedAudioStream(t, this.id);
|
|
11072
11058
|
else if (e.startsWith(Br.TRANSPARENT_AUDIO_TRACK_PREFIX)) this._debug.debug(`Remote transparent audio track added: ${e}`), this._audioOutput.add(e, n);
|
|
11073
11059
|
else if (e.startsWith(Br.PARTICIPANT_AGNOSTIC_TRACK_PREFIX)) this._debug.debug(`Participant-agnostic track added: ${e}`), this._streamByStreamId.set(e, t);
|
|
11074
11060
|
else {
|
|
11075
11061
|
this._debug.debug(`Remote track added on the participant [${e}]`, { kind: n.kind });
|
|
11076
|
-
let r =
|
|
11062
|
+
let r = this._getParticipant(e);
|
|
11077
11063
|
if (!r) {
|
|
11078
11064
|
let t = this._api.getDecorativeIdByInitialId(e), n = t ? j.composeUserId(t) : void 0;
|
|
11079
|
-
this._debug.warn(`Conversation: track added before participant [id: ${e}, decorativeId: ${n}]`), this._registerParticipant({ id: e }, n), r =
|
|
11065
|
+
this._debug.warn(`Conversation: track added before participant [id: ${e}, decorativeId: ${n}]`), this._registerParticipant({ id: e }, n), r = this._getParticipant(e), this._setParticipantsStatus([r], N.WAITING), this._activeSpeakerId === e && this._lastSignalledActiveSpeakerId !== e && (L.onSpeakerChanged(r.externalId, this.id), this._lastSignalledActiveSpeakerId = e);
|
|
11080
11066
|
}
|
|
11081
11067
|
if (this._transport && !this._transport.isAllocated(r.id) && this._allocateParticipantTransport(r.id, !1), n.kind === k.audio && (this._audioOutput.add(e, n), M.preserveAudioTracks || (r.remoteAudioTrack = n, t.removeTrack(n))), r.remoteStream !== t && t.getTracks().length) {
|
|
11082
11068
|
if (r.remoteStream = t, r.secondStream) return;
|
|
@@ -11098,7 +11084,7 @@ var Eo = class {
|
|
|
11098
11084
|
}
|
|
11099
11085
|
async _removeAudioTrack(e, t, n) {
|
|
11100
11086
|
if (e !== Br.AUDIO_MIX) {
|
|
11101
|
-
let n =
|
|
11087
|
+
let n = this._getParticipant(e);
|
|
11102
11088
|
if (!n || n.remoteStream && n.remoteStream !== t) return;
|
|
11103
11089
|
}
|
|
11104
11090
|
this._audioOutput.remove(e, n);
|
|
@@ -11122,10 +11108,10 @@ var Eo = class {
|
|
|
11122
11108
|
_onAudioMixStall(e) {
|
|
11123
11109
|
this._audioMixStalled !== e && !this.isCallHeld && (this._audioMixStalled = e, this._debug.debug("Audio mix stalled:", e), L.onLocalStatus(e ? N.RECONNECT : N.CONNECTED, this.id));
|
|
11124
11110
|
}
|
|
11125
|
-
|
|
11111
|
+
_onRemoteSignalledStall(e) {
|
|
11126
11112
|
let t = {}, n = [], r = [];
|
|
11127
11113
|
this._debug.debug("Participants stalled:", e);
|
|
11128
|
-
let i =
|
|
11114
|
+
let i = this._getParticipants();
|
|
11129
11115
|
for (let r of e) {
|
|
11130
11116
|
if (t[r] = !0, !this._lastStalled[r]) {
|
|
11131
11117
|
let e = i[r];
|
|
@@ -11139,8 +11125,8 @@ var Eo = class {
|
|
|
11139
11125
|
}
|
|
11140
11126
|
n.length && this._setParticipantsStatus(n, N.RECONNECT), r.length && this._setParticipantsStatus(r, N.CONNECTED), this._lastStalled = t;
|
|
11141
11127
|
}
|
|
11142
|
-
|
|
11143
|
-
this._debugInfo && this._debugInfo.onRemoteDataStats(e,
|
|
11128
|
+
_onRemoteDataStats(e) {
|
|
11129
|
+
this._debugInfo && this._debugInfo.onRemoteDataStats(e, this._getParticipants()), this._fixAudioDevice(e.outbound.rtps), this._fixVideoDevice(e.outbound.rtps);
|
|
11144
11130
|
}
|
|
11145
11131
|
_fixAudioDevice(e) {
|
|
11146
11132
|
!T.hasMicrophone() || !this._audioFix || !this.mediaSettings?.isAudioEnabled || this._audioFix.fix(e);
|
|
@@ -11179,26 +11165,26 @@ var Eo = class {
|
|
|
11179
11165
|
_onJoinLinkChanged(e) {
|
|
11180
11166
|
this._conversation && e.joinLink && (this._conversation.joinLink = e.joinLink), L.onJoinLinkChanged(e.joinLink, this.id);
|
|
11181
11167
|
}
|
|
11182
|
-
|
|
11168
|
+
_onRoomsUpdated(e) {
|
|
11183
11169
|
if (this._isCalledState()) return;
|
|
11184
11170
|
let t = {};
|
|
11185
11171
|
for (let n of Object.keys(Ra)) {
|
|
11186
11172
|
let r = e.updates[n];
|
|
11187
11173
|
r && (t[n] = {
|
|
11188
|
-
rooms:
|
|
11174
|
+
rooms: r?.rooms?.map(this._convertRoomToExternal.bind(this)) || [],
|
|
11189
11175
|
roomIds: r?.roomIds,
|
|
11190
11176
|
deactivated: r?.deactivated
|
|
11191
11177
|
});
|
|
11192
11178
|
}
|
|
11193
11179
|
L.onRoomsUpdated(t, this.id);
|
|
11194
11180
|
}
|
|
11195
|
-
|
|
11196
|
-
let t =
|
|
11181
|
+
_onRoomUpdated(e) {
|
|
11182
|
+
let t = this._convertRoomToExternal(e.room || null);
|
|
11197
11183
|
e.events.some((e) => e === Ra.UPDATE) && (e.muteStates !== void 0 && this._setMuteStatesForRoomId(e.muteStates, e.roomId), e.recordInfo !== void 0 && this._conversation?.recordsInfoByRoom.set(e.roomId, e.recordInfo), e.asrInfo !== void 0 && this._conversation?.asrInfoByRoom.set(e.roomId, e.asrInfo)), this._isCalledState() || L.onRoomUpdated(e.events, e.roomId, t, e.deactivate || null, this.id);
|
|
11198
11184
|
}
|
|
11199
|
-
|
|
11185
|
+
_convertRoomToExternal(e) {
|
|
11200
11186
|
if (!e) return null;
|
|
11201
|
-
let t =
|
|
11187
|
+
let t = e.participantIds?.map((e) => this._getExternalIdByParticipantId(e)) || [], n = e.addParticipantIds?.map((e) => this._getExternalIdByParticipantId(e)) || [], r = e.removeParticipantIds?.map?.((e) => this._getExternalIdByParticipantId(e)) || [], i = e.pinnedParticipantId ? this._getExternalIdByParticipantId(e.pinnedParticipantId) : void 0;
|
|
11202
11188
|
return {
|
|
11203
11189
|
id: e.id,
|
|
11204
11190
|
name: e.name,
|
|
@@ -11206,7 +11192,7 @@ var Eo = class {
|
|
|
11206
11192
|
participantIds: t,
|
|
11207
11193
|
addParticipantIds: n,
|
|
11208
11194
|
removeParticipantIds: r,
|
|
11209
|
-
participants: e.participants?.participants ?
|
|
11195
|
+
participants: e.participants?.participants ? this._participantListChunkToExternalChunk(e.participants) : void 0,
|
|
11210
11196
|
active: e.active,
|
|
11211
11197
|
muteStates: e.muteStates,
|
|
11212
11198
|
pinnedParticipantId: i,
|
|
@@ -11220,7 +11206,7 @@ var Eo = class {
|
|
|
11220
11206
|
let e = this._convertExternalIdsToServerExternalIds(i);
|
|
11221
11207
|
a = (await this._signaling.getParticipants(e)).participants;
|
|
11222
11208
|
}
|
|
11223
|
-
let o =
|
|
11209
|
+
let o = a?.map((e) => {
|
|
11224
11210
|
let r = j.composeId(e);
|
|
11225
11211
|
return this._createParticipant({
|
|
11226
11212
|
id: r,
|
|
@@ -11237,21 +11223,20 @@ var Eo = class {
|
|
|
11237
11223
|
markers: this._denormalizeMarkers(r, e.markers),
|
|
11238
11224
|
isInRoom: n !== null
|
|
11239
11225
|
}, e.decorativeUserId);
|
|
11240
|
-
}) || []
|
|
11226
|
+
}) || [], s = !1;
|
|
11241
11227
|
for (let e of o) e.id === this._conversation?.compositeUserId && (s = !0), this._registerParticipantInCache(e);
|
|
11242
11228
|
this._transport?.getState() === q.IDLE && !this._isCalledState() && this._openTransport(o, !0);
|
|
11243
|
-
let c = []
|
|
11229
|
+
let c = [];
|
|
11244
11230
|
if (e?.removedParticipantMarkers) {
|
|
11245
11231
|
for (let t of e.removedParticipantMarkers) if (t.GRID?.id) {
|
|
11246
11232
|
let e = this._getExternalIdByParticipantId(t.GRID.id);
|
|
11247
|
-
|
|
11233
|
+
c.push(e);
|
|
11248
11234
|
}
|
|
11249
|
-
c = await Promise.all(l);
|
|
11250
11235
|
}
|
|
11251
11236
|
if (s && await this._onRoomSwitched(n), c) {
|
|
11252
11237
|
let e = this._conversation?.pinnedParticipantIdByRoom.get(n);
|
|
11253
11238
|
if (e) {
|
|
11254
|
-
let t =
|
|
11239
|
+
let t = this._getExternalIdByParticipantId(e);
|
|
11255
11240
|
if (t) {
|
|
11256
11241
|
for (let e of c) if (Z.compare(t, e)) {
|
|
11257
11242
|
this._conversation?.pinnedParticipantIdByRoom.delete(n);
|
|
@@ -11260,7 +11245,7 @@ var Eo = class {
|
|
|
11260
11245
|
}
|
|
11261
11246
|
}
|
|
11262
11247
|
}
|
|
11263
|
-
let
|
|
11248
|
+
let l = {
|
|
11264
11249
|
roomId: n,
|
|
11265
11250
|
participantCount: e.participantCount,
|
|
11266
11251
|
addedParticipantIds: i,
|
|
@@ -11268,7 +11253,7 @@ var Eo = class {
|
|
|
11268
11253
|
removedParticipantMarkers: e?.removedParticipantMarkers,
|
|
11269
11254
|
removedParticipantIds: c
|
|
11270
11255
|
};
|
|
11271
|
-
this._isCalledState() || L.onRoomParticipantsUpdated(
|
|
11256
|
+
this._isCalledState() || L.onRoomParticipantsUpdated(l, this.id);
|
|
11272
11257
|
}
|
|
11273
11258
|
async _onRoomSwitched(e, t = !1) {
|
|
11274
11259
|
if (!this._conversation || this._conversation.roomId === e) return;
|
|
@@ -11277,7 +11262,7 @@ var Eo = class {
|
|
|
11277
11262
|
L.onRoomStart(e, this.id);
|
|
11278
11263
|
return;
|
|
11279
11264
|
}
|
|
11280
|
-
this._isCalledState() || L.onRoomSwitched(e, this.id), e !== null && !this._isCallAdmin() && await this._refreshRooms(!1), this._changePinnedParticipantForRoom(), this._changeRecordInfoForRoom(), this._changeMuteStatesForRoom(e, n),
|
|
11265
|
+
this._isCalledState() || L.onRoomSwitched(e, this.id), e !== null && !this._isCallAdmin() && await this._refreshRooms(!1), this._changePinnedParticipantForRoom(), this._changeRecordInfoForRoom(), this._changeMuteStatesForRoom(e, n), this._changeAsrInfoForRoom(), this._changeUrlSharingInfoForRoom();
|
|
11281
11266
|
}
|
|
11282
11267
|
async _refreshRooms(e) {
|
|
11283
11268
|
let t;
|
|
@@ -11286,15 +11271,15 @@ var Eo = class {
|
|
|
11286
11271
|
for (let t of n) {
|
|
11287
11272
|
let n = t.id ?? null;
|
|
11288
11273
|
if (this._setMuteStatesForRoomId(t.muteStates, n), this._conversation?.recordsInfoByRoom.set(n, t.recordInfo ?? null), this._conversation?.pinnedParticipantIdByRoom.set(n, t.pinnedParticipantId ?? null), t.asrInfo && this._conversation?.asrInfoByRoom.set(n, t.asrInfo), t.urlSharingInfo ? this._conversation?.urlSharingInfoByRoom.set(n, t.urlSharingInfo) : this._conversation?.urlSharingInfoByRoom.delete(n), e) {
|
|
11289
|
-
let e =
|
|
11274
|
+
let e = this._getParticipants();
|
|
11290
11275
|
await this._registerParticipants(t?.participants?.participants?.filter((t) => !e[j.composeId(t)]) || [], !0);
|
|
11291
|
-
let n =
|
|
11276
|
+
let n = this._convertRoomToExternal(t);
|
|
11292
11277
|
n && r.push(n);
|
|
11293
11278
|
}
|
|
11294
11279
|
}
|
|
11295
11280
|
r.length && !this._isCalledState() && L.onRoomsUpdated({ [Ra.UPDATE]: { rooms: r } }, this.id);
|
|
11296
11281
|
}
|
|
11297
|
-
|
|
11282
|
+
_onFeedback(e) {
|
|
11298
11283
|
let t = [];
|
|
11299
11284
|
for (let n of e.feedback) {
|
|
11300
11285
|
let e = {
|
|
@@ -11302,7 +11287,7 @@ var Eo = class {
|
|
|
11302
11287
|
items: []
|
|
11303
11288
|
};
|
|
11304
11289
|
for (let t of n.items) {
|
|
11305
|
-
let n =
|
|
11290
|
+
let n = this._getExternalIdByParticipantId(t.participantId);
|
|
11306
11291
|
n ? e.items.push({
|
|
11307
11292
|
...t,
|
|
11308
11293
|
participantId: n
|
|
@@ -11312,11 +11297,11 @@ var Eo = class {
|
|
|
11312
11297
|
}
|
|
11313
11298
|
L.onFeedback(t, e.roomId, this.id);
|
|
11314
11299
|
}
|
|
11315
|
-
|
|
11300
|
+
_onDecorativeParticipantIdChanged(e) {
|
|
11316
11301
|
if (!this._conversation || !e.decorativeParticipantId || !e.decorativeExternalParticipantId) return;
|
|
11317
11302
|
let { participantId: t, decorativeParticipantId: n, decorativeExternalParticipantId: r } = e, i = this._isMe(t);
|
|
11318
11303
|
this._debug.debug(`Decorative participant id changed [${t}]`, e);
|
|
11319
|
-
let a =
|
|
11304
|
+
let a = this._getExternalIdByParticipantId(t);
|
|
11320
11305
|
if (!a) {
|
|
11321
11306
|
this._warnParticipantNotInConversation(t);
|
|
11322
11307
|
return;
|
|
@@ -11324,7 +11309,7 @@ var Eo = class {
|
|
|
11324
11309
|
let o = Z.fromSignaling(r, a.deviceIdx);
|
|
11325
11310
|
if (L.onParticipantIdChanged(a, o, this.id), this._api.cacheExternalId(n, o), this._api.mapDecorativeId(n, t), i) this._conversation.externalId = o;
|
|
11326
11311
|
else {
|
|
11327
|
-
let e =
|
|
11312
|
+
let e = this._getParticipants();
|
|
11328
11313
|
e[t].externalId = o;
|
|
11329
11314
|
}
|
|
11330
11315
|
}
|
|
@@ -11333,7 +11318,7 @@ var Eo = class {
|
|
|
11333
11318
|
}
|
|
11334
11319
|
async _onParticipantHold(e) {
|
|
11335
11320
|
this._debug.debug("Participant hold suggested", e);
|
|
11336
|
-
let t =
|
|
11321
|
+
let t = this._getParticipant(e.participantId);
|
|
11337
11322
|
if (!t) {
|
|
11338
11323
|
this._warnParticipantNotInConversation(e.participantId);
|
|
11339
11324
|
return;
|
|
@@ -11361,28 +11346,17 @@ var Eo = class {
|
|
|
11361
11346
|
}
|
|
11362
11347
|
_registerParticipant(e, t) {
|
|
11363
11348
|
let n = this._createParticipant(e, t);
|
|
11364
|
-
|
|
11349
|
+
this._pendingParticipants.set(e.id, n);
|
|
11365
11350
|
}
|
|
11366
|
-
|
|
11351
|
+
_getParticipants() {
|
|
11367
11352
|
if (this._pendingParticipants.size) {
|
|
11368
|
-
let e
|
|
11369
|
-
|
|
11370
|
-
let [i] = e[r];
|
|
11371
|
-
this._pendingParticipants.delete(i);
|
|
11372
|
-
let a = t[r];
|
|
11373
|
-
if (a.status === "fulfilled") {
|
|
11374
|
-
let e = a.value;
|
|
11375
|
-
this._participants[e.id] = e;
|
|
11376
|
-
continue;
|
|
11377
|
-
}
|
|
11378
|
-
n = n ?? a.reason, this._debug.warn(`Failed to resolve pending participant [${i}]`, a.reason);
|
|
11379
|
-
}
|
|
11380
|
-
if (n) throw n;
|
|
11353
|
+
for (let e of this._pendingParticipants.values()) this._participants[e.id] = e;
|
|
11354
|
+
this._pendingParticipants.clear();
|
|
11381
11355
|
}
|
|
11382
11356
|
return this._participants;
|
|
11383
11357
|
}
|
|
11384
|
-
|
|
11385
|
-
return
|
|
11358
|
+
_getParticipant(e) {
|
|
11359
|
+
return this._getParticipants()[e];
|
|
11386
11360
|
}
|
|
11387
11361
|
}, zo = null, Bo = class e extends Error {
|
|
11388
11362
|
constructor(t, n) {
|
|
@@ -11618,9 +11592,9 @@ var Qo = class {
|
|
|
11618
11592
|
throw new O(i, a);
|
|
11619
11593
|
}
|
|
11620
11594
|
}
|
|
11621
|
-
|
|
11622
|
-
let t = j.
|
|
11623
|
-
return v.isEmpty() ? Z.fromId(String(
|
|
11595
|
+
userId(e) {
|
|
11596
|
+
let { compositeUserId: t } = j.decomposeParticipantId(e), { id: n, type: r } = j.decomposeId(t), i = r === A.GROUP ? Ga.GROUP : Ga.USER;
|
|
11597
|
+
return v.isEmpty() ? Z.fromId(String(n), i) : this._idCache.getExternalId(n) || Z.fromId(String(n), i);
|
|
11624
11598
|
}
|
|
11625
11599
|
async authorize() {
|
|
11626
11600
|
if (this._ensureUuid(), !M.apiKey) throw new O(b.API, { message: "Required argument apiAppKey not passed" });
|
|
@@ -12386,7 +12360,8 @@ async function zc(e, t = !1) {
|
|
|
12386
12360
|
R.warn("promoteParticipant: externalId not found in cache", e);
|
|
12387
12361
|
return;
|
|
12388
12362
|
}
|
|
12389
|
-
|
|
12363
|
+
let n = e.type === Ga.GROUP ? A.GROUP : A.USER;
|
|
12364
|
+
r = j.composeUserId(t, n);
|
|
12390
12365
|
}
|
|
12391
12366
|
return n.promoteParticipant(r, t);
|
|
12392
12367
|
}
|