@whereby.com/media 1.11.0 → 1.12.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/dist/index.cjs CHANGED
@@ -1421,10 +1421,6 @@ class VegaConnection extends EventEmitter.EventEmitter {
1421
1421
  var _a;
1422
1422
  (_a = this.socket) === null || _a === void 0 ? void 0 : _a.close();
1423
1423
  }
1424
- isConnected() {
1425
- var _a, _b;
1426
- return ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === WebSocket.OPEN || ((_b = this.socket) === null || _b === void 0 ? void 0 : _b.readyState) === WebSocket.CONNECTING;
1427
- }
1428
1424
  _onOpen() {
1429
1425
  logger$9.info("Connected");
1430
1426
  this.emit("open");
@@ -3552,6 +3548,7 @@ class P2pRtcManager {
3552
3548
  this._isAudioOnlyMode = false;
3553
3549
  this.offerOptions = { offerToReceiveAudio: true, offerToReceiveVideo: true };
3554
3550
  this._pendingActionsForConnectedPeerConnections = [];
3551
+ this._nodeJsClients = [];
3555
3552
  this._audioTrackOnEnded = () => {
3556
3553
  rtcStats.sendEvent("audio_ended", { unloading: unloading$1 });
3557
3554
  this._emit(rtcManagerEvents.MICROPHONE_STOPPED_WORKING, {});
@@ -3633,9 +3630,6 @@ class P2pRtcManager {
3633
3630
  }
3634
3631
  return this._replaceTrackToPeerConnections(oldTrack, newTrack);
3635
3632
  }
3636
- accept({ clientId, shouldAddLocalVideo }) {
3637
- return this.acceptNewStream({ streamId: clientId, clientId, shouldAddLocalVideo });
3638
- }
3639
3633
  disconnectAll() {
3640
3634
  Object.keys(this.peerConnections).forEach((peerConnectionId) => {
3641
3635
  this.disconnect(peerConnectionId);
@@ -3670,6 +3664,11 @@ class P2pRtcManager {
3670
3664
  setupSocketListeners() {
3671
3665
  this._socketListenerDeregisterFunctions = [
3672
3666
  () => this._clearMediaServersRefresh(),
3667
+ this._serverSocket.on(PROTOCOL_RESPONSES.NEW_CLIENT, (data) => {
3668
+ if (data.client.isDialIn && !this._nodeJsClients.includes(data.client.id)) {
3669
+ this._nodeJsClients.push(data.client.id);
3670
+ }
3671
+ }),
3673
3672
  this._serverSocket.on(PROTOCOL_RESPONSES.MEDIASERVER_CONFIG, (data) => {
3674
3673
  if (data.error) {
3675
3674
  logger$4.warn("FETCH_MEDIASERVER_CONFIG failed:", data.error);
@@ -3867,7 +3866,7 @@ class P2pRtcManager {
3867
3866
  _transformOutgoingSdp(original) {
3868
3867
  return { type: original.type, sdpU: original.sdp };
3869
3868
  }
3870
- _createSession({ clientId, initialBandwidth, isOfferer, peerConnectionId, shouldAddLocalVideo, }) {
3869
+ _createSession({ clientId, initialBandwidth, isOfferer, peerConnectionId, shouldAddLocalVideo, enforceTurnProtocol, }) {
3871
3870
  if (!peerConnectionId) {
3872
3871
  throw new Error("peerConnectionId is missing");
3873
3872
  }
@@ -3903,13 +3902,13 @@ class P2pRtcManager {
3903
3902
  return entry;
3904
3903
  });
3905
3904
  }
3906
- if (this._features.useOnlyTURN) {
3905
+ if (enforceTurnProtocol || this._features.useOnlyTURN) {
3907
3906
  peerConnectionConfig.iceTransportPolicy = "relay";
3908
3907
  const filter = {
3909
3908
  onlyudp: /^turn:.*transport=udp$/,
3910
3909
  onlytcp: /^turn:.*transport=tcp$/,
3911
3910
  onlytls: /^turns:.*transport=tcp$/,
3912
- }[this._features.useOnlyTURN];
3911
+ }[enforceTurnProtocol || this._features.useOnlyTURN];
3913
3912
  if (filter) {
3914
3913
  peerConnectionConfig.iceServers = peerConnectionConfig.iceServers.filter((entry) => entry.url && entry.url.match(filter));
3915
3914
  }
@@ -4161,17 +4160,26 @@ class P2pRtcManager {
4161
4160
  }
4162
4161
  _connect(clientId) {
4163
4162
  this.rtcStatsReconnect();
4164
- const shouldAddLocalVideo = true;
4165
4163
  let session = this._getSession(clientId);
4166
- let bandwidth = (session && session.bandwidth) || 0;
4164
+ let initialBandwidth = (session && session.bandwidth) || 0;
4167
4165
  if (session) {
4168
4166
  logger$4.warn("Replacing peer session", clientId);
4169
4167
  this._cleanup(clientId);
4170
4168
  }
4171
4169
  else {
4172
- bandwidth = this._changeBandwidthForAllClients(true);
4170
+ initialBandwidth = this._changeBandwidthForAllClients(true);
4173
4171
  }
4174
- session = this._createP2pSession(clientId, bandwidth, shouldAddLocalVideo, true);
4172
+ let enforceTurnProtocol;
4173
+ if (this._nodeJsClients.includes(clientId)) {
4174
+ enforceTurnProtocol = this._features.isNodeSdk ? "onlyudp" : "onlytls";
4175
+ }
4176
+ session = this._createP2pSession({
4177
+ clientId,
4178
+ initialBandwidth,
4179
+ shouldAddLocalVideo: true,
4180
+ isOfferer: true,
4181
+ enforceTurnProtocol,
4182
+ });
4175
4183
  this._negotiatePeerConnection(clientId, session);
4176
4184
  return Promise.resolve(session);
4177
4185
  }
@@ -4342,13 +4350,14 @@ class P2pRtcManager {
4342
4350
  });
4343
4351
  return bandwidth;
4344
4352
  }
4345
- _createP2pSession(clientId, initialBandwidth, shouldAddLocalVideo, isOfferer) {
4353
+ _createP2pSession({ clientId, initialBandwidth, shouldAddLocalVideo = false, isOfferer = false, enforceTurnProtocol, }) {
4346
4354
  const session = this._createSession({
4347
4355
  peerConnectionId: clientId,
4348
4356
  clientId,
4349
4357
  initialBandwidth,
4350
4358
  shouldAddLocalVideo,
4351
4359
  isOfferer,
4360
+ enforceTurnProtocol,
4352
4361
  });
4353
4362
  const pc = session.pc;
4354
4363
  if (this._features.increaseIncomingMediaBufferOn) {
@@ -4462,20 +4471,26 @@ class P2pRtcManager {
4462
4471
  };
4463
4472
  return session;
4464
4473
  }
4465
- acceptNewStream({ streamId, clientId, shouldAddLocalVideo, }) {
4474
+ acceptNewStream({ streamId, clientId, shouldAddLocalVideo, enforceTurnProtocol, }) {
4466
4475
  let session = this._getSession(clientId);
4467
4476
  if (session && streamId !== clientId) {
4468
4477
  return session;
4469
4478
  }
4470
- let bandwidth = (session && session.bandwidth) || 0;
4479
+ let initialBandwidth = (session && session.bandwidth) || 0;
4471
4480
  if (session) {
4472
4481
  logger$4.warn("Replacing peer session", clientId);
4473
4482
  this._cleanup(clientId);
4474
4483
  }
4475
4484
  else {
4476
- bandwidth = this._changeBandwidthForAllClients(true);
4485
+ initialBandwidth = this._changeBandwidthForAllClients(true);
4477
4486
  }
4478
- session = this._createP2pSession(clientId, bandwidth, shouldAddLocalVideo);
4487
+ session = this._createP2pSession({
4488
+ clientId,
4489
+ initialBandwidth,
4490
+ shouldAddLocalVideo: !!shouldAddLocalVideo,
4491
+ enforceTurnProtocol,
4492
+ isOfferer: false,
4493
+ });
4479
4494
  this._emitServerEvent(RELAY_MESSAGES.READY_TO_RECEIVE_OFFER, {
4480
4495
  receiverId: clientId,
4481
4496
  });
@@ -5104,9 +5119,6 @@ class VegaRtcManager {
5104
5119
  }), this._serverSocket.on(PROTOCOL_RESPONSES.ROOM_JOINED, () => {
5105
5120
  if (this._screenVideoTrack)
5106
5121
  this._emitScreenshareStarted();
5107
- if (!this._vegaConnection.isConnected() && this._reconnect) {
5108
- this._connect();
5109
- }
5110
5122
  }));
5111
5123
  this._connect();
5112
5124
  }
@@ -5117,13 +5129,6 @@ class VegaRtcManager {
5117
5129
  });
5118
5130
  }
5119
5131
  _connect() {
5120
- if (!this._serverSocket.isConnected()) {
5121
- const reconnectThresholdInMs = this._serverSocket.getReconnectThreshold();
5122
- if (!reconnectThresholdInMs)
5123
- return;
5124
- if (Date.now() > (this._serverSocket.disconnectTimestamp || 0) + reconnectThresholdInMs)
5125
- return;
5126
- }
5127
5132
  const host = this._features.sfuServerOverrideHost || [this._sfuServer.url];
5128
5133
  const searchParams = new URLSearchParams(Object.assign({ clientId: this._selfId, organizationId: this._room.organizationId, roomName: this._room.name, eventClaim: this._room.isClaimed ? this._eventClaim : null, lowBw: "true" }, Object.keys(this._features || {})
5129
5134
  .filter((featureKey) => this._features[featureKey] && /^sfu/.test(featureKey))
@@ -5834,7 +5839,7 @@ class VegaRtcManager {
5834
5839
  if (!videoTrack.effectTrack) {
5835
5840
  this._monitorVideoTrack(videoTrack);
5836
5841
  }
5837
- const beforeEffectTrack = beforeEffectTracks.find((t) => t.kind === "video");
5842
+ const beforeEffectTrack = beforeEffectTracks.find(t => t.kind === "video");
5838
5843
  if (beforeEffectTrack) {
5839
5844
  this._monitorVideoTrack(beforeEffectTrack);
5840
5845
  }
@@ -5845,7 +5850,7 @@ class VegaRtcManager {
5845
5850
  if (!audioTrack.effectTrack) {
5846
5851
  this._monitorAudioTrack(audioTrack);
5847
5852
  }
5848
- const beforeEffectTrack = beforeEffectTracks.find((t) => t.kind === "audio");
5853
+ const beforeEffectTrack = beforeEffectTracks.find(t => t.kind === "audio");
5849
5854
  if (beforeEffectTrack) {
5850
5855
  this._monitorAudioTrack(beforeEffectTrack);
5851
5856
  }
@@ -5916,9 +5921,7 @@ class VegaRtcManager {
5916
5921
  }
5917
5922
  if (!enable) {
5918
5923
  clearTimeout(this._stopCameraTimeout);
5919
- const stopCameraDelay = ((_a = localStream.getVideoTracks().find((t) => !t.enabled)) === null || _a === void 0 ? void 0 : _a.readyState) === "ended"
5920
- ? 0
5921
- : 5000;
5924
+ const stopCameraDelay = ((_a = localStream.getVideoTracks().find((t) => !t.enabled)) === null || _a === void 0 ? void 0 : _a.readyState) === "ended" ? 0 : 5000;
5922
5925
  this._stopCameraTimeout = setTimeout(() => {
5923
5926
  localStream.getVideoTracks().forEach((track) => {
5924
5927
  if (track.enabled === false) {
@@ -6470,7 +6473,6 @@ const logger = new Logger();
6470
6473
  class ReconnectManager extends EventEmitter {
6471
6474
  constructor(socket) {
6472
6475
  super();
6473
- this.reconnectThresholdInMs = 0;
6474
6476
  this._socket = socket;
6475
6477
  this._clients = {};
6476
6478
  this._signalDisconnectTime = undefined;
@@ -6496,7 +6498,6 @@ class ReconnectManager extends EventEmitter {
6496
6498
  _onRoomJoined(payload) {
6497
6499
  var _a, _b;
6498
6500
  return __awaiter(this, void 0, void 0, function* () {
6499
- this.reconnectThresholdInMs = (payload.disconnectTimeout || 0) * 0.8 || 0;
6500
6501
  if (!((_a = payload.room) === null || _a === void 0 ? void 0 : _a.clients)) {
6501
6502
  this.emit(PROTOCOL_RESPONSES.ROOM_JOINED, payload);
6502
6503
  return;
@@ -6750,7 +6751,6 @@ class ServerSocket {
6750
6751
  }
6751
6752
  });
6752
6753
  this._socket.on("disconnect", () => {
6753
- this.disconnectTimestamp = Date.now();
6754
6754
  if (this.noopKeepaliveInterval) {
6755
6755
  clearInterval(this.noopKeepaliveInterval);
6756
6756
  this.noopKeepaliveInterval = null;
@@ -6834,10 +6834,6 @@ class ServerSocket {
6834
6834
  var _a;
6835
6835
  return (_a = this._reconnectManager) === null || _a === void 0 ? void 0 : _a.metrics;
6836
6836
  }
6837
- getReconnectThreshold() {
6838
- var _a;
6839
- return (_a = this._reconnectManager) === null || _a === void 0 ? void 0 : _a.reconnectThresholdInMs;
6840
- }
6841
6837
  }
6842
6838
 
6843
6839
  const defaultSubdomainPattern = /^(?:([^.]+)[.])?((:?[^.]+[.]){1,}[^.]+)$/;
package/dist/index.d.cts CHANGED
@@ -309,140 +309,6 @@ declare function getUpdatedDevices({ oldDevices, newDevices, currentAudioId, cur
309
309
  currentSpeakerId?: string | undefined;
310
310
  }): GetUpdatedDevicesResult;
311
311
 
312
- declare class P2pRtcManager implements RtcManager {
313
- _selfId: any;
314
- _roomName: any;
315
- _roomSessionId: any;
316
- peerConnections: any;
317
- localStreams: any;
318
- enabledLocalStreamIds: any[];
319
- _screenshareVideoTrackIds: any[];
320
- _socketListenerDeregisterFunctions: any[];
321
- _localStreamDeregisterFunction: any;
322
- _emitter: any;
323
- _serverSocket: any;
324
- _webrtcProvider: any;
325
- _features: any;
326
- _isAudioOnlyMode: boolean;
327
- offerOptions: {
328
- offerToReceiveAudio: boolean;
329
- offerToReceiveVideo: boolean;
330
- };
331
- _pendingActionsForConnectedPeerConnections: any[];
332
- _audioTrackOnEnded: () => void;
333
- _videoTrackOnEnded: () => void;
334
- totalSessionsCreated: number;
335
- _iceServers: any;
336
- _sfuServer: any;
337
- _mediaserverConfigTtlSeconds: any;
338
- _fetchMediaServersTimer: any;
339
- _wasScreenSharing: any;
340
- ipv6HostCandidateTeredoSeen: any;
341
- ipv6HostCandidate6to4Seen: any;
342
- mdnsHostCandidateSeen: any;
343
- _lastReverseDirectionAttemptByClientId: any;
344
- _stoppedVideoTrack: any;
345
- icePublicIPGatheringTimeoutID: any;
346
- _videoTrackBeingMonitored?: CustomMediaStreamTrack;
347
- _audioTrackBeingMonitored?: CustomMediaStreamTrack;
348
- constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, }: {
349
- selfId: any;
350
- room: any;
351
- emitter: any;
352
- serverSocket: any;
353
- webrtcProvider: any;
354
- features: any;
355
- });
356
- numberOfPeerconnections(): number;
357
- isInitializedWith({ selfId, roomName, isSfu }: {
358
- selfId: any;
359
- roomName: any;
360
- isSfu: any;
361
- }): boolean;
362
- supportsScreenShareAudio(): boolean;
363
- maybeRestrictRelayBandwidth(session: any): void;
364
- addNewStream(streamId: string, stream: MediaStream, audioPaused: boolean, videoPaused: boolean, beforeEffectTracks?: CustomMediaStreamTrack[]): void;
365
- replaceTrack(oldTrack: CustomMediaStreamTrack | null, newTrack: CustomMediaStreamTrack): Promise<any[]>;
366
- accept({ clientId, shouldAddLocalVideo }: {
367
- clientId: string;
368
- shouldAddLocalVideo?: boolean;
369
- }): any;
370
- disconnectAll(): void;
371
- fixChromeAudio(constraints: any): Promise<any[]> | undefined;
372
- setupSocketListeners(): void;
373
- sendAudioMutedStats(muted: boolean): void;
374
- sendVideoMutedStats(muted: boolean): void;
375
- sendStatsCustomEvent(eventName: string, data: any): void;
376
- rtcStatsDisconnect(): void;
377
- rtcStatsReconnect(): void;
378
- setAudioOnly(audioOnly: any): void;
379
- setRemoteScreenshareVideoTrackIds(remoteScreenshareVideoTrackIds?: never[]): void;
380
- setRoomSessionId(roomSessionId: string): void;
381
- _setConnectionStatus(session: any, newStatus: any, clientId: string): void;
382
- _setJitterBufferTarget(pc: any): void;
383
- _emitServerEvent(eventName: string, data?: any, callback?: any): void;
384
- _emit(eventName: string, data?: any): void;
385
- _addEnabledLocalStreamId(streamId: string): void;
386
- _deleteEnabledLocalStreamId(streamId: string): void;
387
- _getSession(peerConnectionId: string): any;
388
- _getOrCreateSession(peerConnectionId: string, initialBandwidth: any): any;
389
- _getLocalCameraStream(): any;
390
- _getNonLocalCameraStreamIds(): string[];
391
- _isScreensharingLocally(): boolean;
392
- _getFirstLocalNonCameraStream(): any;
393
- _transformIncomingSdp(original: any, _: any): {
394
- type: any;
395
- sdp: any;
396
- };
397
- _transformOutgoingSdp(original: any): {
398
- type: any;
399
- sdpU: any;
400
- };
401
- _createSession({ clientId, initialBandwidth, isOfferer, peerConnectionId, shouldAddLocalVideo, }: {
402
- clientId: string;
403
- initialBandwidth: any;
404
- isOfferer: any;
405
- peerConnectionId: string;
406
- shouldAddLocalVideo: boolean;
407
- }): any;
408
- _cleanup(peerConnectionId: string): void;
409
- _forEachPeerConnection(func: any): void;
410
- _addStreamToPeerConnections(stream: any): void;
411
- _addTrackToPeerConnections(track: any, stream?: any): void;
412
- _replaceTrackToPeerConnections(oldTrack: any, newTrack: any): Promise<any[]>;
413
- _removeStreamFromPeerConnections(stream: any): void;
414
- _removeTrackFromPeerConnections(track: any): void;
415
- _addLocalStream(streamId: string, stream: any): void;
416
- _removeLocalStream(streamId: string): void;
417
- _updateAndScheduleMediaServersRefresh({ iceServers, sfuServer, mediaserverConfigTtlSeconds }: any): void;
418
- _clearMediaServersRefresh(): void;
419
- _monitorAudioTrack(track: any): void;
420
- _monitorVideoTrack(track: CustomMediaStreamTrack): void;
421
- _connect(clientId: string): Promise<any>;
422
- _maybeRestartIce(clientId: string, session: any): void;
423
- _setCodecPreferences(pc: any, vp9On: any, av1On: any, redOn: any): void;
424
- _negotiatePeerConnection(clientId: string, session: any, constraints?: any): void;
425
- _withForcedRenegotiation(session: any, action: any): void;
426
- _changeBandwidthForAllClients(isJoining: boolean): number;
427
- _createP2pSession(clientId: string, initialBandwidth: any, shouldAddLocalVideo: any, isOfferer?: any): any;
428
- acceptNewStream({ streamId, clientId, shouldAddLocalVideo, }: {
429
- streamId: string;
430
- clientId: string;
431
- shouldAddLocalVideo?: boolean;
432
- }): any;
433
- disconnect(clientId: string): void;
434
- updateStreamResolution(): void;
435
- stopOrResumeAudio(): void;
436
- _handleStopOrResumeVideo({ enable, track }: {
437
- enable: boolean;
438
- track: any;
439
- }): void;
440
- stopOrResumeVideo(localStream: any, enable: boolean): void;
441
- _shareScreen(streamId: string, stream: any): void;
442
- removeStream(streamId: string, stream: any, requestedByClientId: any): void;
443
- hasClient(clientId: string): boolean;
444
- }
445
-
446
312
  declare const assert: {
447
313
  fail: (message?: string | Error) => void;
448
314
  ok: (value: any, message?: string | Error) => void;
@@ -488,7 +354,6 @@ declare class ReconnectManager extends EventEmitter {
488
354
  evaluationFailed: number;
489
355
  roomJoined: number;
490
356
  };
491
- reconnectThresholdInMs: number;
492
357
  constructor(socket: any);
493
358
  _onRoomJoined(payload: any): Promise<void>;
494
359
  _onClientLeft(payload: any): void;
@@ -517,7 +382,6 @@ declare class ServerSocket {
517
382
  _reconnectManager?: ReconnectManager | null;
518
383
  noopKeepaliveInterval: any;
519
384
  _wasConnectedUsingWebsocket?: boolean;
520
- disconnectTimestamp: number | undefined;
521
385
  constructor(hostName: string, optionsOverrides?: any, glitchFree?: boolean);
522
386
  setRtcManager(rtcManager?: RtcManager): void;
523
387
  connect(): void;
@@ -527,8 +391,8 @@ declare class ServerSocket {
527
391
  emitIfConnected(eventName: string, data: any): void;
528
392
  getTransport(): any;
529
393
  getManager(): any;
530
- isConnecting(): boolean;
531
- isConnected(): boolean;
394
+ isConnecting(): any;
395
+ isConnected(): any;
532
396
  on(eventName: string, handler: Function): () => void;
533
397
  once(eventName: string, handler: Function): void;
534
398
  off(eventName: string, handler: Function): void;
@@ -539,7 +403,6 @@ declare class ServerSocket {
539
403
  evaluationFailed: number;
540
404
  roomJoined: number;
541
405
  } | undefined;
542
- getReconnectThreshold(): number | undefined;
543
406
  }
544
407
 
545
408
  declare const maybeTurnOnly: (transportConfig: any, features: {
@@ -826,6 +689,7 @@ interface SignalRequests {
826
689
  };
827
690
  stop_recording: void;
828
691
  }
692
+ type TurnTransportProtocol = "onlyudp" | "onlytcp" | "onlytls";
829
693
 
830
694
  declare function fromLocation({ host, protocol }?: {
831
695
  host?: string | undefined;
@@ -839,6 +703,145 @@ declare function fromLocation({ host, protocol }?: {
839
703
  subdomain: string;
840
704
  };
841
705
 
706
+ declare class P2pRtcManager implements RtcManager {
707
+ _selfId: any;
708
+ _roomName: any;
709
+ _roomSessionId: any;
710
+ peerConnections: any;
711
+ localStreams: any;
712
+ enabledLocalStreamIds: any[];
713
+ _screenshareVideoTrackIds: any[];
714
+ _socketListenerDeregisterFunctions: any[];
715
+ _localStreamDeregisterFunction: any;
716
+ _emitter: any;
717
+ _serverSocket: any;
718
+ _webrtcProvider: any;
719
+ _features: any;
720
+ _isAudioOnlyMode: boolean;
721
+ offerOptions: {
722
+ offerToReceiveAudio: boolean;
723
+ offerToReceiveVideo: boolean;
724
+ };
725
+ _pendingActionsForConnectedPeerConnections: any[];
726
+ _audioTrackOnEnded: () => void;
727
+ _videoTrackOnEnded: () => void;
728
+ totalSessionsCreated: number;
729
+ _iceServers: any;
730
+ _sfuServer: any;
731
+ _mediaserverConfigTtlSeconds: any;
732
+ _fetchMediaServersTimer: any;
733
+ _wasScreenSharing: any;
734
+ ipv6HostCandidateTeredoSeen: any;
735
+ ipv6HostCandidate6to4Seen: any;
736
+ mdnsHostCandidateSeen: any;
737
+ _lastReverseDirectionAttemptByClientId: any;
738
+ _stoppedVideoTrack: any;
739
+ icePublicIPGatheringTimeoutID: any;
740
+ _videoTrackBeingMonitored?: CustomMediaStreamTrack;
741
+ _audioTrackBeingMonitored?: CustomMediaStreamTrack;
742
+ _nodeJsClients: string[];
743
+ constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, }: {
744
+ selfId: any;
745
+ room: any;
746
+ emitter: any;
747
+ serverSocket: any;
748
+ webrtcProvider: any;
749
+ features: any;
750
+ });
751
+ numberOfPeerconnections(): number;
752
+ isInitializedWith({ selfId, roomName, isSfu }: {
753
+ selfId: any;
754
+ roomName: any;
755
+ isSfu: any;
756
+ }): boolean;
757
+ supportsScreenShareAudio(): boolean;
758
+ maybeRestrictRelayBandwidth(session: any): void;
759
+ addNewStream(streamId: string, stream: MediaStream, audioPaused: boolean, videoPaused: boolean, beforeEffectTracks?: CustomMediaStreamTrack[]): void;
760
+ replaceTrack(oldTrack: CustomMediaStreamTrack | null, newTrack: CustomMediaStreamTrack): Promise<any[]>;
761
+ disconnectAll(): void;
762
+ fixChromeAudio(constraints: any): Promise<any[]> | undefined;
763
+ setupSocketListeners(): void;
764
+ sendAudioMutedStats(muted: boolean): void;
765
+ sendVideoMutedStats(muted: boolean): void;
766
+ sendStatsCustomEvent(eventName: string, data: any): void;
767
+ rtcStatsDisconnect(): void;
768
+ rtcStatsReconnect(): void;
769
+ setAudioOnly(audioOnly: any): void;
770
+ setRemoteScreenshareVideoTrackIds(remoteScreenshareVideoTrackIds?: never[]): void;
771
+ setRoomSessionId(roomSessionId: string): void;
772
+ _setConnectionStatus(session: any, newStatus: any, clientId: string): void;
773
+ _setJitterBufferTarget(pc: any): void;
774
+ _emitServerEvent(eventName: string, data?: any, callback?: any): void;
775
+ _emit(eventName: string, data?: any): void;
776
+ _addEnabledLocalStreamId(streamId: string): void;
777
+ _deleteEnabledLocalStreamId(streamId: string): void;
778
+ _getSession(peerConnectionId: string): any;
779
+ _getOrCreateSession(peerConnectionId: string, initialBandwidth: any): any;
780
+ _getLocalCameraStream(): any;
781
+ _getNonLocalCameraStreamIds(): string[];
782
+ _isScreensharingLocally(): boolean;
783
+ _getFirstLocalNonCameraStream(): any;
784
+ _transformIncomingSdp(original: any, _: any): {
785
+ type: any;
786
+ sdp: any;
787
+ };
788
+ _transformOutgoingSdp(original: any): {
789
+ type: any;
790
+ sdpU: any;
791
+ };
792
+ _createSession({ clientId, initialBandwidth, isOfferer, peerConnectionId, shouldAddLocalVideo, enforceTurnProtocol, }: {
793
+ clientId: string;
794
+ initialBandwidth: any;
795
+ isOfferer: any;
796
+ peerConnectionId: string;
797
+ shouldAddLocalVideo: boolean;
798
+ enforceTurnProtocol?: TurnTransportProtocol;
799
+ }): any;
800
+ _cleanup(peerConnectionId: string): void;
801
+ _forEachPeerConnection(func: any): void;
802
+ _addStreamToPeerConnections(stream: any): void;
803
+ _addTrackToPeerConnections(track: any, stream?: any): void;
804
+ _replaceTrackToPeerConnections(oldTrack: any, newTrack: any): Promise<any[]>;
805
+ _removeStreamFromPeerConnections(stream: any): void;
806
+ _removeTrackFromPeerConnections(track: any): void;
807
+ _addLocalStream(streamId: string, stream: any): void;
808
+ _removeLocalStream(streamId: string): void;
809
+ _updateAndScheduleMediaServersRefresh({ iceServers, sfuServer, mediaserverConfigTtlSeconds }: any): void;
810
+ _clearMediaServersRefresh(): void;
811
+ _monitorAudioTrack(track: any): void;
812
+ _monitorVideoTrack(track: CustomMediaStreamTrack): void;
813
+ _connect(clientId: string): Promise<any>;
814
+ _maybeRestartIce(clientId: string, session: any): void;
815
+ _setCodecPreferences(pc: any, vp9On: any, av1On: any, redOn: any): void;
816
+ _negotiatePeerConnection(clientId: string, session: any, constraints?: any): void;
817
+ _withForcedRenegotiation(session: any, action: any): void;
818
+ _changeBandwidthForAllClients(isJoining: boolean): number;
819
+ _createP2pSession({ clientId, initialBandwidth, shouldAddLocalVideo, isOfferer, enforceTurnProtocol, }: {
820
+ clientId: string;
821
+ initialBandwidth: number;
822
+ shouldAddLocalVideo: boolean;
823
+ isOfferer: boolean;
824
+ enforceTurnProtocol?: TurnTransportProtocol;
825
+ }): any;
826
+ acceptNewStream({ streamId, clientId, shouldAddLocalVideo, enforceTurnProtocol, }: {
827
+ streamId: string;
828
+ clientId: string;
829
+ shouldAddLocalVideo?: boolean;
830
+ enforceTurnProtocol?: TurnTransportProtocol;
831
+ }): any;
832
+ disconnect(clientId: string): void;
833
+ updateStreamResolution(): void;
834
+ stopOrResumeAudio(): void;
835
+ _handleStopOrResumeVideo({ enable, track }: {
836
+ enable: boolean;
837
+ track: any;
838
+ }): void;
839
+ stopOrResumeVideo(localStream: any, enable: boolean): void;
840
+ _shareScreen(streamId: string, stream: any): void;
841
+ removeStream(streamId: string, stream: any, requestedByClientId: any): void;
842
+ hasClient(clientId: string): boolean;
843
+ }
844
+
842
845
  declare class RtcManagerDispatcher {
843
846
  emitter: {
844
847
  emit: <K extends keyof RtcEvents>(eventName: K, args?: RtcEvents[K]) => void;
@@ -1003,7 +1006,6 @@ declare class VegaConnection extends EventEmitter$1 {
1003
1006
  _setupSocket(): void;
1004
1007
  _tearDown(): void;
1005
1008
  close(): void;
1006
- isConnected(): boolean;
1007
1009
  _onOpen(): void;
1008
1010
  _onMessage(event: MessageEvent): void;
1009
1011
  _onClose(): void;
@@ -1079,7 +1081,7 @@ declare class VegaRtcManager implements RtcManager {
1079
1081
  _room: any;
1080
1082
  _roomSessionId: any;
1081
1083
  _emitter: any;
1082
- _serverSocket: ServerSocket;
1084
+ _serverSocket: any;
1083
1085
  _webrtcProvider: any;
1084
1086
  _features: any;
1085
1087
  _eventClaim?: any;
@@ -1414,4 +1416,4 @@ declare class RtcStream {
1414
1416
  static getTypeFromId(id: string): string;
1415
1417
  }
1416
1418
 
1417
- export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, type LiveTranscriptionStartedEvent, type LiveTranscriptionStoppedEvent, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, type NewClientEvent, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomJoinedEvent, type RoomKnockedEvent, type RoomLockedEvent, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, STREAM_TYPES, type ScreenshareStartedEvent, type ScreenshareStoppedEvent, type SendClientMetadataRequest, ServerSocket, Session, SfuV2Parser, type SignalClient, type SignalEvents, type SignalKnocker, type SignalRequests, type SocketConf, type SocketManager, type Spotlight, type SpotlightAddedEvent, type SpotlightRemovedEvent, type StatsMonitorOptions, type StatsMonitorState, TYPES, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnabledEvent, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getStream2, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
1419
+ export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, type LiveTranscriptionStartedEvent, type LiveTranscriptionStoppedEvent, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, type NewClientEvent, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomJoinedEvent, type RoomKnockedEvent, type RoomLockedEvent, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, STREAM_TYPES, type ScreenshareStartedEvent, type ScreenshareStoppedEvent, type SendClientMetadataRequest, ServerSocket, Session, SfuV2Parser, type SignalClient, type SignalEvents, type SignalKnocker, type SignalRequests, type SocketConf, type SocketManager, type Spotlight, type SpotlightAddedEvent, type SpotlightRemovedEvent, type StatsMonitorOptions, type StatsMonitorState, TYPES, type TurnTransportProtocol, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnabledEvent, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getStream2, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };