@whereby.com/media 2.8.1 → 2.8.3

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
@@ -1427,7 +1427,7 @@ class ReconnectManager extends EventEmitter {
1427
1427
  clearTimeout(client.timeout);
1428
1428
  delete this._clients[clientId];
1429
1429
  }
1430
- (_a = this.rtcManager) === null || _a === void 0 ? void 0 : _a.disconnect(clientId, null, payload.eventClaim);
1430
+ (_a = this.rtcManager) === null || _a === void 0 ? void 0 : _a.disconnect(clientId, payload.eventClaim);
1431
1431
  this.emit(PROTOCOL_RESPONSES.CLIENT_LEFT, payload);
1432
1432
  }
1433
1433
  _onPendingClientLeft(payload) {
@@ -2234,7 +2234,7 @@ var _a$4;
2234
2234
  const adapter$4 = (_a$4 = adapterRaw.default) !== null && _a$4 !== void 0 ? _a$4 : adapterRaw;
2235
2235
  const logger$7 = new Logger();
2236
2236
  class Session {
2237
- constructor({ peerConnectionId, clientId, bandwidth, peerConnectionConfig, deprioritizeH264Encoding, shouldAddLocalVideo, incrementAnalyticMetric, }) {
2237
+ constructor({ peerConnectionId, clientId, bandwidth, peerConnectionConfig, deprioritizeH264Encoding, incrementAnalyticMetric, }) {
2238
2238
  this.peerConnectionId = peerConnectionId;
2239
2239
  this.relayCandidateSeen = false;
2240
2240
  this.serverReflexiveCandidateSeen = false;
@@ -2244,7 +2244,6 @@ class Session {
2244
2244
  this.ipv6HostCandidate6to4Seen = false;
2245
2245
  this.mdnsHostCandidateSeen = false;
2246
2246
  this.peerConnectionConfig = peerConnectionConfig;
2247
- this.shouldAddLocalVideo = shouldAddLocalVideo;
2248
2247
  this.clientId = clientId;
2249
2248
  this.pc = new RTCPeerConnection(this.peerConnectionConfig);
2250
2249
  this.signalingState = this.pc.signalingState;
@@ -2312,11 +2311,13 @@ class Session {
2312
2311
  }
2313
2312
  }
2314
2313
  removeStream(stream) {
2315
- for (let i = 0; i < this.streamIds.length; i++) {
2316
- if (this.streamIds[i] === stream.id) {
2317
- this.streamIds.splice(i, 1);
2318
- this.streams.splice(i, 1);
2319
- }
2314
+ const streamIdIndex = this.streamIds.indexOf(stream.id);
2315
+ if (streamIdIndex !== -1) {
2316
+ this.streamIds.splice(streamIdIndex, 1);
2317
+ }
2318
+ const streamIndex = this.streams.indexOf(stream);
2319
+ if (streamIndex !== -1) {
2320
+ this.streams.splice(streamIndex, 1);
2320
2321
  }
2321
2322
  if (this.pc) {
2322
2323
  if (this.pc.removeTrack) {
@@ -2582,57 +2583,6 @@ const TYPES = {
2582
2583
  CONNECTION_DISCONNECTED: "connection_disconnected",
2583
2584
  };
2584
2585
 
2585
- const CAMERA_STREAM_ID$1 = "0";
2586
- const STREAM_TYPES = {
2587
- CAMERA: "camera",
2588
- SCREEN_SHARE: "screen_share",
2589
- };
2590
- class RtcStream {
2591
- constructor(id, type) {
2592
- this.id = "" + id;
2593
- this.type = type;
2594
- this.isEnabled = true;
2595
- this.hasSupportForAutoSuperSize = false;
2596
- this.isAudioEnabled = true;
2597
- this.isVideoEnabled = true;
2598
- this.status = TYPES.CONNECTING;
2599
- this.stream = null;
2600
- this.streamId = null;
2601
- }
2602
- setup(stream) {
2603
- this.stream = stream;
2604
- this.streamId = stream.id;
2605
- this.setVideoEnabled(this.isVideoEnabled && stream.getVideoTracks().length > 0);
2606
- this.setAudioEnabled(this.isAudioEnabled && stream.getAudioTracks().length > 0);
2607
- return this;
2608
- }
2609
- setStatus(status) {
2610
- this.status = status;
2611
- return this;
2612
- }
2613
- setVideoEnabled(isEnabled) {
2614
- this.isVideoEnabled = isEnabled;
2615
- if (!this.stream) {
2616
- return;
2617
- }
2618
- this.stream.getVideoTracks().forEach((track) => {
2619
- track.enabled = isEnabled;
2620
- });
2621
- }
2622
- setAudioEnabled(isEnabled) {
2623
- this.isAudioEnabled = isEnabled;
2624
- if (!this.stream) {
2625
- return;
2626
- }
2627
- this.stream.getAudioTracks().forEach((track) => {
2628
- track.enabled = isEnabled;
2629
- });
2630
- }
2631
- static getCameraId() {
2632
- return CAMERA_STREAM_ID$1;
2633
- }
2634
- }
2635
-
2636
2586
  var rtcManagerEvents = {
2637
2587
  CAMERA_NOT_WORKING: "camera_not_working",
2638
2588
  CONNECTION_BLOCKED_BY_NETWORK: "connection_blocked_by_network",
@@ -2647,11 +2597,16 @@ var rtcManagerEvents = {
2647
2597
  DOMINANT_SPEAKER: "dominant_speaker",
2648
2598
  };
2649
2599
 
2600
+ const CAMERA_STREAM_ID = "0";
2601
+ const STREAM_TYPES = {
2602
+ webcam: "webcam",
2603
+ screenshare: "screenshare",
2604
+ };
2605
+
2650
2606
  var _a$2, _b$1, _c;
2651
2607
  const adapter$2 = (_a$2 = adapterRaw.default) !== null && _a$2 !== void 0 ? _a$2 : adapterRaw;
2652
2608
  const logger$6 = new Logger();
2653
2609
  const ICE_PUBLIC_IP_GATHERING_TIMEOUT = 3 * 1000;
2654
- const CAMERA_STREAM_ID = RtcStream.getCameraId();
2655
2610
  const browserName$1 = (_b$1 = adapter$2.browserDetails) === null || _b$1 === void 0 ? void 0 : _b$1.browser;
2656
2611
  const browserVersion = adapter$2.browserDetails.version;
2657
2612
  if (browserName$1 === "firefox" && adapter$2.browserShim && "shimGetDisplayMedia" in adapter$2.browserShim) {
@@ -2729,6 +2684,7 @@ class P2pRtcManager {
2729
2684
  P2PReplaceTrackWithoutPC: 0,
2730
2685
  P2PReplaceTrackSourceKindNotFound: 0,
2731
2686
  P2PRemoveStreamNoPC: 0,
2687
+ P2POnTrackNoStream: 0,
2732
2688
  };
2733
2689
  }
2734
2690
  numberOfPeerconnections() {
@@ -2875,13 +2831,10 @@ class P2pRtcManager {
2875
2831
  });
2876
2832
  }),
2877
2833
  this._serverSocket.on(PROTOCOL_RESPONSES.ROOM_JOINED, (payload) => {
2878
- var _a, _b;
2879
- if (payload === null || payload === void 0 ? void 0 : payload.error) {
2834
+ const { error } = payload;
2835
+ if (error || !this._wasScreenSharing) {
2880
2836
  return;
2881
2837
  }
2882
- const isSfu = (_b = (_a = payload === null || payload === void 0 ? void 0 : payload.room) === null || _a === void 0 ? void 0 : _a.sfuServer) !== null && _b !== void 0 ? _b : false;
2883
- if (isSfu || !this._wasScreenSharing)
2884
- return;
2885
2838
  const screenShareStreamId = Object.keys(this.localStreams).find((id) => id !== CAMERA_STREAM_ID);
2886
2839
  if (!screenShareStreamId) {
2887
2840
  return;
@@ -2897,6 +2850,15 @@ class P2pRtcManager {
2897
2850
  hasAudioTrack,
2898
2851
  });
2899
2852
  }),
2853
+ this._serverSocket.on(PROTOCOL_RESPONSES.SCREENSHARE_STOPPED, (payload) => {
2854
+ const session = this._getSession(payload.clientId);
2855
+ if (session) {
2856
+ const streamIdIndex = session.streamIds.indexOf(payload.streamId);
2857
+ if (streamIdIndex !== -1) {
2858
+ session.streamIds.splice(streamIdIndex, 1);
2859
+ }
2860
+ }
2861
+ }),
2900
2862
  ];
2901
2863
  }
2902
2864
  sendAudioMutedStats(muted) {
@@ -3008,7 +2970,7 @@ class P2pRtcManager {
3008
2970
  }
3009
2971
  return this.peerConnections[peerConnectionId];
3010
2972
  }
3011
- _getOrCreateSession({ peerConnectionId, clientId, initialBandwidth, peerConnectionConfig, shouldAddLocalVideo, }) {
2973
+ _getOrCreateSession({ peerConnectionId, clientId, initialBandwidth, peerConnectionConfig, }) {
3012
2974
  let session = this.peerConnections[peerConnectionId];
3013
2975
  if (session === undefined) {
3014
2976
  const deprioritizeH264Encoding = browserName$1 === "safari" &&
@@ -3021,7 +2983,6 @@ class P2pRtcManager {
3021
2983
  peerConnectionConfig,
3022
2984
  bandwidth: initialBandwidth,
3023
2985
  deprioritizeH264Encoding,
3024
- shouldAddLocalVideo,
3025
2986
  incrementAnalyticMetric: (metric) => this.analytics[metric]++,
3026
2987
  });
3027
2988
  }
@@ -3054,7 +3015,7 @@ class P2pRtcManager {
3054
3015
  _transformOutgoingSdp(original) {
3055
3016
  return { type: original.type, sdpU: original.sdp, sdp: original.sdp };
3056
3017
  }
3057
- _createSession({ clientId, initialBandwidth, isOfferer, peerConnectionId, shouldAddLocalVideo, }) {
3018
+ _createSession({ clientId, initialBandwidth, isOfferer, peerConnectionId, }) {
3058
3019
  if (!peerConnectionId) {
3059
3020
  throw new Error("peerConnectionId is missing");
3060
3021
  }
@@ -3083,14 +3044,18 @@ class P2pRtcManager {
3083
3044
  clientId,
3084
3045
  initialBandwidth,
3085
3046
  peerConnectionConfig,
3086
- shouldAddLocalVideo,
3087
3047
  });
3088
3048
  setTimeout(() => this._emit(rtcManagerEvents.NEW_PC), 0);
3089
3049
  this.analytics.numNewPc++;
3090
3050
  const { pc } = session;
3091
3051
  pc.ontrack = (event) => {
3092
3052
  const stream = event.streams[0];
3093
- if (stream.id === "default" && stream.getAudioTracks().length === 0) {
3053
+ if (!stream) {
3054
+ this.analytics.P2POnTrackNoStream++;
3055
+ rtcStats.sendEvent("P2POnTrackNoStream", {
3056
+ trackKind: event.track.kind,
3057
+ trackId: event.track.id,
3058
+ });
3094
3059
  return;
3095
3060
  }
3096
3061
  if (session.streamIds.indexOf(stream.id) === -1) {
@@ -3099,16 +3064,6 @@ class P2pRtcManager {
3099
3064
  clientId,
3100
3065
  stream,
3101
3066
  });
3102
- if (session.connectionStatus === TYPES.CONNECTION_SUCCESSFUL) {
3103
- setTimeout(() => {
3104
- this._emit(EVENTS.CLIENT_CONNECTION_STATUS_CHANGED, {
3105
- streamIds: session.streamIds,
3106
- clientId,
3107
- status: session.connectionStatus,
3108
- previous: TYPES.CONNECTING,
3109
- });
3110
- }, 0);
3111
- }
3112
3067
  }
3113
3068
  };
3114
3069
  pc.oniceconnectionstatechange = () => {
@@ -3186,30 +3141,28 @@ class P2pRtcManager {
3186
3141
  }
3187
3142
  };
3188
3143
  const localCameraStream = this.localStreams[CAMERA_STREAM_ID];
3189
- if (shouldAddLocalVideo && localCameraStream) {
3144
+ if (localCameraStream) {
3190
3145
  session.addStream(localCameraStream);
3191
3146
  }
3192
- if (shouldAddLocalVideo) {
3193
- Object.keys(this.localStreams).forEach((id) => {
3194
- if (id === CAMERA_STREAM_ID) {
3195
- return;
3196
- }
3197
- const screenshareStream = this.localStreams[id];
3198
- if (isOfferer) {
3199
- session.addStream(screenshareStream);
3200
- }
3201
- else {
3202
- session.afterConnected.then(() => {
3203
- this._emitServerEvent(PROTOCOL_REQUESTS.START_SCREENSHARE, {
3204
- receiverId: session.clientId,
3205
- streamId: screenshareStream.id,
3206
- hasAudioTrack: !!screenshareStream.getAudioTracks().length,
3207
- });
3208
- this._withForcedRenegotiation(session, () => session.addStream(screenshareStream));
3147
+ Object.keys(this.localStreams).forEach((id) => {
3148
+ if (id === CAMERA_STREAM_ID) {
3149
+ return;
3150
+ }
3151
+ const screenshareStream = this.localStreams[id];
3152
+ if (isOfferer) {
3153
+ session.addStream(screenshareStream);
3154
+ }
3155
+ else {
3156
+ session.afterConnected.then(() => {
3157
+ this._emitServerEvent(PROTOCOL_REQUESTS.START_SCREENSHARE, {
3158
+ receiverId: session.clientId,
3159
+ streamId: screenshareStream.id,
3160
+ hasAudioTrack: !!screenshareStream.getAudioTracks().length,
3209
3161
  });
3210
- }
3211
- });
3212
- }
3162
+ this._withForcedRenegotiation(session, () => session.addStream(screenshareStream));
3163
+ });
3164
+ }
3165
+ });
3213
3166
  return session;
3214
3167
  }
3215
3168
  _cleanup(peerConnectionId) {
@@ -3346,7 +3299,6 @@ class P2pRtcManager {
3346
3299
  session = this._createP2pSession({
3347
3300
  clientId,
3348
3301
  initialBandwidth,
3349
- shouldAddLocalVideo: true,
3350
3302
  isOfferer: true,
3351
3303
  });
3352
3304
  this._negotiatePeerConnection(clientId, session);
@@ -3490,12 +3442,11 @@ class P2pRtcManager {
3490
3442
  });
3491
3443
  return bandwidth;
3492
3444
  }
3493
- _createP2pSession({ clientId, initialBandwidth, shouldAddLocalVideo = false, isOfferer = false, }) {
3445
+ _createP2pSession({ clientId, initialBandwidth, isOfferer = false, }) {
3494
3446
  const session = this._createSession({
3495
3447
  peerConnectionId: clientId,
3496
3448
  clientId,
3497
3449
  initialBandwidth,
3498
- shouldAddLocalVideo,
3499
3450
  isOfferer,
3500
3451
  });
3501
3452
  const pc = session.pc;
@@ -3503,10 +3454,7 @@ class P2pRtcManager {
3503
3454
  this._setJitterBufferTarget(pc);
3504
3455
  }
3505
3456
  const localCameraStream = this.localStreams[CAMERA_STREAM_ID];
3506
- if (shouldAddLocalVideo &&
3507
- localCameraStream &&
3508
- !localCameraStream.getVideoTracks().length &&
3509
- this._stoppedVideoTrack) {
3457
+ if (localCameraStream && !localCameraStream.getVideoTracks().length && this._stoppedVideoTrack) {
3510
3458
  pc.addTrack(this._stoppedVideoTrack, localCameraStream);
3511
3459
  }
3512
3460
  pc.onicegatheringstatechange = (event) => {
@@ -3612,7 +3560,7 @@ class P2pRtcManager {
3612
3560
  };
3613
3561
  return session;
3614
3562
  }
3615
- acceptNewStream({ streamId, clientId, shouldAddLocalVideo, }) {
3563
+ acceptNewStream({ streamId, clientId }) {
3616
3564
  let session = this._getSession(clientId);
3617
3565
  if (session && streamId !== clientId) {
3618
3566
  return session;
@@ -3628,7 +3576,6 @@ class P2pRtcManager {
3628
3576
  session = this._createP2pSession({
3629
3577
  clientId,
3630
3578
  initialBandwidth,
3631
- shouldAddLocalVideo: !!shouldAddLocalVideo,
3632
3579
  isOfferer: false,
3633
3580
  });
3634
3581
  this._emitServerEvent(RELAY_MESSAGES.READY_TO_RECEIVE_OFFER, {
@@ -3735,6 +3682,9 @@ class P2pRtcManager {
3735
3682
  hasClient(clientId) {
3736
3683
  return Object.keys(this.peerConnections).includes(clientId);
3737
3684
  }
3685
+ shouldAcceptStreamsFromBothSides() {
3686
+ return false;
3687
+ }
3738
3688
  }
3739
3689
 
3740
3690
  class KalmanFilter {
@@ -5487,14 +5437,14 @@ class VegaRtcManager {
5487
5437
  setRoomSessionId(roomSessionId) {
5488
5438
  this._roomSessionId = roomSessionId;
5489
5439
  }
5490
- disconnect(clientIdOrStreamId, _activeBreakout, eventClaim) {
5440
+ disconnect(clientId, eventClaim) {
5491
5441
  var _a;
5492
- logger$2.info("disconnect() [clientIdOrStreamId:%s, eventClaim:%s]", clientIdOrStreamId, eventClaim);
5493
- const clientState = this._clientStates.get(clientIdOrStreamId);
5442
+ logger$2.info("disconnect() [clientId:%s, eventClaim:%s]", clientId, eventClaim);
5443
+ const clientState = this._clientStates.get(clientId);
5494
5444
  if (clientState) {
5495
5445
  clientState.hasAcceptedWebcamStream = false;
5496
5446
  clientState.hasAcceptedScreenStream = false;
5497
- this._syncIncomingStreamsWithPWA(clientIdOrStreamId);
5447
+ this._syncIncomingStreamsWithPWA(clientId);
5498
5448
  }
5499
5449
  if (eventClaim) {
5500
5450
  this._eventClaim = eventClaim;
@@ -5536,7 +5486,7 @@ class VegaRtcManager {
5536
5486
  this._sendMicScore(this._micPaused ? 0 : data.out);
5537
5487
  }
5538
5488
  addNewStream(streamId, stream, audioPaused, videoPaused, beforeEffectTracks = []) {
5539
- if (streamId === "0") {
5489
+ if (streamId === CAMERA_STREAM_ID) {
5540
5490
  this._micPaused = audioPaused;
5541
5491
  this._webcamPaused = videoPaused;
5542
5492
  const videoTrack = stream.getVideoTracks()[0];
@@ -6003,7 +5953,7 @@ class VegaRtcManager {
6003
5953
  clientId,
6004
5954
  stream: webcamStream,
6005
5955
  streamId: camStreamId,
6006
- streamType: "webcam",
5956
+ streamType: STREAM_TYPES.webcam,
6007
5957
  });
6008
5958
  clientState.hasEmittedWebcamStream = true;
6009
5959
  }
@@ -6012,7 +5962,7 @@ class VegaRtcManager {
6012
5962
  clientId,
6013
5963
  stream: screenStream,
6014
5964
  streamId: screenShareStreamId,
6015
- streamType: "screenshare",
5965
+ streamType: STREAM_TYPES.screenshare,
6016
5966
  });
6017
5967
  clientState.hasEmittedScreenStream = true;
6018
5968
  }
@@ -7584,6 +7534,7 @@ exports.RtcEventNames = void 0;
7584
7534
  exports.ADDITIONAL_SCREEN_SHARE_SETTINGS = ADDITIONAL_SCREEN_SHARE_SETTINGS;
7585
7535
  exports.AUDIO_SETTINGS = AUDIO_SETTINGS;
7586
7536
  exports.BandwidthTester = BandwidthTester;
7537
+ exports.CAMERA_STREAM_ID = CAMERA_STREAM_ID;
7587
7538
  exports.EVENTS = EVENTS;
7588
7539
  exports.KNOCK_MESSAGES = KNOCK_MESSAGES;
7589
7540
  exports.KalmanFilter = KalmanFilter;
@@ -7598,7 +7549,6 @@ exports.PROTOCOL_RESPONSES = PROTOCOL_RESPONSES;
7598
7549
  exports.RELAY_MESSAGES = RELAY_MESSAGES;
7599
7550
  exports.ReconnectManager = ReconnectManager;
7600
7551
  exports.RtcManagerDispatcher = RtcManagerDispatcher;
7601
- exports.RtcStream = RtcStream;
7602
7552
  exports.SCREEN_SHARE_SETTINGS = SCREEN_SHARE_SETTINGS;
7603
7553
  exports.SCREEN_SHARE_SIMULCAST_SETTINGS = SCREEN_SHARE_SIMULCAST_SETTINGS;
7604
7554
  exports.STREAM_TYPES = STREAM_TYPES;
package/dist/index.d.cts CHANGED
@@ -320,20 +320,18 @@ declare enum RtcEventNames {
320
320
  stream_added = "stream_added"
321
321
  }
322
322
  interface RtcManager {
323
- acceptNewStream: ({ activeBreakout, clientId, shouldAddLocalVideo, streamId, }: {
324
- activeBreakout: boolean;
323
+ acceptNewStream: ({ clientId, streamId, }: {
325
324
  clientId: string;
326
- shouldAddLocalVideo: boolean;
327
325
  streamId: string;
328
326
  }) => void;
329
327
  addNewStream(streamId: string, stream: MediaStream, isAudioEnabled: boolean, isVideoEnabled: boolean): void;
330
- disconnect(streamId: string, activeBreakout: boolean | null, eventClaim?: string): void;
328
+ disconnect(streamId: string, eventClaim?: string): void;
331
329
  disconnectAll(): void;
332
330
  rtcStatsDisconnect(): void;
333
331
  rtcStatsReconnect(): void;
334
332
  replaceTrack(oldTrack: CustomMediaStreamTrack, newTrack: CustomMediaStreamTrack): void;
335
333
  removeStream(streamId: string, _stream: MediaStream, requestedByClientId: string | null): void;
336
- shouldAcceptStreamsFromBothSides?: () => boolean;
334
+ shouldAcceptStreamsFromBothSides: () => boolean;
337
335
  updateStreamResolution(streamId: string, ignored: null, resolution: {
338
336
  width: number;
339
337
  height: number;
@@ -506,7 +504,6 @@ interface P2PSessionOptions {
506
504
  bandwidth: number;
507
505
  peerConnectionConfig: RTCConfiguration;
508
506
  deprioritizeH264Encoding: boolean;
509
- shouldAddLocalVideo: boolean;
510
507
  incrementAnalyticMetric: P2PIncrementAnalyticMetric;
511
508
  }
512
509
  declare class Session {
@@ -528,7 +525,7 @@ declare class Session {
528
525
  bandwidth: any;
529
526
  pending: any[];
530
527
  isOperationPending: boolean;
531
- streamIds: any[];
528
+ streamIds: string[];
532
529
  streams: MediaStream[];
533
530
  earlyIceCandidates: any[];
534
531
  afterConnected: Promise<unknown>;
@@ -540,11 +537,10 @@ declare class Session {
540
537
  _deprioritizeH264Encoding: any;
541
538
  clientId: any;
542
539
  peerConnectionConfig: RTCConfiguration;
543
- shouldAddLocalVideo: boolean;
544
540
  signalingState: any;
545
541
  srdComplete: any;
546
542
  _incrementAnalyticMetric: P2PIncrementAnalyticMetric;
547
- constructor({ peerConnectionId, clientId, bandwidth, peerConnectionConfig, deprioritizeH264Encoding, shouldAddLocalVideo, incrementAnalyticMetric, }: P2PSessionOptions);
543
+ constructor({ peerConnectionId, clientId, bandwidth, peerConnectionConfig, deprioritizeH264Encoding, incrementAnalyticMetric, }: P2PSessionOptions);
548
544
  addStream(stream: MediaStream): void;
549
545
  addTrack(track: MediaStreamTrack, stream?: MediaStream): void;
550
546
  removeTrack(track: MediaStreamTrack): void;
@@ -1176,7 +1172,6 @@ declare function trackAnnotations(o: MediaStreamTrack): TrackAnnotation;
1176
1172
  interface GetOrCreateSessionOptions {
1177
1173
  peerConnectionId: string;
1178
1174
  clientId: string;
1179
- shouldAddLocalVideo: boolean;
1180
1175
  initialBandwidth: number;
1181
1176
  peerConnectionConfig: RTCConfiguration;
1182
1177
  }
@@ -1209,6 +1204,7 @@ type P2PAnalytics = {
1209
1204
  P2PReplaceTrackWithoutPC: number;
1210
1205
  P2PReplaceTrackSourceKindNotFound: number;
1211
1206
  P2PRemoveStreamNoPC: number;
1207
+ P2POnTrackNoStream: number;
1212
1208
  };
1213
1209
  type P2PAnalyticMetric = keyof P2PAnalytics;
1214
1210
  type P2PIncrementAnalyticMetric = (metric: P2PAnalyticMetric) => void;
@@ -1284,19 +1280,18 @@ declare class P2pRtcManager implements RtcManager {
1284
1280
  _addEnabledLocalStreamId(streamId: string): void;
1285
1281
  _deleteEnabledLocalStreamId(streamId: string): void;
1286
1282
  _getSession(peerConnectionId: string): Session | null;
1287
- _getOrCreateSession({ peerConnectionId, clientId, initialBandwidth, peerConnectionConfig, shouldAddLocalVideo, }: GetOrCreateSessionOptions): Session;
1283
+ _getOrCreateSession({ peerConnectionId, clientId, initialBandwidth, peerConnectionConfig, }: GetOrCreateSessionOptions): Session;
1288
1284
  _getLocalCameraStream(): any;
1289
1285
  _getNonLocalCameraStreamIds(): string[];
1290
1286
  _isScreensharingLocally(): boolean;
1291
1287
  _getFirstLocalNonCameraStream(): any;
1292
1288
  _transformIncomingSdp(original: UnifiedPlanSDP): RTCSessionDescription;
1293
1289
  _transformOutgoingSdp(original: RTCSessionDescription): UnifiedPlanSDP;
1294
- _createSession({ clientId, initialBandwidth, isOfferer, peerConnectionId, shouldAddLocalVideo, }: {
1290
+ _createSession({ clientId, initialBandwidth, isOfferer, peerConnectionId, }: {
1295
1291
  clientId: string;
1296
1292
  initialBandwidth: any;
1297
1293
  isOfferer: any;
1298
1294
  peerConnectionId: string;
1299
- shouldAddLocalVideo: boolean;
1300
1295
  }): Session;
1301
1296
  _cleanup(peerConnectionId: string): void;
1302
1297
  _forEachPeerConnection(func: any): void;
@@ -1317,16 +1312,14 @@ declare class P2pRtcManager implements RtcManager {
1317
1312
  _negotiatePeerConnection(clientId: string, session: any, constraints?: any): void;
1318
1313
  _withForcedRenegotiation(session: Session, action: any): void;
1319
1314
  _changeBandwidthForAllClients(isJoining: boolean): number;
1320
- _createP2pSession({ clientId, initialBandwidth, shouldAddLocalVideo, isOfferer, }: {
1315
+ _createP2pSession({ clientId, initialBandwidth, isOfferer, }: {
1321
1316
  clientId: string;
1322
1317
  initialBandwidth: number;
1323
- shouldAddLocalVideo: boolean;
1324
1318
  isOfferer: boolean;
1325
1319
  }): Session;
1326
- acceptNewStream({ streamId, clientId, shouldAddLocalVideo, }: {
1320
+ acceptNewStream({ streamId, clientId }: {
1327
1321
  streamId: string;
1328
1322
  clientId: string;
1329
- shouldAddLocalVideo?: boolean;
1330
1323
  }): Session;
1331
1324
  disconnect(clientId: string): void;
1332
1325
  updateStreamResolution(): void;
@@ -1339,6 +1332,7 @@ declare class P2pRtcManager implements RtcManager {
1339
1332
  _shareScreen(streamId: string, stream: any): void;
1340
1333
  removeStream(streamId: string, stream: any, requestedByClientId: any): void;
1341
1334
  hasClient(clientId: string): boolean;
1335
+ shouldAcceptStreamsFromBothSides(): boolean;
1342
1336
  }
1343
1337
 
1344
1338
  declare class RtcManagerDispatcher {
@@ -1686,7 +1680,7 @@ declare class VegaRtcManager implements RtcManager {
1686
1680
  setAudioOnly(audioOnly: boolean): void;
1687
1681
  setRemoteScreenshareVideoTrackIds(): void;
1688
1682
  setRoomSessionId(roomSessionId: string): void;
1689
- disconnect(clientIdOrStreamId: string, _activeBreakout: any, eventClaim?: string): void;
1683
+ disconnect(clientId: string, eventClaim?: string): void;
1690
1684
  replaceTrack(oldTrack: CustomMediaStreamTrack | null, track: CustomMediaStreamTrack): void;
1691
1685
  removeStream(streamId: string, _stream: MediaStream, requestedByClientId: string): void;
1692
1686
  _onMicAnalyserScoreUpdated(data: any): void;
@@ -1900,27 +1894,11 @@ declare const PROTOCOL_EVENTS: {
1900
1894
  MEDIA_QUALITY_CHANGED: string;
1901
1895
  };
1902
1896
 
1897
+ declare const CAMERA_STREAM_ID = "0";
1903
1898
  declare const STREAM_TYPES: {
1904
- CAMERA: string;
1905
- SCREEN_SHARE: string;
1899
+ webcam: string;
1900
+ screenshare: string;
1906
1901
  };
1907
- declare class RtcStream {
1908
- id: string;
1909
- type: string;
1910
- isEnabled: boolean;
1911
- hasSupportForAutoSuperSize: boolean;
1912
- isAudioEnabled: boolean;
1913
- isVideoEnabled: boolean;
1914
- status: string;
1915
- stream: MediaStream | null;
1916
- streamId: string | null;
1917
- constructor(id: string | number, type: string);
1918
- setup(stream: MediaStream): this;
1919
- setStatus(status: string): this;
1920
- setVideoEnabled(isEnabled: boolean): void;
1921
- setAudioEnabled(isEnabled: boolean): void;
1922
- static getCameraId(): string;
1923
- }
1924
1902
 
1925
- export { ADDITIONAL_SCREEN_SHARE_SETTINGS, AUDIO_SETTINGS, BandwidthTester, EVENTS, KNOCK_MESSAGES, KalmanFilter, Logger, MEDIA_JITTER_BUFFER_TARGET, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, RtcEventNames, RtcManagerDispatcher, RtcStream, SCREEN_SHARE_SETTINGS, SCREEN_SHARE_SIMULCAST_SETTINGS, STREAM_TYPES, ServerSocket, Session, SfuV2Parser, TYPES, VIDEO_SETTINGS_HD, VIDEO_SETTINGS_SD, VIDEO_SETTINGS_VP9, VIDEO_SETTINGS_VP9_LOW_BANDWIDTH, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDeviceAsync, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, issueDetectorOrMetricEnabled, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, sortCodecs, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, trackAnnotations, turnServerOverride, variance };
1903
+ export { ADDITIONAL_SCREEN_SHARE_SETTINGS, AUDIO_SETTINGS, BandwidthTester, CAMERA_STREAM_ID, EVENTS, KNOCK_MESSAGES, KalmanFilter, Logger, MEDIA_JITTER_BUFFER_TARGET, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, RtcEventNames, RtcManagerDispatcher, SCREEN_SHARE_SETTINGS, SCREEN_SHARE_SIMULCAST_SETTINGS, STREAM_TYPES, ServerSocket, Session, SfuV2Parser, TYPES, VIDEO_SETTINGS_HD, VIDEO_SETTINGS_SD, VIDEO_SETTINGS_VP9, VIDEO_SETTINGS_VP9_LOW_BANDWIDTH, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDeviceAsync, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, issueDetectorOrMetricEnabled, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, sortCodecs, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, trackAnnotations, turnServerOverride, variance };
1926
1904
  export type { AddSpotlightRequest, AudioEnableRequest, AudioEnableRequestedEvent, AudioEnabledEvent, BreakoutConfig, BreakoutGroupJoinedEvent, BreakoutSessionUpdatedEvent, CannotJoinUnclaimedRoomError, ChatMessage, ClientKickedEvent, ClientLeftEvent, ClientMetadataPayload, ClientMetadataReceivedEvent, ClientRole, ClientUnableToJoinEvent, CloudRecordingStartedEvent, Codec, Credentials, CustomMediaStreamTrack, ForbiddenError, ForbiddenErrorNames, GetConstraintsOptions, GetDeviceDataResult, GetMediaConstraintsOptions, GetStreamOptions, GetStreamResult, GetUpdatedDevicesResult, HostPresenceControlsError, IdentifyDeviceRequest, InternalServerError, InvalidAssistantKeyError, IssuesAndMetricsByView, JoinRoomRequest, KnockAcceptedEvent, KnockRejectedEvent, KnockRoomRequest, KnockerLeftEvent, LiveTranscriptionStartedEvent, LiveTranscriptionStoppedEvent, MaxViewerLimitReachedError, Metric, NewClientEvent, OrganizationAssistantNotEnabledError, OrganizationAssistantNotFoundError, OrganizationPlanExhaustedError, RemoveSpotlightRequest, RoleName, RoomConcurrencyControlsError, RoomFullError, RoomJoinedErrors, RoomJoinedEvent, RoomJoinedSuccess, RoomKnockedEvent, RoomLockedError, RoomLockedEvent, RoomMeetingTimeExhaustedError, RoomMode, RoomSessionEndedEvent, RtcClientConnectionStatusChangedPayload, RtcEvents, RtcLocalStreamTrackAddedPayload, RtcLocalStreamTrackRemovedPayload, RtcManager, RtcManagerCreatedPayload, RtcStreamAddedPayload, SDPRelayMessage, ScreenshareStartedEvent, ScreenshareStoppedEvent, SendClientMetadataRequest, SignalClient, SignalEvents, SignalKnocker, SignalRequests, SocketConf, SocketManager, Spotlight, SpotlightAddedEvent, SpotlightRemovedEvent, StatsMonitorOptions, StatsMonitorState, StatsSubscription, TurnTransportProtocol, UnifiedPlanSDP, UpdatedDeviceInfo, UpdatedDevicesInfo, VideoEnableRequest, VideoEnableRequestedEvent, VideoEnabledEvent };