@whereby.com/media 8.3.3 → 8.3.5

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
@@ -576,6 +576,9 @@ class Session {
576
576
  }
577
577
  });
578
578
  }
579
+ expectNewRemoteDescription() {
580
+ this.srdComplete = undefined;
581
+ }
579
582
  _setRemoteDescription(desc) {
580
583
  if (this._deprioritizeH264Encoding)
581
584
  desc.sdp = deprioritizeH264(desc.sdp);
@@ -622,6 +625,15 @@ class Session {
622
625
  });
623
626
  }
624
627
  handleAnswer(message) {
628
+ if (this.pc.signalingState !== "have-local-offer") {
629
+ logger$a.warn("Ignoring stale SDP answer for client %s (signalingState: %s)", this.clientId, this.pc.signalingState);
630
+ this._incrementAnalyticMetric("P2PStaleAnswerIgnored");
631
+ rtcStats.sendEvent("P2PStaleAnswerIgnored", {
632
+ clientId: this.clientId,
633
+ signalingState: this.pc.signalingState,
634
+ });
635
+ return Promise.resolve();
636
+ }
625
637
  const sdp = filterMsidSemantic(message.sdp);
626
638
  const desc = { type: message.type, sdp };
627
639
  return this._setRemoteDescription(desc).then(() => {
@@ -2543,6 +2555,7 @@ class P2pRtcManager {
2543
2555
  numPcSldFailure: 0,
2544
2556
  numPcOnAnswerFailure: 0,
2545
2557
  numPcOnOfferFailure: 0,
2558
+ P2PStaleAnswerIgnored: 0,
2546
2559
  P2PReplaceTrackNoStream: 0,
2547
2560
  P2PReplaceTrackNewTrackNotInStream: 0,
2548
2561
  P2POnTrackNoStream: 0,
@@ -3328,6 +3341,7 @@ class P2pRtcManager {
3328
3341
  throw e;
3329
3342
  })
3330
3343
  .then(() => {
3344
+ session.expectNewRemoteDescription();
3331
3345
  const message = {
3332
3346
  sdp: offer.sdp,
3333
3347
  sdpU: offer.sdp,
package/dist/index.d.cts CHANGED
@@ -1287,6 +1287,162 @@ declare function getUpdatedDevices({ oldDevices, newDevices, currentAudioId, cur
1287
1287
  currentSpeakerId?: string | undefined;
1288
1288
  }): GetUpdatedDevicesResult;
1289
1289
 
1290
+ declare const EVENTS: Record<string, keyof RtcEvents>;
1291
+ declare const TYPES: {
1292
+ readonly CONNECTING: "connecting";
1293
+ readonly CONNECTION_FAILED: "connection_failed";
1294
+ readonly CONNECTION_SUCCESSFUL: "connection_successful";
1295
+ readonly CONNECTION_DISCONNECTED: "connection_disconnected";
1296
+ };
1297
+ type ConnectionStatus = (typeof TYPES)[keyof typeof TYPES];
1298
+
1299
+ declare const PROTOCOL_REQUESTS: {
1300
+ BLOCK_CLIENT: string;
1301
+ CANCEL_ROOM_KNOCK: string;
1302
+ CLAIM_ROOM: string;
1303
+ CLEAR_CHAT_HISTORY: string;
1304
+ ENABLE_AUDIO: string;
1305
+ ENABLE_VIDEO: string;
1306
+ END_STREAM: string;
1307
+ FETCH_MEDIASERVER_CONFIG: string;
1308
+ HANDLE_KNOCK: string;
1309
+ IDENTIFY_DEVICE: string;
1310
+ INVITE_CLIENT_AS_MEMBER: string;
1311
+ JOIN_ROOM: string;
1312
+ KICK_CLIENT: string;
1313
+ KNOCK_ROOM: string;
1314
+ LEAVE_ROOM: string;
1315
+ SEND_CLIENT_METADATA: string;
1316
+ SET_LOCK: string;
1317
+ SHARE_MEDIA: string;
1318
+ START_NEW_STREAM: string;
1319
+ START_SCREENSHARE: string;
1320
+ STOP_SCREENSHARE: string;
1321
+ START_URL_EMBED: string;
1322
+ STOP_URL_EMBED: string;
1323
+ START_RECORDING: string;
1324
+ STOP_RECORDING: string;
1325
+ };
1326
+ declare const PROTOCOL_RESPONSES: {
1327
+ AUDIO_ENABLED: string;
1328
+ BACKGROUND_IMAGE_CHANGED: string;
1329
+ BLOCK_ADDED: string;
1330
+ BLOCK_REMOVED: string;
1331
+ CHAT_HISTORY_CLEARED: string;
1332
+ CLIENT_BLOCKED: string;
1333
+ CLIENT_INVITED_AS_MEMBER: string;
1334
+ CLIENT_KICKED: string;
1335
+ CLIENT_LEFT: string;
1336
+ CLIENT_METADATA_RECEIVED: string;
1337
+ CLIENT_READY: string;
1338
+ CLIENT_ROLE_CHANGED: string;
1339
+ CLIENT_USER_ID_CHANGED: string;
1340
+ CONTACTS_UPDATED: string;
1341
+ DEVICE_IDENTIFIED: string;
1342
+ ROOM_ROLES_UPDATED: string;
1343
+ KNOCK_HANDLED: string;
1344
+ KNOCK_PAGE_BACKGROUND_CHANGED: string;
1345
+ KNOCKER_LEFT: string;
1346
+ MEDIASERVER_CONFIG: string;
1347
+ MEDIA_SHARED: string;
1348
+ MEMBER_INVITE: string;
1349
+ NEW_CLIENT: string;
1350
+ NEW_STREAM_STARTED: string;
1351
+ SCREENSHARE_STARTED: string;
1352
+ SCREENSHARE_STOPPED: string;
1353
+ OWNER_NOTIFIED: string;
1354
+ OWNERS_CHANGED: string;
1355
+ PLAY_CLIENT_STICKER: string;
1356
+ ROOM_INTEGRATION_ENABLED: string;
1357
+ ROOM_INTEGRATION_DISABLED: string;
1358
+ ROOM_JOINED: string;
1359
+ ROOM_KNOCKED: string;
1360
+ ROOM_LEFT: string;
1361
+ ROOM_LOCKED: string;
1362
+ ROOM_PERMISSIONS_CHANGED: string;
1363
+ ROOM_LOGO_CHANGED: string;
1364
+ ROOM_TYPE_CHANGED: string;
1365
+ ROOM_MODE_CHANGED: string;
1366
+ SOCKET_USER_ID_CHANGED: string;
1367
+ STICKERS_UNLOCKED: string;
1368
+ STREAM_ENDED: string;
1369
+ URL_EMBED_STARTED: string;
1370
+ URL_EMBED_STOPPED: string;
1371
+ RECORDING_STARTED: string;
1372
+ RECORDING_STOPPED: string;
1373
+ USER_NOTIFIED: string;
1374
+ VIDEO_ENABLED: string;
1375
+ CLIENT_UNABLE_TO_JOIN: string;
1376
+ LIVE_TRANSCRIPTION_STARTED: string;
1377
+ LIVE_TRANSCRIPTION_STOPPED: string;
1378
+ LIVE_CAPTIONS_STARTED: string;
1379
+ LIVE_CAPTIONS_STOPPED: string;
1380
+ };
1381
+ declare const PROTOCOL_ERRORS: {
1382
+ CANNOT_INVITE_YOURSELF: string;
1383
+ CLIENT_BLOCKED: string;
1384
+ CLIENT_MISSING_DEVICE_ID: string;
1385
+ FORBIDDEN: string;
1386
+ FREE_TIER_EXHAUSTED: string;
1387
+ INTERNAL_SERVER_ERROR: string;
1388
+ INVALID_AVATAR: string;
1389
+ INVALID_PARAMETERS: string;
1390
+ INVALID_ROOM_NAME: string;
1391
+ MAX_VIEWER_LIMIT_REACHED: string;
1392
+ MISSING_PARAMETERS: string;
1393
+ MISSING_ROOM_NAME: string;
1394
+ NOT_AN_OWNER: string;
1395
+ NOT_IN_A_ROOM: string;
1396
+ ROOM_ALREADY_CLAIMED: string;
1397
+ ROOM_CONCURRENCY_CONTROL_ERROR: string;
1398
+ ROOM_EMAIL_MISSING: string;
1399
+ ROOM_EMPTY: string;
1400
+ ROOM_FULL: string;
1401
+ ROOM_JOIN_PERMISSION_DENIED: string;
1402
+ ROOM_LOCKED: string;
1403
+ ROOM_MEETING_TIME_EXHAUSTED: string;
1404
+ ROOM_UNCLAIMED: string;
1405
+ TOO_LONG_TEXT: string;
1406
+ UNIQUE_ROLE_ALREADY_IN_ROOM: string;
1407
+ UNSUPPORTED_VIDEO_ENCODING: string;
1408
+ VIDEO_STICKER_DOES_NOT_EXIST: string;
1409
+ VIDEO_STICKER_FORMAT_ERROR: string;
1410
+ };
1411
+ declare const RELAY_MESSAGES: {
1412
+ CHAT_MESSAGE: string;
1413
+ CHAT_READ_STATE: string;
1414
+ CHAT_STATE: string;
1415
+ ICE_CANDIDATE: string;
1416
+ ICE_END_OF_CANDIDATES: string;
1417
+ READY_TO_RECEIVE_OFFER: string;
1418
+ REMOTE_CLIENT_MEDIA_REQUEST: string;
1419
+ SDP_ANSWER: string;
1420
+ SDP_OFFER: string;
1421
+ VIDEO_STICKER: string;
1422
+ };
1423
+ declare const KNOCK_MESSAGES: {
1424
+ actions: {
1425
+ ACCEPT: string;
1426
+ HOLD: string;
1427
+ REJECT: string;
1428
+ };
1429
+ resolutions: {
1430
+ ACCEPTED: string;
1431
+ ON_HOLD: string;
1432
+ REJECTED: string;
1433
+ };
1434
+ };
1435
+ declare const PROTOCOL_EVENTS: {
1436
+ PENDING_CLIENT_LEFT: string;
1437
+ MEDIA_QUALITY_CHANGED: string;
1438
+ };
1439
+
1440
+ declare const CAMERA_STREAM_ID = "0";
1441
+ declare const STREAM_TYPES: {
1442
+ webcam: string;
1443
+ screenshare: string;
1444
+ };
1445
+
1290
1446
  interface P2PSessionOptions {
1291
1447
  clientId: string;
1292
1448
  bandwidth: number;
@@ -1305,7 +1461,7 @@ declare class Session {
1305
1461
  mdnsHostCandidateSeen: boolean;
1306
1462
  pc: RTCPeerConnection;
1307
1463
  wasEverConnected: boolean;
1308
- connectionStatus: any;
1464
+ connectionStatus: ConnectionStatus | null;
1309
1465
  bandwidth: any;
1310
1466
  pending: any[];
1311
1467
  isOperationPending: boolean;
@@ -1316,16 +1472,17 @@ declare class Session {
1316
1472
  registerConnected?: (value: unknown) => void;
1317
1473
  _deprioritizeH264Encoding: boolean;
1318
1474
  _mediaPrefs?: MediaPrefs;
1319
- clientId: any;
1475
+ clientId: string;
1320
1476
  peerConnectionConfig: RTCConfiguration;
1321
- signalingState: any;
1322
- srdComplete: any;
1477
+ signalingState: RTCPeerConnection["signalingState"];
1478
+ srdComplete?: ReturnType<RTCPeerConnection["setRemoteDescription"]>;
1323
1479
  _incrementAnalyticMetric: P2PIncrementAnalyticMetric;
1324
1480
  pendingReplaceTrackActions: (() => Promise<void>)[];
1325
1481
  constructor({ clientId, bandwidth, peerConnectionConfig, deprioritizeH264Encoding, incrementAnalyticMetric, mediaPrefs, }: P2PSessionOptions);
1326
1482
  addStream(stream: MediaStream): void;
1327
1483
  addTrack(track: MediaStreamTrack): void;
1328
1484
  removeStream(stream: MediaStream): void;
1485
+ expectNewRemoteDescription(): void;
1329
1486
  _setRemoteDescription(desc: SignalRTCSessionDescription): Promise<void>;
1330
1487
  handleOffer(offer: SignalRTCSessionDescription): Promise<SignalRTCSessionDescription>;
1331
1488
  handleAnswer(message: SignalRTCSessionDescription): Promise<void>;
@@ -1368,6 +1525,7 @@ type P2PAnalytics = {
1368
1525
  numPcOnAnswerFailure: number;
1369
1526
  numPcOnOfferFailure: number;
1370
1527
  numPcSldFailure: number;
1528
+ P2PStaleAnswerIgnored: number;
1371
1529
  P2PReplaceTrackNoStream: number;
1372
1530
  P2PReplaceTrackNewTrackNotInStream: number;
1373
1531
  P2POnTrackNoStream: number;
@@ -1439,7 +1597,7 @@ declare class P2pRtcManager implements RtcManager {
1439
1597
  setRemoteClientMediaPrefs(clientId: string, mediaPrefs: MediaPrefs): void;
1440
1598
  removeRemoteClientMediaPrefs(clientId: string): void;
1441
1599
  setRoomSessionId(roomSessionId: string): void;
1442
- _setConnectionStatus(session: Session, newStatus: string, clientId: string): void;
1600
+ _setConnectionStatus(session: Session, newStatus: ConnectionStatus, clientId: string): void;
1443
1601
  _setJitterBufferTarget(pc: RTCPeerConnection): void;
1444
1602
  _emitServerEvent(eventName: string, data?: any): void;
1445
1603
  _emit(eventName: string, data?: any): void;
@@ -1858,160 +2016,5 @@ declare class VegaRtcManager implements RtcManager {
1858
2016
  hasClient(clientId: string): boolean;
1859
2017
  }
1860
2018
 
1861
- declare const EVENTS: Record<string, keyof RtcEvents>;
1862
- declare const TYPES: {
1863
- CONNECTING: string;
1864
- CONNECTION_FAILED: string;
1865
- CONNECTION_SUCCESSFUL: string;
1866
- CONNECTION_DISCONNECTED: string;
1867
- };
1868
-
1869
- declare const PROTOCOL_REQUESTS: {
1870
- BLOCK_CLIENT: string;
1871
- CANCEL_ROOM_KNOCK: string;
1872
- CLAIM_ROOM: string;
1873
- CLEAR_CHAT_HISTORY: string;
1874
- ENABLE_AUDIO: string;
1875
- ENABLE_VIDEO: string;
1876
- END_STREAM: string;
1877
- FETCH_MEDIASERVER_CONFIG: string;
1878
- HANDLE_KNOCK: string;
1879
- IDENTIFY_DEVICE: string;
1880
- INVITE_CLIENT_AS_MEMBER: string;
1881
- JOIN_ROOM: string;
1882
- KICK_CLIENT: string;
1883
- KNOCK_ROOM: string;
1884
- LEAVE_ROOM: string;
1885
- SEND_CLIENT_METADATA: string;
1886
- SET_LOCK: string;
1887
- SHARE_MEDIA: string;
1888
- START_NEW_STREAM: string;
1889
- START_SCREENSHARE: string;
1890
- STOP_SCREENSHARE: string;
1891
- START_URL_EMBED: string;
1892
- STOP_URL_EMBED: string;
1893
- START_RECORDING: string;
1894
- STOP_RECORDING: string;
1895
- };
1896
- declare const PROTOCOL_RESPONSES: {
1897
- AUDIO_ENABLED: string;
1898
- BACKGROUND_IMAGE_CHANGED: string;
1899
- BLOCK_ADDED: string;
1900
- BLOCK_REMOVED: string;
1901
- CHAT_HISTORY_CLEARED: string;
1902
- CLIENT_BLOCKED: string;
1903
- CLIENT_INVITED_AS_MEMBER: string;
1904
- CLIENT_KICKED: string;
1905
- CLIENT_LEFT: string;
1906
- CLIENT_METADATA_RECEIVED: string;
1907
- CLIENT_READY: string;
1908
- CLIENT_ROLE_CHANGED: string;
1909
- CLIENT_USER_ID_CHANGED: string;
1910
- CONTACTS_UPDATED: string;
1911
- DEVICE_IDENTIFIED: string;
1912
- ROOM_ROLES_UPDATED: string;
1913
- KNOCK_HANDLED: string;
1914
- KNOCK_PAGE_BACKGROUND_CHANGED: string;
1915
- KNOCKER_LEFT: string;
1916
- MEDIASERVER_CONFIG: string;
1917
- MEDIA_SHARED: string;
1918
- MEMBER_INVITE: string;
1919
- NEW_CLIENT: string;
1920
- NEW_STREAM_STARTED: string;
1921
- SCREENSHARE_STARTED: string;
1922
- SCREENSHARE_STOPPED: string;
1923
- OWNER_NOTIFIED: string;
1924
- OWNERS_CHANGED: string;
1925
- PLAY_CLIENT_STICKER: string;
1926
- ROOM_INTEGRATION_ENABLED: string;
1927
- ROOM_INTEGRATION_DISABLED: string;
1928
- ROOM_JOINED: string;
1929
- ROOM_KNOCKED: string;
1930
- ROOM_LEFT: string;
1931
- ROOM_LOCKED: string;
1932
- ROOM_PERMISSIONS_CHANGED: string;
1933
- ROOM_LOGO_CHANGED: string;
1934
- ROOM_TYPE_CHANGED: string;
1935
- ROOM_MODE_CHANGED: string;
1936
- SOCKET_USER_ID_CHANGED: string;
1937
- STICKERS_UNLOCKED: string;
1938
- STREAM_ENDED: string;
1939
- URL_EMBED_STARTED: string;
1940
- URL_EMBED_STOPPED: string;
1941
- RECORDING_STARTED: string;
1942
- RECORDING_STOPPED: string;
1943
- USER_NOTIFIED: string;
1944
- VIDEO_ENABLED: string;
1945
- CLIENT_UNABLE_TO_JOIN: string;
1946
- LIVE_TRANSCRIPTION_STARTED: string;
1947
- LIVE_TRANSCRIPTION_STOPPED: string;
1948
- LIVE_CAPTIONS_STARTED: string;
1949
- LIVE_CAPTIONS_STOPPED: string;
1950
- };
1951
- declare const PROTOCOL_ERRORS: {
1952
- CANNOT_INVITE_YOURSELF: string;
1953
- CLIENT_BLOCKED: string;
1954
- CLIENT_MISSING_DEVICE_ID: string;
1955
- FORBIDDEN: string;
1956
- FREE_TIER_EXHAUSTED: string;
1957
- INTERNAL_SERVER_ERROR: string;
1958
- INVALID_AVATAR: string;
1959
- INVALID_PARAMETERS: string;
1960
- INVALID_ROOM_NAME: string;
1961
- MAX_VIEWER_LIMIT_REACHED: string;
1962
- MISSING_PARAMETERS: string;
1963
- MISSING_ROOM_NAME: string;
1964
- NOT_AN_OWNER: string;
1965
- NOT_IN_A_ROOM: string;
1966
- ROOM_ALREADY_CLAIMED: string;
1967
- ROOM_CONCURRENCY_CONTROL_ERROR: string;
1968
- ROOM_EMAIL_MISSING: string;
1969
- ROOM_EMPTY: string;
1970
- ROOM_FULL: string;
1971
- ROOM_JOIN_PERMISSION_DENIED: string;
1972
- ROOM_LOCKED: string;
1973
- ROOM_MEETING_TIME_EXHAUSTED: string;
1974
- ROOM_UNCLAIMED: string;
1975
- TOO_LONG_TEXT: string;
1976
- UNIQUE_ROLE_ALREADY_IN_ROOM: string;
1977
- UNSUPPORTED_VIDEO_ENCODING: string;
1978
- VIDEO_STICKER_DOES_NOT_EXIST: string;
1979
- VIDEO_STICKER_FORMAT_ERROR: string;
1980
- };
1981
- declare const RELAY_MESSAGES: {
1982
- CHAT_MESSAGE: string;
1983
- CHAT_READ_STATE: string;
1984
- CHAT_STATE: string;
1985
- ICE_CANDIDATE: string;
1986
- ICE_END_OF_CANDIDATES: string;
1987
- READY_TO_RECEIVE_OFFER: string;
1988
- REMOTE_CLIENT_MEDIA_REQUEST: string;
1989
- SDP_ANSWER: string;
1990
- SDP_OFFER: string;
1991
- VIDEO_STICKER: string;
1992
- };
1993
- declare const KNOCK_MESSAGES: {
1994
- actions: {
1995
- ACCEPT: string;
1996
- HOLD: string;
1997
- REJECT: string;
1998
- };
1999
- resolutions: {
2000
- ACCEPTED: string;
2001
- ON_HOLD: string;
2002
- REJECTED: string;
2003
- };
2004
- };
2005
- declare const PROTOCOL_EVENTS: {
2006
- PENDING_CLIENT_LEFT: string;
2007
- MEDIA_QUALITY_CHANGED: string;
2008
- };
2009
-
2010
- declare const CAMERA_STREAM_ID = "0";
2011
- declare const STREAM_TYPES: {
2012
- webcam: string;
2013
- screenshare: string;
2014
- };
2015
-
2016
2019
  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, 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, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, sortCodecs, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, trackAnnotations, turnServerOverride, variance };
2017
- export type { AddCameraStreamOptions, AddSpotlightRequest, AudioEnableRequest, AudioEnableRequestedEvent, AudioEnabledEvent, BreakoutConfig, BreakoutGroupJoinedEvent, BreakoutSessionUpdatedEvent, BuildDeviceListOptions, CannotJoinUnclaimedRoomError, ChatMessage, ClearableTimeout, ClientKickedEvent, ClientLeftEvent, ClientMetadataPayload, ClientMetadataReceivedEvent, ClientRole, ClientUnableToJoinEvent, CloudRecordingStartedEvent, Codec, Credentials, ForbiddenError, ForbiddenErrorNames, GetConstraintsOptions, GetDeviceDataResult, GetMediaConstraintsOptions, GetStreamOptions, GetStreamResult, GetUpdatedDevicesResult, HostPresenceControlsError, IdentifyDeviceRequest, InternalServerError, InvalidAssistantKeyError, IssuesAndMetricsByView, JoinRoomRequest, KnockAcceptedEvent, KnockRejectedEvent, KnockRoomRequest, KnockerLeftEvent, LiveTranscriptionStartedEvent, LiveTranscriptionStoppedEvent, MaxViewerLimitReachedError, MediaPrefs, Metric, NewClientEvent, OrganizationAssistantNotEnabledError, OrganizationAssistantNotFoundError, OrganizationPlanExhaustedError, RemoveScreenshareStreamOptions, RemoveSpotlightRequest, RoleName, RoomConcurrencyControlsError, RoomEmptyError, RoomFullError, RoomJoinPermissionDeniedError, RoomJoinedErrors, RoomJoinedEvent, RoomJoinedSuccess, RoomKnockedEvent, RoomLockedError, RoomLockedEvent, RoomMeetingTimeExhaustedError, RoomMode, RoomSessionEndedEvent, RtcClientConnectionStatusChangedPayload, RtcEventEmitter, RtcEvents, RtcLocalStreamTrackAddedPayload, RtcLocalStreamTrackRemovedPayload, RtcManager, RtcManagerCreatedPayload, RtcManagerOptions, RtcStreamAddedPayload, ScreenshareStartedEvent, ScreenshareStoppedEvent, SendClientMetadataRequest, SignalClient, SignalEvents, SignalIceCandidateMessage, SignalIceEndOfCandidatesMessage, SignalIceServer, SignalKnocker, SignalMediaServerConfig, SignalRTCSessionDescription, SignalReadyToReceiveOfferMessage, SignalRequests, SignalRoom, SignalSDPMessage, SignalSFUServer, SignalTurnServer, SocketConf, SocketManager, Spotlight, SpotlightAddedEvent, SpotlightRemovedEvent, StatsMonitorOptions, StatsMonitorState, StatsSubscription, TurnTransportProtocol, UniqueRoleAlreadyInRoomError, UpdatedDeviceInfo, UpdatedDevicesInfo, VegaConnectionOptions, VegaRtcManagerOptions, VideoEnableRequest, VideoEnableRequestedEvent, VideoEnabledEvent, WebRTCProvider };
2020
+ export type { AddCameraStreamOptions, AddSpotlightRequest, AudioEnableRequest, AudioEnableRequestedEvent, AudioEnabledEvent, BreakoutConfig, BreakoutGroupJoinedEvent, BreakoutSessionUpdatedEvent, BuildDeviceListOptions, CannotJoinUnclaimedRoomError, ChatMessage, ClearableTimeout, ClientKickedEvent, ClientLeftEvent, ClientMetadataPayload, ClientMetadataReceivedEvent, ClientRole, ClientUnableToJoinEvent, CloudRecordingStartedEvent, Codec, ConnectionStatus, Credentials, ForbiddenError, ForbiddenErrorNames, GetConstraintsOptions, GetDeviceDataResult, GetMediaConstraintsOptions, GetStreamOptions, GetStreamResult, GetUpdatedDevicesResult, HostPresenceControlsError, IdentifyDeviceRequest, InternalServerError, InvalidAssistantKeyError, IssuesAndMetricsByView, JoinRoomRequest, KnockAcceptedEvent, KnockRejectedEvent, KnockRoomRequest, KnockerLeftEvent, LiveTranscriptionStartedEvent, LiveTranscriptionStoppedEvent, MaxViewerLimitReachedError, MediaPrefs, Metric, NewClientEvent, OrganizationAssistantNotEnabledError, OrganizationAssistantNotFoundError, OrganizationPlanExhaustedError, RemoveScreenshareStreamOptions, RemoveSpotlightRequest, RoleName, RoomConcurrencyControlsError, RoomEmptyError, RoomFullError, RoomJoinPermissionDeniedError, RoomJoinedErrors, RoomJoinedEvent, RoomJoinedSuccess, RoomKnockedEvent, RoomLockedError, RoomLockedEvent, RoomMeetingTimeExhaustedError, RoomMode, RoomSessionEndedEvent, RtcClientConnectionStatusChangedPayload, RtcEventEmitter, RtcEvents, RtcLocalStreamTrackAddedPayload, RtcLocalStreamTrackRemovedPayload, RtcManager, RtcManagerCreatedPayload, RtcManagerOptions, RtcStreamAddedPayload, ScreenshareStartedEvent, ScreenshareStoppedEvent, SendClientMetadataRequest, SignalClient, SignalEvents, SignalIceCandidateMessage, SignalIceEndOfCandidatesMessage, SignalIceServer, SignalKnocker, SignalMediaServerConfig, SignalRTCSessionDescription, SignalReadyToReceiveOfferMessage, SignalRequests, SignalRoom, SignalSDPMessage, SignalSFUServer, SignalTurnServer, SocketConf, SocketManager, Spotlight, SpotlightAddedEvent, SpotlightRemovedEvent, StatsMonitorOptions, StatsMonitorState, StatsSubscription, TurnTransportProtocol, UniqueRoleAlreadyInRoomError, UpdatedDeviceInfo, UpdatedDevicesInfo, VegaConnectionOptions, VegaRtcManagerOptions, VideoEnableRequest, VideoEnableRequestedEvent, VideoEnabledEvent, WebRTCProvider };
package/dist/index.d.mts CHANGED
@@ -1287,6 +1287,162 @@ declare function getUpdatedDevices({ oldDevices, newDevices, currentAudioId, cur
1287
1287
  currentSpeakerId?: string | undefined;
1288
1288
  }): GetUpdatedDevicesResult;
1289
1289
 
1290
+ declare const EVENTS: Record<string, keyof RtcEvents>;
1291
+ declare const TYPES: {
1292
+ readonly CONNECTING: "connecting";
1293
+ readonly CONNECTION_FAILED: "connection_failed";
1294
+ readonly CONNECTION_SUCCESSFUL: "connection_successful";
1295
+ readonly CONNECTION_DISCONNECTED: "connection_disconnected";
1296
+ };
1297
+ type ConnectionStatus = (typeof TYPES)[keyof typeof TYPES];
1298
+
1299
+ declare const PROTOCOL_REQUESTS: {
1300
+ BLOCK_CLIENT: string;
1301
+ CANCEL_ROOM_KNOCK: string;
1302
+ CLAIM_ROOM: string;
1303
+ CLEAR_CHAT_HISTORY: string;
1304
+ ENABLE_AUDIO: string;
1305
+ ENABLE_VIDEO: string;
1306
+ END_STREAM: string;
1307
+ FETCH_MEDIASERVER_CONFIG: string;
1308
+ HANDLE_KNOCK: string;
1309
+ IDENTIFY_DEVICE: string;
1310
+ INVITE_CLIENT_AS_MEMBER: string;
1311
+ JOIN_ROOM: string;
1312
+ KICK_CLIENT: string;
1313
+ KNOCK_ROOM: string;
1314
+ LEAVE_ROOM: string;
1315
+ SEND_CLIENT_METADATA: string;
1316
+ SET_LOCK: string;
1317
+ SHARE_MEDIA: string;
1318
+ START_NEW_STREAM: string;
1319
+ START_SCREENSHARE: string;
1320
+ STOP_SCREENSHARE: string;
1321
+ START_URL_EMBED: string;
1322
+ STOP_URL_EMBED: string;
1323
+ START_RECORDING: string;
1324
+ STOP_RECORDING: string;
1325
+ };
1326
+ declare const PROTOCOL_RESPONSES: {
1327
+ AUDIO_ENABLED: string;
1328
+ BACKGROUND_IMAGE_CHANGED: string;
1329
+ BLOCK_ADDED: string;
1330
+ BLOCK_REMOVED: string;
1331
+ CHAT_HISTORY_CLEARED: string;
1332
+ CLIENT_BLOCKED: string;
1333
+ CLIENT_INVITED_AS_MEMBER: string;
1334
+ CLIENT_KICKED: string;
1335
+ CLIENT_LEFT: string;
1336
+ CLIENT_METADATA_RECEIVED: string;
1337
+ CLIENT_READY: string;
1338
+ CLIENT_ROLE_CHANGED: string;
1339
+ CLIENT_USER_ID_CHANGED: string;
1340
+ CONTACTS_UPDATED: string;
1341
+ DEVICE_IDENTIFIED: string;
1342
+ ROOM_ROLES_UPDATED: string;
1343
+ KNOCK_HANDLED: string;
1344
+ KNOCK_PAGE_BACKGROUND_CHANGED: string;
1345
+ KNOCKER_LEFT: string;
1346
+ MEDIASERVER_CONFIG: string;
1347
+ MEDIA_SHARED: string;
1348
+ MEMBER_INVITE: string;
1349
+ NEW_CLIENT: string;
1350
+ NEW_STREAM_STARTED: string;
1351
+ SCREENSHARE_STARTED: string;
1352
+ SCREENSHARE_STOPPED: string;
1353
+ OWNER_NOTIFIED: string;
1354
+ OWNERS_CHANGED: string;
1355
+ PLAY_CLIENT_STICKER: string;
1356
+ ROOM_INTEGRATION_ENABLED: string;
1357
+ ROOM_INTEGRATION_DISABLED: string;
1358
+ ROOM_JOINED: string;
1359
+ ROOM_KNOCKED: string;
1360
+ ROOM_LEFT: string;
1361
+ ROOM_LOCKED: string;
1362
+ ROOM_PERMISSIONS_CHANGED: string;
1363
+ ROOM_LOGO_CHANGED: string;
1364
+ ROOM_TYPE_CHANGED: string;
1365
+ ROOM_MODE_CHANGED: string;
1366
+ SOCKET_USER_ID_CHANGED: string;
1367
+ STICKERS_UNLOCKED: string;
1368
+ STREAM_ENDED: string;
1369
+ URL_EMBED_STARTED: string;
1370
+ URL_EMBED_STOPPED: string;
1371
+ RECORDING_STARTED: string;
1372
+ RECORDING_STOPPED: string;
1373
+ USER_NOTIFIED: string;
1374
+ VIDEO_ENABLED: string;
1375
+ CLIENT_UNABLE_TO_JOIN: string;
1376
+ LIVE_TRANSCRIPTION_STARTED: string;
1377
+ LIVE_TRANSCRIPTION_STOPPED: string;
1378
+ LIVE_CAPTIONS_STARTED: string;
1379
+ LIVE_CAPTIONS_STOPPED: string;
1380
+ };
1381
+ declare const PROTOCOL_ERRORS: {
1382
+ CANNOT_INVITE_YOURSELF: string;
1383
+ CLIENT_BLOCKED: string;
1384
+ CLIENT_MISSING_DEVICE_ID: string;
1385
+ FORBIDDEN: string;
1386
+ FREE_TIER_EXHAUSTED: string;
1387
+ INTERNAL_SERVER_ERROR: string;
1388
+ INVALID_AVATAR: string;
1389
+ INVALID_PARAMETERS: string;
1390
+ INVALID_ROOM_NAME: string;
1391
+ MAX_VIEWER_LIMIT_REACHED: string;
1392
+ MISSING_PARAMETERS: string;
1393
+ MISSING_ROOM_NAME: string;
1394
+ NOT_AN_OWNER: string;
1395
+ NOT_IN_A_ROOM: string;
1396
+ ROOM_ALREADY_CLAIMED: string;
1397
+ ROOM_CONCURRENCY_CONTROL_ERROR: string;
1398
+ ROOM_EMAIL_MISSING: string;
1399
+ ROOM_EMPTY: string;
1400
+ ROOM_FULL: string;
1401
+ ROOM_JOIN_PERMISSION_DENIED: string;
1402
+ ROOM_LOCKED: string;
1403
+ ROOM_MEETING_TIME_EXHAUSTED: string;
1404
+ ROOM_UNCLAIMED: string;
1405
+ TOO_LONG_TEXT: string;
1406
+ UNIQUE_ROLE_ALREADY_IN_ROOM: string;
1407
+ UNSUPPORTED_VIDEO_ENCODING: string;
1408
+ VIDEO_STICKER_DOES_NOT_EXIST: string;
1409
+ VIDEO_STICKER_FORMAT_ERROR: string;
1410
+ };
1411
+ declare const RELAY_MESSAGES: {
1412
+ CHAT_MESSAGE: string;
1413
+ CHAT_READ_STATE: string;
1414
+ CHAT_STATE: string;
1415
+ ICE_CANDIDATE: string;
1416
+ ICE_END_OF_CANDIDATES: string;
1417
+ READY_TO_RECEIVE_OFFER: string;
1418
+ REMOTE_CLIENT_MEDIA_REQUEST: string;
1419
+ SDP_ANSWER: string;
1420
+ SDP_OFFER: string;
1421
+ VIDEO_STICKER: string;
1422
+ };
1423
+ declare const KNOCK_MESSAGES: {
1424
+ actions: {
1425
+ ACCEPT: string;
1426
+ HOLD: string;
1427
+ REJECT: string;
1428
+ };
1429
+ resolutions: {
1430
+ ACCEPTED: string;
1431
+ ON_HOLD: string;
1432
+ REJECTED: string;
1433
+ };
1434
+ };
1435
+ declare const PROTOCOL_EVENTS: {
1436
+ PENDING_CLIENT_LEFT: string;
1437
+ MEDIA_QUALITY_CHANGED: string;
1438
+ };
1439
+
1440
+ declare const CAMERA_STREAM_ID = "0";
1441
+ declare const STREAM_TYPES: {
1442
+ webcam: string;
1443
+ screenshare: string;
1444
+ };
1445
+
1290
1446
  interface P2PSessionOptions {
1291
1447
  clientId: string;
1292
1448
  bandwidth: number;
@@ -1305,7 +1461,7 @@ declare class Session {
1305
1461
  mdnsHostCandidateSeen: boolean;
1306
1462
  pc: RTCPeerConnection;
1307
1463
  wasEverConnected: boolean;
1308
- connectionStatus: any;
1464
+ connectionStatus: ConnectionStatus | null;
1309
1465
  bandwidth: any;
1310
1466
  pending: any[];
1311
1467
  isOperationPending: boolean;
@@ -1316,16 +1472,17 @@ declare class Session {
1316
1472
  registerConnected?: (value: unknown) => void;
1317
1473
  _deprioritizeH264Encoding: boolean;
1318
1474
  _mediaPrefs?: MediaPrefs;
1319
- clientId: any;
1475
+ clientId: string;
1320
1476
  peerConnectionConfig: RTCConfiguration;
1321
- signalingState: any;
1322
- srdComplete: any;
1477
+ signalingState: RTCPeerConnection["signalingState"];
1478
+ srdComplete?: ReturnType<RTCPeerConnection["setRemoteDescription"]>;
1323
1479
  _incrementAnalyticMetric: P2PIncrementAnalyticMetric;
1324
1480
  pendingReplaceTrackActions: (() => Promise<void>)[];
1325
1481
  constructor({ clientId, bandwidth, peerConnectionConfig, deprioritizeH264Encoding, incrementAnalyticMetric, mediaPrefs, }: P2PSessionOptions);
1326
1482
  addStream(stream: MediaStream): void;
1327
1483
  addTrack(track: MediaStreamTrack): void;
1328
1484
  removeStream(stream: MediaStream): void;
1485
+ expectNewRemoteDescription(): void;
1329
1486
  _setRemoteDescription(desc: SignalRTCSessionDescription): Promise<void>;
1330
1487
  handleOffer(offer: SignalRTCSessionDescription): Promise<SignalRTCSessionDescription>;
1331
1488
  handleAnswer(message: SignalRTCSessionDescription): Promise<void>;
@@ -1368,6 +1525,7 @@ type P2PAnalytics = {
1368
1525
  numPcOnAnswerFailure: number;
1369
1526
  numPcOnOfferFailure: number;
1370
1527
  numPcSldFailure: number;
1528
+ P2PStaleAnswerIgnored: number;
1371
1529
  P2PReplaceTrackNoStream: number;
1372
1530
  P2PReplaceTrackNewTrackNotInStream: number;
1373
1531
  P2POnTrackNoStream: number;
@@ -1439,7 +1597,7 @@ declare class P2pRtcManager implements RtcManager {
1439
1597
  setRemoteClientMediaPrefs(clientId: string, mediaPrefs: MediaPrefs): void;
1440
1598
  removeRemoteClientMediaPrefs(clientId: string): void;
1441
1599
  setRoomSessionId(roomSessionId: string): void;
1442
- _setConnectionStatus(session: Session, newStatus: string, clientId: string): void;
1600
+ _setConnectionStatus(session: Session, newStatus: ConnectionStatus, clientId: string): void;
1443
1601
  _setJitterBufferTarget(pc: RTCPeerConnection): void;
1444
1602
  _emitServerEvent(eventName: string, data?: any): void;
1445
1603
  _emit(eventName: string, data?: any): void;
@@ -1858,160 +2016,5 @@ declare class VegaRtcManager implements RtcManager {
1858
2016
  hasClient(clientId: string): boolean;
1859
2017
  }
1860
2018
 
1861
- declare const EVENTS: Record<string, keyof RtcEvents>;
1862
- declare const TYPES: {
1863
- CONNECTING: string;
1864
- CONNECTION_FAILED: string;
1865
- CONNECTION_SUCCESSFUL: string;
1866
- CONNECTION_DISCONNECTED: string;
1867
- };
1868
-
1869
- declare const PROTOCOL_REQUESTS: {
1870
- BLOCK_CLIENT: string;
1871
- CANCEL_ROOM_KNOCK: string;
1872
- CLAIM_ROOM: string;
1873
- CLEAR_CHAT_HISTORY: string;
1874
- ENABLE_AUDIO: string;
1875
- ENABLE_VIDEO: string;
1876
- END_STREAM: string;
1877
- FETCH_MEDIASERVER_CONFIG: string;
1878
- HANDLE_KNOCK: string;
1879
- IDENTIFY_DEVICE: string;
1880
- INVITE_CLIENT_AS_MEMBER: string;
1881
- JOIN_ROOM: string;
1882
- KICK_CLIENT: string;
1883
- KNOCK_ROOM: string;
1884
- LEAVE_ROOM: string;
1885
- SEND_CLIENT_METADATA: string;
1886
- SET_LOCK: string;
1887
- SHARE_MEDIA: string;
1888
- START_NEW_STREAM: string;
1889
- START_SCREENSHARE: string;
1890
- STOP_SCREENSHARE: string;
1891
- START_URL_EMBED: string;
1892
- STOP_URL_EMBED: string;
1893
- START_RECORDING: string;
1894
- STOP_RECORDING: string;
1895
- };
1896
- declare const PROTOCOL_RESPONSES: {
1897
- AUDIO_ENABLED: string;
1898
- BACKGROUND_IMAGE_CHANGED: string;
1899
- BLOCK_ADDED: string;
1900
- BLOCK_REMOVED: string;
1901
- CHAT_HISTORY_CLEARED: string;
1902
- CLIENT_BLOCKED: string;
1903
- CLIENT_INVITED_AS_MEMBER: string;
1904
- CLIENT_KICKED: string;
1905
- CLIENT_LEFT: string;
1906
- CLIENT_METADATA_RECEIVED: string;
1907
- CLIENT_READY: string;
1908
- CLIENT_ROLE_CHANGED: string;
1909
- CLIENT_USER_ID_CHANGED: string;
1910
- CONTACTS_UPDATED: string;
1911
- DEVICE_IDENTIFIED: string;
1912
- ROOM_ROLES_UPDATED: string;
1913
- KNOCK_HANDLED: string;
1914
- KNOCK_PAGE_BACKGROUND_CHANGED: string;
1915
- KNOCKER_LEFT: string;
1916
- MEDIASERVER_CONFIG: string;
1917
- MEDIA_SHARED: string;
1918
- MEMBER_INVITE: string;
1919
- NEW_CLIENT: string;
1920
- NEW_STREAM_STARTED: string;
1921
- SCREENSHARE_STARTED: string;
1922
- SCREENSHARE_STOPPED: string;
1923
- OWNER_NOTIFIED: string;
1924
- OWNERS_CHANGED: string;
1925
- PLAY_CLIENT_STICKER: string;
1926
- ROOM_INTEGRATION_ENABLED: string;
1927
- ROOM_INTEGRATION_DISABLED: string;
1928
- ROOM_JOINED: string;
1929
- ROOM_KNOCKED: string;
1930
- ROOM_LEFT: string;
1931
- ROOM_LOCKED: string;
1932
- ROOM_PERMISSIONS_CHANGED: string;
1933
- ROOM_LOGO_CHANGED: string;
1934
- ROOM_TYPE_CHANGED: string;
1935
- ROOM_MODE_CHANGED: string;
1936
- SOCKET_USER_ID_CHANGED: string;
1937
- STICKERS_UNLOCKED: string;
1938
- STREAM_ENDED: string;
1939
- URL_EMBED_STARTED: string;
1940
- URL_EMBED_STOPPED: string;
1941
- RECORDING_STARTED: string;
1942
- RECORDING_STOPPED: string;
1943
- USER_NOTIFIED: string;
1944
- VIDEO_ENABLED: string;
1945
- CLIENT_UNABLE_TO_JOIN: string;
1946
- LIVE_TRANSCRIPTION_STARTED: string;
1947
- LIVE_TRANSCRIPTION_STOPPED: string;
1948
- LIVE_CAPTIONS_STARTED: string;
1949
- LIVE_CAPTIONS_STOPPED: string;
1950
- };
1951
- declare const PROTOCOL_ERRORS: {
1952
- CANNOT_INVITE_YOURSELF: string;
1953
- CLIENT_BLOCKED: string;
1954
- CLIENT_MISSING_DEVICE_ID: string;
1955
- FORBIDDEN: string;
1956
- FREE_TIER_EXHAUSTED: string;
1957
- INTERNAL_SERVER_ERROR: string;
1958
- INVALID_AVATAR: string;
1959
- INVALID_PARAMETERS: string;
1960
- INVALID_ROOM_NAME: string;
1961
- MAX_VIEWER_LIMIT_REACHED: string;
1962
- MISSING_PARAMETERS: string;
1963
- MISSING_ROOM_NAME: string;
1964
- NOT_AN_OWNER: string;
1965
- NOT_IN_A_ROOM: string;
1966
- ROOM_ALREADY_CLAIMED: string;
1967
- ROOM_CONCURRENCY_CONTROL_ERROR: string;
1968
- ROOM_EMAIL_MISSING: string;
1969
- ROOM_EMPTY: string;
1970
- ROOM_FULL: string;
1971
- ROOM_JOIN_PERMISSION_DENIED: string;
1972
- ROOM_LOCKED: string;
1973
- ROOM_MEETING_TIME_EXHAUSTED: string;
1974
- ROOM_UNCLAIMED: string;
1975
- TOO_LONG_TEXT: string;
1976
- UNIQUE_ROLE_ALREADY_IN_ROOM: string;
1977
- UNSUPPORTED_VIDEO_ENCODING: string;
1978
- VIDEO_STICKER_DOES_NOT_EXIST: string;
1979
- VIDEO_STICKER_FORMAT_ERROR: string;
1980
- };
1981
- declare const RELAY_MESSAGES: {
1982
- CHAT_MESSAGE: string;
1983
- CHAT_READ_STATE: string;
1984
- CHAT_STATE: string;
1985
- ICE_CANDIDATE: string;
1986
- ICE_END_OF_CANDIDATES: string;
1987
- READY_TO_RECEIVE_OFFER: string;
1988
- REMOTE_CLIENT_MEDIA_REQUEST: string;
1989
- SDP_ANSWER: string;
1990
- SDP_OFFER: string;
1991
- VIDEO_STICKER: string;
1992
- };
1993
- declare const KNOCK_MESSAGES: {
1994
- actions: {
1995
- ACCEPT: string;
1996
- HOLD: string;
1997
- REJECT: string;
1998
- };
1999
- resolutions: {
2000
- ACCEPTED: string;
2001
- ON_HOLD: string;
2002
- REJECTED: string;
2003
- };
2004
- };
2005
- declare const PROTOCOL_EVENTS: {
2006
- PENDING_CLIENT_LEFT: string;
2007
- MEDIA_QUALITY_CHANGED: string;
2008
- };
2009
-
2010
- declare const CAMERA_STREAM_ID = "0";
2011
- declare const STREAM_TYPES: {
2012
- webcam: string;
2013
- screenshare: string;
2014
- };
2015
-
2016
2019
  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, 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, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, sortCodecs, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, trackAnnotations, turnServerOverride, variance };
2017
- export type { AddCameraStreamOptions, AddSpotlightRequest, AudioEnableRequest, AudioEnableRequestedEvent, AudioEnabledEvent, BreakoutConfig, BreakoutGroupJoinedEvent, BreakoutSessionUpdatedEvent, BuildDeviceListOptions, CannotJoinUnclaimedRoomError, ChatMessage, ClearableTimeout, ClientKickedEvent, ClientLeftEvent, ClientMetadataPayload, ClientMetadataReceivedEvent, ClientRole, ClientUnableToJoinEvent, CloudRecordingStartedEvent, Codec, Credentials, ForbiddenError, ForbiddenErrorNames, GetConstraintsOptions, GetDeviceDataResult, GetMediaConstraintsOptions, GetStreamOptions, GetStreamResult, GetUpdatedDevicesResult, HostPresenceControlsError, IdentifyDeviceRequest, InternalServerError, InvalidAssistantKeyError, IssuesAndMetricsByView, JoinRoomRequest, KnockAcceptedEvent, KnockRejectedEvent, KnockRoomRequest, KnockerLeftEvent, LiveTranscriptionStartedEvent, LiveTranscriptionStoppedEvent, MaxViewerLimitReachedError, MediaPrefs, Metric, NewClientEvent, OrganizationAssistantNotEnabledError, OrganizationAssistantNotFoundError, OrganizationPlanExhaustedError, RemoveScreenshareStreamOptions, RemoveSpotlightRequest, RoleName, RoomConcurrencyControlsError, RoomEmptyError, RoomFullError, RoomJoinPermissionDeniedError, RoomJoinedErrors, RoomJoinedEvent, RoomJoinedSuccess, RoomKnockedEvent, RoomLockedError, RoomLockedEvent, RoomMeetingTimeExhaustedError, RoomMode, RoomSessionEndedEvent, RtcClientConnectionStatusChangedPayload, RtcEventEmitter, RtcEvents, RtcLocalStreamTrackAddedPayload, RtcLocalStreamTrackRemovedPayload, RtcManager, RtcManagerCreatedPayload, RtcManagerOptions, RtcStreamAddedPayload, ScreenshareStartedEvent, ScreenshareStoppedEvent, SendClientMetadataRequest, SignalClient, SignalEvents, SignalIceCandidateMessage, SignalIceEndOfCandidatesMessage, SignalIceServer, SignalKnocker, SignalMediaServerConfig, SignalRTCSessionDescription, SignalReadyToReceiveOfferMessage, SignalRequests, SignalRoom, SignalSDPMessage, SignalSFUServer, SignalTurnServer, SocketConf, SocketManager, Spotlight, SpotlightAddedEvent, SpotlightRemovedEvent, StatsMonitorOptions, StatsMonitorState, StatsSubscription, TurnTransportProtocol, UniqueRoleAlreadyInRoomError, UpdatedDeviceInfo, UpdatedDevicesInfo, VegaConnectionOptions, VegaRtcManagerOptions, VideoEnableRequest, VideoEnableRequestedEvent, VideoEnabledEvent, WebRTCProvider };
2020
+ export type { AddCameraStreamOptions, AddSpotlightRequest, AudioEnableRequest, AudioEnableRequestedEvent, AudioEnabledEvent, BreakoutConfig, BreakoutGroupJoinedEvent, BreakoutSessionUpdatedEvent, BuildDeviceListOptions, CannotJoinUnclaimedRoomError, ChatMessage, ClearableTimeout, ClientKickedEvent, ClientLeftEvent, ClientMetadataPayload, ClientMetadataReceivedEvent, ClientRole, ClientUnableToJoinEvent, CloudRecordingStartedEvent, Codec, ConnectionStatus, Credentials, ForbiddenError, ForbiddenErrorNames, GetConstraintsOptions, GetDeviceDataResult, GetMediaConstraintsOptions, GetStreamOptions, GetStreamResult, GetUpdatedDevicesResult, HostPresenceControlsError, IdentifyDeviceRequest, InternalServerError, InvalidAssistantKeyError, IssuesAndMetricsByView, JoinRoomRequest, KnockAcceptedEvent, KnockRejectedEvent, KnockRoomRequest, KnockerLeftEvent, LiveTranscriptionStartedEvent, LiveTranscriptionStoppedEvent, MaxViewerLimitReachedError, MediaPrefs, Metric, NewClientEvent, OrganizationAssistantNotEnabledError, OrganizationAssistantNotFoundError, OrganizationPlanExhaustedError, RemoveScreenshareStreamOptions, RemoveSpotlightRequest, RoleName, RoomConcurrencyControlsError, RoomEmptyError, RoomFullError, RoomJoinPermissionDeniedError, RoomJoinedErrors, RoomJoinedEvent, RoomJoinedSuccess, RoomKnockedEvent, RoomLockedError, RoomLockedEvent, RoomMeetingTimeExhaustedError, RoomMode, RoomSessionEndedEvent, RtcClientConnectionStatusChangedPayload, RtcEventEmitter, RtcEvents, RtcLocalStreamTrackAddedPayload, RtcLocalStreamTrackRemovedPayload, RtcManager, RtcManagerCreatedPayload, RtcManagerOptions, RtcStreamAddedPayload, ScreenshareStartedEvent, ScreenshareStoppedEvent, SendClientMetadataRequest, SignalClient, SignalEvents, SignalIceCandidateMessage, SignalIceEndOfCandidatesMessage, SignalIceServer, SignalKnocker, SignalMediaServerConfig, SignalRTCSessionDescription, SignalReadyToReceiveOfferMessage, SignalRequests, SignalRoom, SignalSDPMessage, SignalSFUServer, SignalTurnServer, SocketConf, SocketManager, Spotlight, SpotlightAddedEvent, SpotlightRemovedEvent, StatsMonitorOptions, StatsMonitorState, StatsSubscription, TurnTransportProtocol, UniqueRoleAlreadyInRoomError, UpdatedDeviceInfo, UpdatedDevicesInfo, VegaConnectionOptions, VegaRtcManagerOptions, VideoEnableRequest, VideoEnableRequestedEvent, VideoEnabledEvent, WebRTCProvider };
package/dist/index.d.ts CHANGED
@@ -1287,6 +1287,162 @@ declare function getUpdatedDevices({ oldDevices, newDevices, currentAudioId, cur
1287
1287
  currentSpeakerId?: string | undefined;
1288
1288
  }): GetUpdatedDevicesResult;
1289
1289
 
1290
+ declare const EVENTS: Record<string, keyof RtcEvents>;
1291
+ declare const TYPES: {
1292
+ readonly CONNECTING: "connecting";
1293
+ readonly CONNECTION_FAILED: "connection_failed";
1294
+ readonly CONNECTION_SUCCESSFUL: "connection_successful";
1295
+ readonly CONNECTION_DISCONNECTED: "connection_disconnected";
1296
+ };
1297
+ type ConnectionStatus = (typeof TYPES)[keyof typeof TYPES];
1298
+
1299
+ declare const PROTOCOL_REQUESTS: {
1300
+ BLOCK_CLIENT: string;
1301
+ CANCEL_ROOM_KNOCK: string;
1302
+ CLAIM_ROOM: string;
1303
+ CLEAR_CHAT_HISTORY: string;
1304
+ ENABLE_AUDIO: string;
1305
+ ENABLE_VIDEO: string;
1306
+ END_STREAM: string;
1307
+ FETCH_MEDIASERVER_CONFIG: string;
1308
+ HANDLE_KNOCK: string;
1309
+ IDENTIFY_DEVICE: string;
1310
+ INVITE_CLIENT_AS_MEMBER: string;
1311
+ JOIN_ROOM: string;
1312
+ KICK_CLIENT: string;
1313
+ KNOCK_ROOM: string;
1314
+ LEAVE_ROOM: string;
1315
+ SEND_CLIENT_METADATA: string;
1316
+ SET_LOCK: string;
1317
+ SHARE_MEDIA: string;
1318
+ START_NEW_STREAM: string;
1319
+ START_SCREENSHARE: string;
1320
+ STOP_SCREENSHARE: string;
1321
+ START_URL_EMBED: string;
1322
+ STOP_URL_EMBED: string;
1323
+ START_RECORDING: string;
1324
+ STOP_RECORDING: string;
1325
+ };
1326
+ declare const PROTOCOL_RESPONSES: {
1327
+ AUDIO_ENABLED: string;
1328
+ BACKGROUND_IMAGE_CHANGED: string;
1329
+ BLOCK_ADDED: string;
1330
+ BLOCK_REMOVED: string;
1331
+ CHAT_HISTORY_CLEARED: string;
1332
+ CLIENT_BLOCKED: string;
1333
+ CLIENT_INVITED_AS_MEMBER: string;
1334
+ CLIENT_KICKED: string;
1335
+ CLIENT_LEFT: string;
1336
+ CLIENT_METADATA_RECEIVED: string;
1337
+ CLIENT_READY: string;
1338
+ CLIENT_ROLE_CHANGED: string;
1339
+ CLIENT_USER_ID_CHANGED: string;
1340
+ CONTACTS_UPDATED: string;
1341
+ DEVICE_IDENTIFIED: string;
1342
+ ROOM_ROLES_UPDATED: string;
1343
+ KNOCK_HANDLED: string;
1344
+ KNOCK_PAGE_BACKGROUND_CHANGED: string;
1345
+ KNOCKER_LEFT: string;
1346
+ MEDIASERVER_CONFIG: string;
1347
+ MEDIA_SHARED: string;
1348
+ MEMBER_INVITE: string;
1349
+ NEW_CLIENT: string;
1350
+ NEW_STREAM_STARTED: string;
1351
+ SCREENSHARE_STARTED: string;
1352
+ SCREENSHARE_STOPPED: string;
1353
+ OWNER_NOTIFIED: string;
1354
+ OWNERS_CHANGED: string;
1355
+ PLAY_CLIENT_STICKER: string;
1356
+ ROOM_INTEGRATION_ENABLED: string;
1357
+ ROOM_INTEGRATION_DISABLED: string;
1358
+ ROOM_JOINED: string;
1359
+ ROOM_KNOCKED: string;
1360
+ ROOM_LEFT: string;
1361
+ ROOM_LOCKED: string;
1362
+ ROOM_PERMISSIONS_CHANGED: string;
1363
+ ROOM_LOGO_CHANGED: string;
1364
+ ROOM_TYPE_CHANGED: string;
1365
+ ROOM_MODE_CHANGED: string;
1366
+ SOCKET_USER_ID_CHANGED: string;
1367
+ STICKERS_UNLOCKED: string;
1368
+ STREAM_ENDED: string;
1369
+ URL_EMBED_STARTED: string;
1370
+ URL_EMBED_STOPPED: string;
1371
+ RECORDING_STARTED: string;
1372
+ RECORDING_STOPPED: string;
1373
+ USER_NOTIFIED: string;
1374
+ VIDEO_ENABLED: string;
1375
+ CLIENT_UNABLE_TO_JOIN: string;
1376
+ LIVE_TRANSCRIPTION_STARTED: string;
1377
+ LIVE_TRANSCRIPTION_STOPPED: string;
1378
+ LIVE_CAPTIONS_STARTED: string;
1379
+ LIVE_CAPTIONS_STOPPED: string;
1380
+ };
1381
+ declare const PROTOCOL_ERRORS: {
1382
+ CANNOT_INVITE_YOURSELF: string;
1383
+ CLIENT_BLOCKED: string;
1384
+ CLIENT_MISSING_DEVICE_ID: string;
1385
+ FORBIDDEN: string;
1386
+ FREE_TIER_EXHAUSTED: string;
1387
+ INTERNAL_SERVER_ERROR: string;
1388
+ INVALID_AVATAR: string;
1389
+ INVALID_PARAMETERS: string;
1390
+ INVALID_ROOM_NAME: string;
1391
+ MAX_VIEWER_LIMIT_REACHED: string;
1392
+ MISSING_PARAMETERS: string;
1393
+ MISSING_ROOM_NAME: string;
1394
+ NOT_AN_OWNER: string;
1395
+ NOT_IN_A_ROOM: string;
1396
+ ROOM_ALREADY_CLAIMED: string;
1397
+ ROOM_CONCURRENCY_CONTROL_ERROR: string;
1398
+ ROOM_EMAIL_MISSING: string;
1399
+ ROOM_EMPTY: string;
1400
+ ROOM_FULL: string;
1401
+ ROOM_JOIN_PERMISSION_DENIED: string;
1402
+ ROOM_LOCKED: string;
1403
+ ROOM_MEETING_TIME_EXHAUSTED: string;
1404
+ ROOM_UNCLAIMED: string;
1405
+ TOO_LONG_TEXT: string;
1406
+ UNIQUE_ROLE_ALREADY_IN_ROOM: string;
1407
+ UNSUPPORTED_VIDEO_ENCODING: string;
1408
+ VIDEO_STICKER_DOES_NOT_EXIST: string;
1409
+ VIDEO_STICKER_FORMAT_ERROR: string;
1410
+ };
1411
+ declare const RELAY_MESSAGES: {
1412
+ CHAT_MESSAGE: string;
1413
+ CHAT_READ_STATE: string;
1414
+ CHAT_STATE: string;
1415
+ ICE_CANDIDATE: string;
1416
+ ICE_END_OF_CANDIDATES: string;
1417
+ READY_TO_RECEIVE_OFFER: string;
1418
+ REMOTE_CLIENT_MEDIA_REQUEST: string;
1419
+ SDP_ANSWER: string;
1420
+ SDP_OFFER: string;
1421
+ VIDEO_STICKER: string;
1422
+ };
1423
+ declare const KNOCK_MESSAGES: {
1424
+ actions: {
1425
+ ACCEPT: string;
1426
+ HOLD: string;
1427
+ REJECT: string;
1428
+ };
1429
+ resolutions: {
1430
+ ACCEPTED: string;
1431
+ ON_HOLD: string;
1432
+ REJECTED: string;
1433
+ };
1434
+ };
1435
+ declare const PROTOCOL_EVENTS: {
1436
+ PENDING_CLIENT_LEFT: string;
1437
+ MEDIA_QUALITY_CHANGED: string;
1438
+ };
1439
+
1440
+ declare const CAMERA_STREAM_ID = "0";
1441
+ declare const STREAM_TYPES: {
1442
+ webcam: string;
1443
+ screenshare: string;
1444
+ };
1445
+
1290
1446
  interface P2PSessionOptions {
1291
1447
  clientId: string;
1292
1448
  bandwidth: number;
@@ -1305,7 +1461,7 @@ declare class Session {
1305
1461
  mdnsHostCandidateSeen: boolean;
1306
1462
  pc: RTCPeerConnection;
1307
1463
  wasEverConnected: boolean;
1308
- connectionStatus: any;
1464
+ connectionStatus: ConnectionStatus | null;
1309
1465
  bandwidth: any;
1310
1466
  pending: any[];
1311
1467
  isOperationPending: boolean;
@@ -1316,16 +1472,17 @@ declare class Session {
1316
1472
  registerConnected?: (value: unknown) => void;
1317
1473
  _deprioritizeH264Encoding: boolean;
1318
1474
  _mediaPrefs?: MediaPrefs;
1319
- clientId: any;
1475
+ clientId: string;
1320
1476
  peerConnectionConfig: RTCConfiguration;
1321
- signalingState: any;
1322
- srdComplete: any;
1477
+ signalingState: RTCPeerConnection["signalingState"];
1478
+ srdComplete?: ReturnType<RTCPeerConnection["setRemoteDescription"]>;
1323
1479
  _incrementAnalyticMetric: P2PIncrementAnalyticMetric;
1324
1480
  pendingReplaceTrackActions: (() => Promise<void>)[];
1325
1481
  constructor({ clientId, bandwidth, peerConnectionConfig, deprioritizeH264Encoding, incrementAnalyticMetric, mediaPrefs, }: P2PSessionOptions);
1326
1482
  addStream(stream: MediaStream): void;
1327
1483
  addTrack(track: MediaStreamTrack): void;
1328
1484
  removeStream(stream: MediaStream): void;
1485
+ expectNewRemoteDescription(): void;
1329
1486
  _setRemoteDescription(desc: SignalRTCSessionDescription): Promise<void>;
1330
1487
  handleOffer(offer: SignalRTCSessionDescription): Promise<SignalRTCSessionDescription>;
1331
1488
  handleAnswer(message: SignalRTCSessionDescription): Promise<void>;
@@ -1368,6 +1525,7 @@ type P2PAnalytics = {
1368
1525
  numPcOnAnswerFailure: number;
1369
1526
  numPcOnOfferFailure: number;
1370
1527
  numPcSldFailure: number;
1528
+ P2PStaleAnswerIgnored: number;
1371
1529
  P2PReplaceTrackNoStream: number;
1372
1530
  P2PReplaceTrackNewTrackNotInStream: number;
1373
1531
  P2POnTrackNoStream: number;
@@ -1439,7 +1597,7 @@ declare class P2pRtcManager implements RtcManager {
1439
1597
  setRemoteClientMediaPrefs(clientId: string, mediaPrefs: MediaPrefs): void;
1440
1598
  removeRemoteClientMediaPrefs(clientId: string): void;
1441
1599
  setRoomSessionId(roomSessionId: string): void;
1442
- _setConnectionStatus(session: Session, newStatus: string, clientId: string): void;
1600
+ _setConnectionStatus(session: Session, newStatus: ConnectionStatus, clientId: string): void;
1443
1601
  _setJitterBufferTarget(pc: RTCPeerConnection): void;
1444
1602
  _emitServerEvent(eventName: string, data?: any): void;
1445
1603
  _emit(eventName: string, data?: any): void;
@@ -1858,160 +2016,5 @@ declare class VegaRtcManager implements RtcManager {
1858
2016
  hasClient(clientId: string): boolean;
1859
2017
  }
1860
2018
 
1861
- declare const EVENTS: Record<string, keyof RtcEvents>;
1862
- declare const TYPES: {
1863
- CONNECTING: string;
1864
- CONNECTION_FAILED: string;
1865
- CONNECTION_SUCCESSFUL: string;
1866
- CONNECTION_DISCONNECTED: string;
1867
- };
1868
-
1869
- declare const PROTOCOL_REQUESTS: {
1870
- BLOCK_CLIENT: string;
1871
- CANCEL_ROOM_KNOCK: string;
1872
- CLAIM_ROOM: string;
1873
- CLEAR_CHAT_HISTORY: string;
1874
- ENABLE_AUDIO: string;
1875
- ENABLE_VIDEO: string;
1876
- END_STREAM: string;
1877
- FETCH_MEDIASERVER_CONFIG: string;
1878
- HANDLE_KNOCK: string;
1879
- IDENTIFY_DEVICE: string;
1880
- INVITE_CLIENT_AS_MEMBER: string;
1881
- JOIN_ROOM: string;
1882
- KICK_CLIENT: string;
1883
- KNOCK_ROOM: string;
1884
- LEAVE_ROOM: string;
1885
- SEND_CLIENT_METADATA: string;
1886
- SET_LOCK: string;
1887
- SHARE_MEDIA: string;
1888
- START_NEW_STREAM: string;
1889
- START_SCREENSHARE: string;
1890
- STOP_SCREENSHARE: string;
1891
- START_URL_EMBED: string;
1892
- STOP_URL_EMBED: string;
1893
- START_RECORDING: string;
1894
- STOP_RECORDING: string;
1895
- };
1896
- declare const PROTOCOL_RESPONSES: {
1897
- AUDIO_ENABLED: string;
1898
- BACKGROUND_IMAGE_CHANGED: string;
1899
- BLOCK_ADDED: string;
1900
- BLOCK_REMOVED: string;
1901
- CHAT_HISTORY_CLEARED: string;
1902
- CLIENT_BLOCKED: string;
1903
- CLIENT_INVITED_AS_MEMBER: string;
1904
- CLIENT_KICKED: string;
1905
- CLIENT_LEFT: string;
1906
- CLIENT_METADATA_RECEIVED: string;
1907
- CLIENT_READY: string;
1908
- CLIENT_ROLE_CHANGED: string;
1909
- CLIENT_USER_ID_CHANGED: string;
1910
- CONTACTS_UPDATED: string;
1911
- DEVICE_IDENTIFIED: string;
1912
- ROOM_ROLES_UPDATED: string;
1913
- KNOCK_HANDLED: string;
1914
- KNOCK_PAGE_BACKGROUND_CHANGED: string;
1915
- KNOCKER_LEFT: string;
1916
- MEDIASERVER_CONFIG: string;
1917
- MEDIA_SHARED: string;
1918
- MEMBER_INVITE: string;
1919
- NEW_CLIENT: string;
1920
- NEW_STREAM_STARTED: string;
1921
- SCREENSHARE_STARTED: string;
1922
- SCREENSHARE_STOPPED: string;
1923
- OWNER_NOTIFIED: string;
1924
- OWNERS_CHANGED: string;
1925
- PLAY_CLIENT_STICKER: string;
1926
- ROOM_INTEGRATION_ENABLED: string;
1927
- ROOM_INTEGRATION_DISABLED: string;
1928
- ROOM_JOINED: string;
1929
- ROOM_KNOCKED: string;
1930
- ROOM_LEFT: string;
1931
- ROOM_LOCKED: string;
1932
- ROOM_PERMISSIONS_CHANGED: string;
1933
- ROOM_LOGO_CHANGED: string;
1934
- ROOM_TYPE_CHANGED: string;
1935
- ROOM_MODE_CHANGED: string;
1936
- SOCKET_USER_ID_CHANGED: string;
1937
- STICKERS_UNLOCKED: string;
1938
- STREAM_ENDED: string;
1939
- URL_EMBED_STARTED: string;
1940
- URL_EMBED_STOPPED: string;
1941
- RECORDING_STARTED: string;
1942
- RECORDING_STOPPED: string;
1943
- USER_NOTIFIED: string;
1944
- VIDEO_ENABLED: string;
1945
- CLIENT_UNABLE_TO_JOIN: string;
1946
- LIVE_TRANSCRIPTION_STARTED: string;
1947
- LIVE_TRANSCRIPTION_STOPPED: string;
1948
- LIVE_CAPTIONS_STARTED: string;
1949
- LIVE_CAPTIONS_STOPPED: string;
1950
- };
1951
- declare const PROTOCOL_ERRORS: {
1952
- CANNOT_INVITE_YOURSELF: string;
1953
- CLIENT_BLOCKED: string;
1954
- CLIENT_MISSING_DEVICE_ID: string;
1955
- FORBIDDEN: string;
1956
- FREE_TIER_EXHAUSTED: string;
1957
- INTERNAL_SERVER_ERROR: string;
1958
- INVALID_AVATAR: string;
1959
- INVALID_PARAMETERS: string;
1960
- INVALID_ROOM_NAME: string;
1961
- MAX_VIEWER_LIMIT_REACHED: string;
1962
- MISSING_PARAMETERS: string;
1963
- MISSING_ROOM_NAME: string;
1964
- NOT_AN_OWNER: string;
1965
- NOT_IN_A_ROOM: string;
1966
- ROOM_ALREADY_CLAIMED: string;
1967
- ROOM_CONCURRENCY_CONTROL_ERROR: string;
1968
- ROOM_EMAIL_MISSING: string;
1969
- ROOM_EMPTY: string;
1970
- ROOM_FULL: string;
1971
- ROOM_JOIN_PERMISSION_DENIED: string;
1972
- ROOM_LOCKED: string;
1973
- ROOM_MEETING_TIME_EXHAUSTED: string;
1974
- ROOM_UNCLAIMED: string;
1975
- TOO_LONG_TEXT: string;
1976
- UNIQUE_ROLE_ALREADY_IN_ROOM: string;
1977
- UNSUPPORTED_VIDEO_ENCODING: string;
1978
- VIDEO_STICKER_DOES_NOT_EXIST: string;
1979
- VIDEO_STICKER_FORMAT_ERROR: string;
1980
- };
1981
- declare const RELAY_MESSAGES: {
1982
- CHAT_MESSAGE: string;
1983
- CHAT_READ_STATE: string;
1984
- CHAT_STATE: string;
1985
- ICE_CANDIDATE: string;
1986
- ICE_END_OF_CANDIDATES: string;
1987
- READY_TO_RECEIVE_OFFER: string;
1988
- REMOTE_CLIENT_MEDIA_REQUEST: string;
1989
- SDP_ANSWER: string;
1990
- SDP_OFFER: string;
1991
- VIDEO_STICKER: string;
1992
- };
1993
- declare const KNOCK_MESSAGES: {
1994
- actions: {
1995
- ACCEPT: string;
1996
- HOLD: string;
1997
- REJECT: string;
1998
- };
1999
- resolutions: {
2000
- ACCEPTED: string;
2001
- ON_HOLD: string;
2002
- REJECTED: string;
2003
- };
2004
- };
2005
- declare const PROTOCOL_EVENTS: {
2006
- PENDING_CLIENT_LEFT: string;
2007
- MEDIA_QUALITY_CHANGED: string;
2008
- };
2009
-
2010
- declare const CAMERA_STREAM_ID = "0";
2011
- declare const STREAM_TYPES: {
2012
- webcam: string;
2013
- screenshare: string;
2014
- };
2015
-
2016
2019
  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, 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, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, sortCodecs, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, trackAnnotations, turnServerOverride, variance };
2017
- export type { AddCameraStreamOptions, AddSpotlightRequest, AudioEnableRequest, AudioEnableRequestedEvent, AudioEnabledEvent, BreakoutConfig, BreakoutGroupJoinedEvent, BreakoutSessionUpdatedEvent, BuildDeviceListOptions, CannotJoinUnclaimedRoomError, ChatMessage, ClearableTimeout, ClientKickedEvent, ClientLeftEvent, ClientMetadataPayload, ClientMetadataReceivedEvent, ClientRole, ClientUnableToJoinEvent, CloudRecordingStartedEvent, Codec, Credentials, ForbiddenError, ForbiddenErrorNames, GetConstraintsOptions, GetDeviceDataResult, GetMediaConstraintsOptions, GetStreamOptions, GetStreamResult, GetUpdatedDevicesResult, HostPresenceControlsError, IdentifyDeviceRequest, InternalServerError, InvalidAssistantKeyError, IssuesAndMetricsByView, JoinRoomRequest, KnockAcceptedEvent, KnockRejectedEvent, KnockRoomRequest, KnockerLeftEvent, LiveTranscriptionStartedEvent, LiveTranscriptionStoppedEvent, MaxViewerLimitReachedError, MediaPrefs, Metric, NewClientEvent, OrganizationAssistantNotEnabledError, OrganizationAssistantNotFoundError, OrganizationPlanExhaustedError, RemoveScreenshareStreamOptions, RemoveSpotlightRequest, RoleName, RoomConcurrencyControlsError, RoomEmptyError, RoomFullError, RoomJoinPermissionDeniedError, RoomJoinedErrors, RoomJoinedEvent, RoomJoinedSuccess, RoomKnockedEvent, RoomLockedError, RoomLockedEvent, RoomMeetingTimeExhaustedError, RoomMode, RoomSessionEndedEvent, RtcClientConnectionStatusChangedPayload, RtcEventEmitter, RtcEvents, RtcLocalStreamTrackAddedPayload, RtcLocalStreamTrackRemovedPayload, RtcManager, RtcManagerCreatedPayload, RtcManagerOptions, RtcStreamAddedPayload, ScreenshareStartedEvent, ScreenshareStoppedEvent, SendClientMetadataRequest, SignalClient, SignalEvents, SignalIceCandidateMessage, SignalIceEndOfCandidatesMessage, SignalIceServer, SignalKnocker, SignalMediaServerConfig, SignalRTCSessionDescription, SignalReadyToReceiveOfferMessage, SignalRequests, SignalRoom, SignalSDPMessage, SignalSFUServer, SignalTurnServer, SocketConf, SocketManager, Spotlight, SpotlightAddedEvent, SpotlightRemovedEvent, StatsMonitorOptions, StatsMonitorState, StatsSubscription, TurnTransportProtocol, UniqueRoleAlreadyInRoomError, UpdatedDeviceInfo, UpdatedDevicesInfo, VegaConnectionOptions, VegaRtcManagerOptions, VideoEnableRequest, VideoEnableRequestedEvent, VideoEnabledEvent, WebRTCProvider };
2020
+ export type { AddCameraStreamOptions, AddSpotlightRequest, AudioEnableRequest, AudioEnableRequestedEvent, AudioEnabledEvent, BreakoutConfig, BreakoutGroupJoinedEvent, BreakoutSessionUpdatedEvent, BuildDeviceListOptions, CannotJoinUnclaimedRoomError, ChatMessage, ClearableTimeout, ClientKickedEvent, ClientLeftEvent, ClientMetadataPayload, ClientMetadataReceivedEvent, ClientRole, ClientUnableToJoinEvent, CloudRecordingStartedEvent, Codec, ConnectionStatus, Credentials, ForbiddenError, ForbiddenErrorNames, GetConstraintsOptions, GetDeviceDataResult, GetMediaConstraintsOptions, GetStreamOptions, GetStreamResult, GetUpdatedDevicesResult, HostPresenceControlsError, IdentifyDeviceRequest, InternalServerError, InvalidAssistantKeyError, IssuesAndMetricsByView, JoinRoomRequest, KnockAcceptedEvent, KnockRejectedEvent, KnockRoomRequest, KnockerLeftEvent, LiveTranscriptionStartedEvent, LiveTranscriptionStoppedEvent, MaxViewerLimitReachedError, MediaPrefs, Metric, NewClientEvent, OrganizationAssistantNotEnabledError, OrganizationAssistantNotFoundError, OrganizationPlanExhaustedError, RemoveScreenshareStreamOptions, RemoveSpotlightRequest, RoleName, RoomConcurrencyControlsError, RoomEmptyError, RoomFullError, RoomJoinPermissionDeniedError, RoomJoinedErrors, RoomJoinedEvent, RoomJoinedSuccess, RoomKnockedEvent, RoomLockedError, RoomLockedEvent, RoomMeetingTimeExhaustedError, RoomMode, RoomSessionEndedEvent, RtcClientConnectionStatusChangedPayload, RtcEventEmitter, RtcEvents, RtcLocalStreamTrackAddedPayload, RtcLocalStreamTrackRemovedPayload, RtcManager, RtcManagerCreatedPayload, RtcManagerOptions, RtcStreamAddedPayload, ScreenshareStartedEvent, ScreenshareStoppedEvent, SendClientMetadataRequest, SignalClient, SignalEvents, SignalIceCandidateMessage, SignalIceEndOfCandidatesMessage, SignalIceServer, SignalKnocker, SignalMediaServerConfig, SignalRTCSessionDescription, SignalReadyToReceiveOfferMessage, SignalRequests, SignalRoom, SignalSDPMessage, SignalSFUServer, SignalTurnServer, SocketConf, SocketManager, Spotlight, SpotlightAddedEvent, SpotlightRemovedEvent, StatsMonitorOptions, StatsMonitorState, StatsSubscription, TurnTransportProtocol, UniqueRoleAlreadyInRoomError, UpdatedDeviceInfo, UpdatedDevicesInfo, VegaConnectionOptions, VegaRtcManagerOptions, VideoEnableRequest, VideoEnableRequestedEvent, VideoEnabledEvent, WebRTCProvider };
package/dist/index.mjs CHANGED
@@ -555,6 +555,9 @@ class Session {
555
555
  }
556
556
  });
557
557
  }
558
+ expectNewRemoteDescription() {
559
+ this.srdComplete = undefined;
560
+ }
558
561
  _setRemoteDescription(desc) {
559
562
  if (this._deprioritizeH264Encoding)
560
563
  desc.sdp = deprioritizeH264(desc.sdp);
@@ -601,6 +604,15 @@ class Session {
601
604
  });
602
605
  }
603
606
  handleAnswer(message) {
607
+ if (this.pc.signalingState !== "have-local-offer") {
608
+ logger$a.warn("Ignoring stale SDP answer for client %s (signalingState: %s)", this.clientId, this.pc.signalingState);
609
+ this._incrementAnalyticMetric("P2PStaleAnswerIgnored");
610
+ rtcStats.sendEvent("P2PStaleAnswerIgnored", {
611
+ clientId: this.clientId,
612
+ signalingState: this.pc.signalingState,
613
+ });
614
+ return Promise.resolve();
615
+ }
604
616
  const sdp = filterMsidSemantic(message.sdp);
605
617
  const desc = { type: message.type, sdp };
606
618
  return this._setRemoteDescription(desc).then(() => {
@@ -2522,6 +2534,7 @@ class P2pRtcManager {
2522
2534
  numPcSldFailure: 0,
2523
2535
  numPcOnAnswerFailure: 0,
2524
2536
  numPcOnOfferFailure: 0,
2537
+ P2PStaleAnswerIgnored: 0,
2525
2538
  P2PReplaceTrackNoStream: 0,
2526
2539
  P2PReplaceTrackNewTrackNotInStream: 0,
2527
2540
  P2POnTrackNoStream: 0,
@@ -3307,6 +3320,7 @@ class P2pRtcManager {
3307
3320
  throw e;
3308
3321
  })
3309
3322
  .then(() => {
3323
+ session.expectNewRemoteDescription();
3310
3324
  const message = {
3311
3325
  sdp: offer.sdp,
3312
3326
  sdpU: offer.sdp,
@@ -555,6 +555,9 @@ class Session {
555
555
  }
556
556
  });
557
557
  }
558
+ expectNewRemoteDescription() {
559
+ this.srdComplete = undefined;
560
+ }
558
561
  _setRemoteDescription(desc) {
559
562
  if (this._deprioritizeH264Encoding)
560
563
  desc.sdp = deprioritizeH264(desc.sdp);
@@ -601,6 +604,15 @@ class Session {
601
604
  });
602
605
  }
603
606
  handleAnswer(message) {
607
+ if (this.pc.signalingState !== "have-local-offer") {
608
+ logger$a.warn("Ignoring stale SDP answer for client %s (signalingState: %s)", this.clientId, this.pc.signalingState);
609
+ this._incrementAnalyticMetric("P2PStaleAnswerIgnored");
610
+ rtcStats.sendEvent("P2PStaleAnswerIgnored", {
611
+ clientId: this.clientId,
612
+ signalingState: this.pc.signalingState,
613
+ });
614
+ return Promise.resolve();
615
+ }
604
616
  const sdp = filterMsidSemantic(message.sdp);
605
617
  const desc = { type: message.type, sdp };
606
618
  return this._setRemoteDescription(desc).then(() => {
@@ -2522,6 +2534,7 @@ class P2pRtcManager {
2522
2534
  numPcSldFailure: 0,
2523
2535
  numPcOnAnswerFailure: 0,
2524
2536
  numPcOnOfferFailure: 0,
2537
+ P2PStaleAnswerIgnored: 0,
2525
2538
  P2PReplaceTrackNoStream: 0,
2526
2539
  P2PReplaceTrackNewTrackNotInStream: 0,
2527
2540
  P2POnTrackNoStream: 0,
@@ -3307,6 +3320,7 @@ class P2pRtcManager {
3307
3320
  throw e;
3308
3321
  })
3309
3322
  .then(() => {
3323
+ session.expectNewRemoteDescription();
3310
3324
  const message = {
3311
3325
  sdp: offer.sdp,
3312
3326
  sdpU: offer.sdp,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@whereby.com/media",
3
3
  "description": "Media library for Whereby",
4
- "version": "8.3.3",
4
+ "version": "8.3.5",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/whereby/sdk",
7
7
  "repository": {
@@ -61,11 +61,11 @@
61
61
  "prettier": "^3.5.3",
62
62
  "process": "^0.11.10",
63
63
  "typescript": "^5.8.3",
64
+ "@whereby.com/eslint-config": "0.1.0",
64
65
  "@whereby.com/jest-config": "0.1.0",
65
66
  "@whereby.com/prettier-config": "0.1.0",
66
67
  "@whereby.com/rollup-config": "0.1.1",
67
- "@whereby.com/tsconfig": "0.1.0",
68
- "@whereby.com/eslint-config": "0.1.0"
68
+ "@whereby.com/tsconfig": "0.1.0"
69
69
  },
70
70
  "engines": {
71
71
  "node": ">=16.0.0"