livekit-client 2.3.0 → 2.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. package/dist/livekit-client.e2ee.worker.js +1 -1
  2. package/dist/livekit-client.e2ee.worker.js.map +1 -1
  3. package/dist/livekit-client.e2ee.worker.mjs +6 -1
  4. package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
  5. package/dist/livekit-client.esm.mjs +72 -136
  6. package/dist/livekit-client.esm.mjs.map +1 -1
  7. package/dist/livekit-client.umd.js +1 -1
  8. package/dist/livekit-client.umd.js.map +1 -1
  9. package/dist/src/connectionHelper/ConnectionCheck.d.ts.map +1 -1
  10. package/dist/src/connectionHelper/checks/Checker.d.ts.map +1 -1
  11. package/dist/src/e2ee/E2eeManager.d.ts.map +1 -1
  12. package/dist/src/e2ee/KeyProvider.d.ts.map +1 -1
  13. package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
  14. package/dist/src/e2ee/worker/ParticipantKeyHandler.d.ts.map +1 -1
  15. package/dist/src/index.d.ts +2 -1
  16. package/dist/src/index.d.ts.map +1 -1
  17. package/dist/src/logger.d.ts.map +1 -1
  18. package/dist/src/room/PCTransport.d.ts +1 -2
  19. package/dist/src/room/PCTransport.d.ts.map +1 -1
  20. package/dist/src/room/RTCEngine.d.ts.map +1 -1
  21. package/dist/src/room/Room.d.ts.map +1 -1
  22. package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
  23. package/dist/src/room/participant/Participant.d.ts.map +1 -1
  24. package/dist/src/room/track/RemoteTrackPublication.d.ts.map +1 -1
  25. package/dist/src/room/track/Track.d.ts.map +1 -1
  26. package/dist/src/room/track/TrackPublication.d.ts.map +1 -1
  27. package/dist/ts4.2/src/index.d.ts +2 -1
  28. package/dist/ts4.2/src/room/PCTransport.d.ts +1 -2
  29. package/package.json +12 -12
  30. package/src/e2ee/worker/FrameCryptor.ts +3 -1
  31. package/src/e2ee/worker/e2ee.worker.ts +5 -1
  32. package/src/index.ts +10 -0
  33. package/src/room/Room.ts +7 -3
  34. package/src/room/participant/LocalParticipant.ts +10 -0
  35. package/src/room/track/Track.ts +1 -1
@@ -3782,6 +3782,15 @@ const ParticipantInfo = /*@__PURE__*/proto3.makeMessageType("livekit.Participant
3782
3782
  name: "kind",
3783
3783
  kind: "enum",
3784
3784
  T: proto3.getEnumType(ParticipantInfo_Kind)
3785
+ }, {
3786
+ no: 15,
3787
+ name: "attributes",
3788
+ kind: "map",
3789
+ K: 9 /* ScalarType.STRING */,
3790
+ V: {
3791
+ kind: "scalar",
3792
+ T: 9 /* ScalarType.STRING */
3793
+ }
3785
3794
  }]);
3786
3795
 
3787
3796
  /**
@@ -4161,7 +4170,7 @@ const SipDTMF = /*@__PURE__*/proto3.makeMessageType("livekit.SipDTMF", () => [{
4161
4170
  */
4162
4171
  const Transcription = /*@__PURE__*/proto3.makeMessageType("livekit.Transcription", () => [{
4163
4172
  no: 2,
4164
- name: "participant_identity",
4173
+ name: "transcribed_participant_identity",
4165
4174
  kind: "scalar",
4166
4175
  T: 9 /* ScalarType.STRING */
4167
4176
  }, {
@@ -5171,6 +5180,15 @@ const UpdateParticipantMetadata = /*@__PURE__*/proto3.makeMessageType("livekit.U
5171
5180
  name: "name",
5172
5181
  kind: "scalar",
5173
5182
  T: 9 /* ScalarType.STRING */
5183
+ }, {
5184
+ no: 3,
5185
+ name: "attributes",
5186
+ kind: "map",
5187
+ K: 9 /* ScalarType.STRING */,
5188
+ V: {
5189
+ kind: "scalar",
5190
+ T: 9 /* ScalarType.STRING */
5191
+ }
5174
5192
  }]);
5175
5193
 
5176
5194
  /**
@@ -6571,6 +6589,19 @@ function detectBrowser(window) {
6571
6589
  const {
6572
6590
  navigator
6573
6591
  } = window;
6592
+
6593
+ // Prefer navigator.userAgentData.
6594
+ if (navigator.userAgentData && navigator.userAgentData.brands) {
6595
+ const chromium = navigator.userAgentData.brands.find(brand => {
6596
+ return brand.brand === 'Chromium';
6597
+ });
6598
+ if (chromium) {
6599
+ return {
6600
+ browser: 'chrome',
6601
+ version: parseInt(chromium.version, 10)
6602
+ };
6603
+ }
6604
+ }
6574
6605
  if (navigator.mozGetUserMedia) {
6575
6606
  // Firefox.
6576
6607
  result.browser = 'firefox';
@@ -6846,51 +6877,6 @@ function shimGetUserMedia$2(window, browserDetails) {
6846
6877
  }
6847
6878
  }
6848
6879
 
6849
- /*
6850
- * Copyright (c) 2018 The adapter.js project authors. All Rights Reserved.
6851
- *
6852
- * Use of this source code is governed by a BSD-style license
6853
- * that can be found in the LICENSE file in the root of the source
6854
- * tree.
6855
- */
6856
- /* eslint-env node */
6857
-
6858
- function shimGetDisplayMedia$1(window, getSourceId) {
6859
- if (window.navigator.mediaDevices && 'getDisplayMedia' in window.navigator.mediaDevices) {
6860
- return;
6861
- }
6862
- if (!window.navigator.mediaDevices) {
6863
- return;
6864
- }
6865
- // getSourceId is a function that returns a promise resolving with
6866
- // the sourceId of the screen/window/tab to be shared.
6867
- if (typeof getSourceId !== 'function') {
6868
- console.error('shimGetDisplayMedia: getSourceId argument is not ' + 'a function');
6869
- return;
6870
- }
6871
- window.navigator.mediaDevices.getDisplayMedia = function getDisplayMedia(constraints) {
6872
- return getSourceId(constraints).then(sourceId => {
6873
- const widthSpecified = constraints.video && constraints.video.width;
6874
- const heightSpecified = constraints.video && constraints.video.height;
6875
- const frameRateSpecified = constraints.video && constraints.video.frameRate;
6876
- constraints.video = {
6877
- mandatory: {
6878
- chromeMediaSource: 'desktop',
6879
- chromeMediaSourceId: sourceId,
6880
- maxFrameRate: frameRateSpecified || 3
6881
- }
6882
- };
6883
- if (widthSpecified) {
6884
- constraints.video.mandatory.maxWidth = widthSpecified;
6885
- }
6886
- if (heightSpecified) {
6887
- constraints.video.mandatory.maxHeight = heightSpecified;
6888
- }
6889
- return window.navigator.mediaDevices.getUserMedia(constraints);
6890
- });
6891
- };
6892
- }
6893
-
6894
6880
  /*
6895
6881
  * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
6896
6882
  *
@@ -7065,64 +7051,6 @@ function shimGetSendersWithDtmf(window) {
7065
7051
  });
7066
7052
  }
7067
7053
  }
7068
- function shimGetStats(window) {
7069
- if (!window.RTCPeerConnection) {
7070
- return;
7071
- }
7072
- const origGetStats = window.RTCPeerConnection.prototype.getStats;
7073
- window.RTCPeerConnection.prototype.getStats = function getStats() {
7074
- const [selector, onSucc, onErr] = arguments;
7075
-
7076
- // If selector is a function then we are in the old style stats so just
7077
- // pass back the original getStats format to avoid breaking old users.
7078
- if (arguments.length > 0 && typeof selector === 'function') {
7079
- return origGetStats.apply(this, arguments);
7080
- }
7081
-
7082
- // When spec-style getStats is supported, return those when called with
7083
- // either no arguments or the selector argument is null.
7084
- if (origGetStats.length === 0 && (arguments.length === 0 || typeof selector !== 'function')) {
7085
- return origGetStats.apply(this, []);
7086
- }
7087
- const fixChromeStats_ = function (response) {
7088
- const standardReport = {};
7089
- const reports = response.result();
7090
- reports.forEach(report => {
7091
- const standardStats = {
7092
- id: report.id,
7093
- timestamp: report.timestamp,
7094
- type: {
7095
- localcandidate: 'local-candidate',
7096
- remotecandidate: 'remote-candidate'
7097
- }[report.type] || report.type
7098
- };
7099
- report.names().forEach(name => {
7100
- standardStats[name] = report.stat(name);
7101
- });
7102
- standardReport[standardStats.id] = standardStats;
7103
- });
7104
- return standardReport;
7105
- };
7106
-
7107
- // shim getStats with maplike support
7108
- const makeMapStats = function (stats) {
7109
- return new Map(Object.keys(stats).map(key => [key, stats[key]]));
7110
- };
7111
- if (arguments.length >= 2) {
7112
- const successCallbackWrapper_ = function (response) {
7113
- onSucc(makeMapStats(fixChromeStats_(response)));
7114
- };
7115
- return origGetStats.apply(this, [successCallbackWrapper_, selector]);
7116
- }
7117
-
7118
- // promise-support
7119
- return new Promise((resolve, reject) => {
7120
- origGetStats.apply(this, [function (response) {
7121
- resolve(makeMapStats(fixChromeStats_(response)));
7122
- }, reject]);
7123
- }).then(onSucc, onErr);
7124
- };
7125
- }
7126
7054
  function shimSenderReceiverGetStats(window) {
7127
7055
  if (!(typeof window === 'object' && window.RTCPeerConnection && window.RTCRtpSender && window.RTCRtpReceiver)) {
7128
7056
  return;
@@ -7506,9 +7434,7 @@ var chromeShim = /*#__PURE__*/Object.freeze({
7506
7434
  fixNegotiationNeeded: fixNegotiationNeeded,
7507
7435
  shimAddTrackRemoveTrack: shimAddTrackRemoveTrack,
7508
7436
  shimAddTrackRemoveTrackWithNative: shimAddTrackRemoveTrackWithNative,
7509
- shimGetDisplayMedia: shimGetDisplayMedia$1,
7510
7437
  shimGetSendersWithDtmf: shimGetSendersWithDtmf,
7511
- shimGetStats: shimGetStats,
7512
7438
  shimGetUserMedia: shimGetUserMedia$2,
7513
7439
  shimMediaStream: shimMediaStream,
7514
7440
  shimOnTrack: shimOnTrack$1,
@@ -9451,7 +9377,6 @@ function adapterFactory() {
9451
9377
  shimOnTrack$1(window);
9452
9378
  shimAddTrackRemoveTrack(window, browserDetails);
9453
9379
  shimGetSendersWithDtmf(window);
9454
- shimGetStats(window);
9455
9380
  shimSenderReceiverGetStats(window);
9456
9381
  fixNegotiationNeeded(window, browserDetails);
9457
9382
  shimRTCIceCandidate(window);
@@ -10529,7 +10454,7 @@ function getOSVersion(ua) {
10529
10454
  return ua.includes('mac os') ? getMatch(/\(.+?(\d+_\d+(:?_\d+)?)/, ua, 1).replace(/_/g, '.') : undefined;
10530
10455
  }
10531
10456
 
10532
- var version$1 = "2.3.0";
10457
+ var version$1 = "2.3.2";
10533
10458
 
10534
10459
  const version = version$1;
10535
10460
  const protocolVersion = 13;
@@ -10734,7 +10659,7 @@ class Track extends eventsExports.EventEmitter {
10734
10659
  if (this.kind === Track.Kind.Video) {
10735
10660
  elementType = 'video';
10736
10661
  }
10737
- if (this.attachedElements.length === 0 && Track.Kind.Video) {
10662
+ if (this.attachedElements.length === 0 && this.kind === Track.Kind.Video) {
10738
10663
  this.addAppVisibilityListener();
10739
10664
  }
10740
10665
  if (!element) {
@@ -15998,7 +15923,7 @@ class RTCEngine extends eventsExports.EventEmitter {
15998
15923
  this.maxJoinAttempts = 1;
15999
15924
  this.shouldFailNext = false;
16000
15925
  this.log = livekitLogger;
16001
- this.handleDataChannel = _b => __awaiter(this, [_b], void 0, function (_ref) {
15926
+ this.handleDataChannel = _a => __awaiter(this, [_a], void 0, function (_ref) {
16002
15927
  var _this = this;
16003
15928
  let {
16004
15929
  channel
@@ -16019,7 +15944,7 @@ class RTCEngine extends eventsExports.EventEmitter {
16019
15944
  }();
16020
15945
  });
16021
15946
  this.handleDataMessage = message => __awaiter(this, void 0, void 0, function* () {
16022
- var _c, _d;
15947
+ var _a, _b;
16023
15948
  // make sure to respect incoming data message order by processing message events one after the other
16024
15949
  const unlock = yield this.dataProcessLock.lock();
16025
15950
  try {
@@ -16036,11 +15961,11 @@ class RTCEngine extends eventsExports.EventEmitter {
16036
15961
  return;
16037
15962
  }
16038
15963
  const dp = DataPacket.fromBinary(new Uint8Array(buffer));
16039
- if (((_c = dp.value) === null || _c === void 0 ? void 0 : _c.case) === 'speaker') {
15964
+ if (((_a = dp.value) === null || _a === void 0 ? void 0 : _a.case) === 'speaker') {
16040
15965
  // dispatch speaker updates
16041
15966
  this.emit(EngineEvent.ActiveSpeakersUpdate, dp.value.value.speakers);
16042
15967
  } else {
16043
- if (((_d = dp.value) === null || _d === void 0 ? void 0 : _d.case) === 'user') {
15968
+ if (((_b = dp.value) === null || _b === void 0 ? void 0 : _b.case) === 'user') {
16044
15969
  // compatibility
16045
15970
  applyUserDataCompat(dp, dp.value.value);
16046
15971
  }
@@ -19038,6 +18963,13 @@ class LocalParticipant extends Participant {
19038
18963
  unpublishTrack(track, stopOnUnpublish) {
19039
18964
  return __awaiter(this, void 0, void 0, function* () {
19040
18965
  var _a, _b;
18966
+ if (track instanceof LocalTrack) {
18967
+ const publishPromise = this.pendingPublishPromises.get(track);
18968
+ if (publishPromise) {
18969
+ this.log.info('awaiting publish promise before attempting to unpublish', Object.assign(Object.assign({}, this.logContext), getLogContextFromTrack(track)));
18970
+ yield publishPromise;
18971
+ }
18972
+ }
19041
18973
  // look through all published tracks to find the right ones
19042
18974
  const publication = this.getPublicationForTrack(track);
19043
18975
  const pubLogContext = publication ? getLogContextFromTrack(publication) : undefined;
@@ -19796,7 +19728,7 @@ class Room extends eventsExports.EventEmitter {
19796
19728
  this.bufferedEvents = [];
19797
19729
  this.isResuming = false;
19798
19730
  this.connect = (url, token, opts) => __awaiter(this, void 0, void 0, function* () {
19799
- var _c;
19731
+ var _a;
19800
19732
  if (!isBrowserSupported()) {
19801
19733
  if (isReactNative()) {
19802
19734
  throw Error("WebRTC isn't detected, have you called registerGlobals?");
@@ -19817,7 +19749,7 @@ class Room extends eventsExports.EventEmitter {
19817
19749
  return this.connectFuture.promise;
19818
19750
  }
19819
19751
  this.setAndEmitConnectionState(ConnectionState.Connecting);
19820
- if (((_c = this.regionUrlProvider) === null || _c === void 0 ? void 0 : _c.getServerUrl().toString()) !== url) {
19752
+ if (((_a = this.regionUrlProvider) === null || _a === void 0 ? void 0 : _a.getServerUrl().toString()) !== url) {
19821
19753
  this.regionUrl = undefined;
19822
19754
  this.regionUrlProvider = undefined;
19823
19755
  }
@@ -19837,7 +19769,7 @@ class Room extends eventsExports.EventEmitter {
19837
19769
  });
19838
19770
  }
19839
19771
  const connectFn = (resolve, reject, regionUrl) => __awaiter(this, void 0, void 0, function* () {
19840
- var _d;
19772
+ var _a;
19841
19773
  if (this.abortController) {
19842
19774
  this.abortController.abort();
19843
19775
  }
@@ -19854,7 +19786,7 @@ class Room extends eventsExports.EventEmitter {
19854
19786
  if (this.regionUrlProvider && e instanceof ConnectionError && e.reason !== 3 /* ConnectionErrorReason.Cancelled */ && e.reason !== 0 /* ConnectionErrorReason.NotAllowed */) {
19855
19787
  let nextUrl = null;
19856
19788
  try {
19857
- nextUrl = yield this.regionUrlProvider.getNextBestRegionUrl((_d = this.abortController) === null || _d === void 0 ? void 0 : _d.signal);
19789
+ nextUrl = yield this.regionUrlProvider.getNextBestRegionUrl((_a = this.abortController) === null || _a === void 0 ? void 0 : _a.signal);
19858
19790
  } catch (error) {
19859
19791
  if (error instanceof ConnectionError && (error.status === 401 || error.reason === 3 /* ConnectionErrorReason.Cancelled */)) {
19860
19792
  this.handleDisconnect(this.options.stopLocalTrackOnUnpublish);
@@ -19886,7 +19818,7 @@ class Room extends eventsExports.EventEmitter {
19886
19818
  return this.connectFuture.promise;
19887
19819
  });
19888
19820
  this.connectSignal = (url, token, engine, connectOptions, roomOptions, abortController) => __awaiter(this, void 0, void 0, function* () {
19889
- var _e, _f, _g;
19821
+ var _a, _b, _c;
19890
19822
  const joinResponse = yield engine.join(url, token, {
19891
19823
  autoSubscribe: connectOptions.autoSubscribe,
19892
19824
  adaptiveStream: typeof roomOptions.adaptiveStream === 'object' ? true : roomOptions.adaptiveStream,
@@ -19905,9 +19837,9 @@ class Room extends eventsExports.EventEmitter {
19905
19837
  let [key, value] = _ref;
19906
19838
  return "".concat(key, ": ").concat(value);
19907
19839
  }).join(', ')), {
19908
- room: (_e = joinResponse.room) === null || _e === void 0 ? void 0 : _e.name,
19909
- roomSid: (_f = joinResponse.room) === null || _f === void 0 ? void 0 : _f.sid,
19910
- identity: (_g = joinResponse.participant) === null || _g === void 0 ? void 0 : _g.identity
19840
+ room: (_a = joinResponse.room) === null || _a === void 0 ? void 0 : _a.name,
19841
+ roomSid: (_b = joinResponse.room) === null || _b === void 0 ? void 0 : _b.sid,
19842
+ identity: (_c = joinResponse.participant) === null || _c === void 0 ? void 0 : _c.identity
19911
19843
  });
19912
19844
  if (!joinResponse.serverVersion) {
19913
19845
  throw new UnsupportedServer('unknown server version');
@@ -19939,8 +19871,8 @@ class Room extends eventsExports.EventEmitter {
19939
19871
  }
19940
19872
  };
19941
19873
  this.attemptConnection = (url, token, opts, abortController) => __awaiter(this, void 0, void 0, function* () {
19942
- var _h, _j, _k;
19943
- if (this.state === ConnectionState.Reconnecting || this.isResuming || ((_h = this.engine) === null || _h === void 0 ? void 0 : _h.pendingReconnect)) {
19874
+ var _a, _b, _c;
19875
+ if (this.state === ConnectionState.Reconnecting || this.isResuming || ((_a = this.engine) === null || _a === void 0 ? void 0 : _a.pendingReconnect)) {
19944
19876
  this.log.info('Reconnection attempt replaced by new connection attempt', this.logContext);
19945
19877
  // make sure we close and recreate the existing engine in order to get rid of any potentially ongoing reconnection attempts
19946
19878
  this.recreateEngine();
@@ -19948,7 +19880,7 @@ class Room extends eventsExports.EventEmitter {
19948
19880
  // create engine if previously disconnected
19949
19881
  this.maybeCreateEngine();
19950
19882
  }
19951
- if ((_j = this.regionUrlProvider) === null || _j === void 0 ? void 0 : _j.isCloud()) {
19883
+ if ((_b = this.regionUrlProvider) === null || _b === void 0 ? void 0 : _b.isCloud()) {
19952
19884
  this.engine.setRegionUrlProvider(this.regionUrlProvider);
19953
19885
  }
19954
19886
  this.acquireAudioContext();
@@ -20001,7 +19933,7 @@ class Room extends eventsExports.EventEmitter {
20001
19933
  }
20002
19934
  if (isWeb()) {
20003
19935
  document.addEventListener('freeze', this.onPageLeave);
20004
- (_k = navigator.mediaDevices) === null || _k === void 0 ? void 0 : _k.addEventListener('devicechange', this.handleDeviceChange);
19936
+ (_c = navigator.mediaDevices) === null || _c === void 0 ? void 0 : _c.addEventListener('devicechange', this.handleDeviceChange);
20005
19937
  }
20006
19938
  this.setAndEmitConnectionState(ConnectionState.Connected);
20007
19939
  this.emit(RoomEvent.Connected);
@@ -20018,7 +19950,7 @@ class Room extends eventsExports.EventEmitter {
20018
19950
  var _this2 = this;
20019
19951
  let stopTracks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
20020
19952
  return function* () {
20021
- var _l, _m, _o, _p;
19953
+ var _a, _b, _c, _d;
20022
19954
  const unlock = yield _this2.disconnectLock.lock();
20023
19955
  try {
20024
19956
  if (_this2.state === ConnectionState.Disconnected) {
@@ -20029,13 +19961,13 @@ class Room extends eventsExports.EventEmitter {
20029
19961
  if (_this2.state === ConnectionState.Connecting || _this2.state === ConnectionState.Reconnecting || _this2.isResuming) {
20030
19962
  // try aborting pending connection attempt
20031
19963
  _this2.log.warn('abort connection attempt', _this2.logContext);
20032
- (_l = _this2.abortController) === null || _l === void 0 ? void 0 : _l.abort();
19964
+ (_a = _this2.abortController) === null || _a === void 0 ? void 0 : _a.abort();
20033
19965
  // in case the abort controller didn't manage to cancel the connection attempt, reject the connect promise explicitly
20034
- (_o = (_m = _this2.connectFuture) === null || _m === void 0 ? void 0 : _m.reject) === null || _o === void 0 ? void 0 : _o.call(_m, new ConnectionError('Client initiated disconnect'));
19966
+ (_c = (_b = _this2.connectFuture) === null || _b === void 0 ? void 0 : _b.reject) === null || _c === void 0 ? void 0 : _c.call(_b, new ConnectionError('Client initiated disconnect'));
20035
19967
  _this2.connectFuture = undefined;
20036
19968
  }
20037
19969
  // send leave
20038
- if (!((_p = _this2.engine) === null || _p === void 0 ? void 0 : _p.client.isDisconnected)) {
19970
+ if (!((_d = _this2.engine) === null || _d === void 0 ? void 0 : _d.client.isDisconnected)) {
20039
19971
  yield _this2.engine.client.sendLeave();
20040
19972
  }
20041
19973
  // close engine (also closes client)
@@ -20177,7 +20109,7 @@ class Room extends eventsExports.EventEmitter {
20177
20109
  this.log.debug("fully reconnected to server", Object.assign(Object.assign({}, this.logContext), {
20178
20110
  region: joinResponse.serverRegion
20179
20111
  }));
20180
- } catch (_q) {
20112
+ } catch (_a) {
20181
20113
  // reconnection failed, handleDisconnect is being invoked already, just return here
20182
20114
  return;
20183
20115
  }
@@ -20245,6 +20177,10 @@ class Room extends eventsExports.EventEmitter {
20245
20177
  this.handleSpeakersChanged = speakerUpdates => {
20246
20178
  const lastSpeakers = new Map();
20247
20179
  this.activeSpeakers.forEach(p => {
20180
+ const remoteParticipant = this.remoteParticipants.get(p.identity);
20181
+ if (remoteParticipant && remoteParticipant.sid !== p.sid) {
20182
+ return;
20183
+ }
20248
20184
  lastSpeakers.set(p.sid, p);
20249
20185
  });
20250
20186
  speakerUpdates.forEach(speaker => {
@@ -20327,9 +20263,9 @@ class Room extends eventsExports.EventEmitter {
20327
20263
  participant === null || participant === void 0 ? void 0 : participant.emit(ParticipantEvent.SipDTMFReceived, dtmf);
20328
20264
  };
20329
20265
  this.bufferedSegments = new Map();
20330
- this.handleTranscription = (remoteParticipant, transcription) => {
20266
+ this.handleTranscription = (_remoteParticipant, transcription) => {
20331
20267
  // find the participant
20332
- const participant = transcription.participantIdentity === this.localParticipant.identity ? this.localParticipant : remoteParticipant;
20268
+ const participant = transcription.transcribedParticipantIdentity === this.localParticipant.identity ? this.localParticipant : this.getParticipantByIdentity(transcription.transcribedParticipantIdentity);
20333
20269
  const publication = participant === null || participant === void 0 ? void 0 : participant.trackPublications.get(transcription.trackId);
20334
20270
  const segments = extractTranscriptionSegments(transcription);
20335
20271
  publication === null || publication === void 0 ? void 0 : publication.emit(TrackEvent.TranscriptionReceived, segments);
@@ -20407,9 +20343,9 @@ class Room extends eventsExports.EventEmitter {
20407
20343
  (_a = processor === null || processor === void 0 ? void 0 : processor.onPublish) === null || _a === void 0 ? void 0 : _a.call(processor, this);
20408
20344
  };
20409
20345
  this.onLocalTrackPublished = pub => __awaiter(this, void 0, void 0, function* () {
20410
- var _r, _s, _t, _u, _v;
20411
- (_r = pub.track) === null || _r === void 0 ? void 0 : _r.on(TrackEvent.TrackProcessorUpdate, this.onTrackProcessorUpdate);
20412
- (_u = (_t = (_s = pub.track) === null || _s === void 0 ? void 0 : _s.getProcessor()) === null || _t === void 0 ? void 0 : _t.onPublish) === null || _u === void 0 ? void 0 : _u.call(_t, this);
20346
+ var _a, _b, _c, _d, _e;
20347
+ (_a = pub.track) === null || _a === void 0 ? void 0 : _a.on(TrackEvent.TrackProcessorUpdate, this.onTrackProcessorUpdate);
20348
+ (_d = (_c = (_b = pub.track) === null || _b === void 0 ? void 0 : _b.getProcessor()) === null || _c === void 0 ? void 0 : _c.onPublish) === null || _d === void 0 ? void 0 : _d.call(_c, this);
20413
20349
  this.emit(RoomEvent.LocalTrackPublished, pub, this.localParticipant);
20414
20350
  if (pub.track instanceof LocalAudioTrack) {
20415
20351
  const trackIsSilent = yield pub.track.checkForSilence();
@@ -20417,7 +20353,7 @@ class Room extends eventsExports.EventEmitter {
20417
20353
  this.emit(RoomEvent.LocalAudioSilenceDetected, pub);
20418
20354
  }
20419
20355
  }
20420
- const deviceId = yield (_v = pub.track) === null || _v === void 0 ? void 0 : _v.getDeviceId();
20356
+ const deviceId = yield (_e = pub.track) === null || _e === void 0 ? void 0 : _e.getDeviceId();
20421
20357
  const deviceKind = sourceToKind(pub.source);
20422
20358
  if (deviceKind && deviceId && deviceId !== this.localParticipant.activeDeviceMap.get(deviceKind)) {
20423
20359
  this.localParticipant.activeDeviceMap.set(deviceKind, deviceId);