@whereby.com/media 1.17.6 → 1.17.7

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
@@ -3381,14 +3381,15 @@ function compareLocalDevices(before, after) {
3381
3381
  }
3382
3382
  function getUpdatedDevices({ oldDevices, newDevices, currentAudioId, currentVideoId, currentSpeakerId, }) {
3383
3383
  const changesByKind = compareLocalDevices(oldDevices, newDevices);
3384
+ const removedDevices = {};
3384
3385
  const changedDevices = {};
3385
3386
  const addedDevices = {};
3386
- [
3387
+ const kindToDeviceIdMappings = [
3387
3388
  ["audioinput", currentAudioId],
3388
3389
  ["videoinput", currentVideoId],
3389
3390
  ["audiooutput", currentSpeakerId],
3390
- ].forEach(([kind, currentDeviceId]) => {
3391
- kind = kind || "";
3391
+ ];
3392
+ kindToDeviceIdMappings.forEach(([kind, currentDeviceId]) => {
3392
3393
  const changes = changesByKind[kind];
3393
3394
  if (!changes) {
3394
3395
  return;
@@ -3405,13 +3406,17 @@ function getUpdatedDevices({ oldDevices, newDevices, currentAudioId, currentVide
3405
3406
  changedDevices[kind] = { deviceId: currentDeviceId };
3406
3407
  }
3407
3408
  }
3408
- if (Object.keys(changes.added).length) {
3409
+ if (Object.keys(changes.added).length > 0) {
3409
3410
  const [deviceAdded] = Object.keys(changes.added).slice(0, 1);
3410
3411
  const add = changes.added[deviceAdded];
3411
3412
  addedDevices[kind] = { deviceId: add.deviceId, label: add.label, kind: add.kind };
3412
3413
  }
3414
+ if (Object.keys(changes.removed).length > 0) {
3415
+ const [deviceRemoved] = Object.keys(changes.removed).slice(0, 1);
3416
+ removedDevices[kind] = changes.removed[deviceRemoved];
3417
+ }
3413
3418
  });
3414
- return { addedDevices, changedDevices };
3419
+ return { addedDevices, changedDevices, removedDevices };
3415
3420
  }
3416
3421
 
3417
3422
  var _a$3;
package/dist/index.d.cts CHANGED
@@ -363,41 +363,20 @@ type GetStreamResult = {
363
363
  replacedTracks?: MediaStreamTrack[];
364
364
  stream: MediaStream;
365
365
  };
366
+ type UpdatedDeviceInfo = {
367
+ deviceId?: string | null;
368
+ kind?: MediaDeviceKind;
369
+ label?: string;
370
+ };
371
+ type UpdatedDevicesInfo = {
372
+ audioinput?: UpdatedDeviceInfo;
373
+ videoinput?: UpdatedDeviceInfo;
374
+ audiooutput?: UpdatedDeviceInfo;
375
+ };
366
376
  type GetUpdatedDevicesResult = {
367
- addedDevices: {
368
- audioinput?: {
369
- deviceId: string;
370
- label: string;
371
- kind: string;
372
- };
373
- videoinput?: {
374
- deviceId: string;
375
- label: string;
376
- kind: string;
377
- };
378
- audiooutput?: {
379
- deviceId: string;
380
- label: string;
381
- kind: string;
382
- };
383
- };
384
- changedDevices: {
385
- audioinput?: {
386
- deviceId: string;
387
- label: string;
388
- kind: string;
389
- };
390
- videoinput?: {
391
- deviceId: string;
392
- label: string;
393
- kind: string;
394
- };
395
- audiooutput?: {
396
- deviceId: string;
397
- label: string;
398
- kind: string;
399
- };
400
- };
377
+ addedDevices: UpdatedDevicesInfo;
378
+ changedDevices: UpdatedDevicesInfo;
379
+ removedDevices: UpdatedDevicesInfo;
401
380
  };
402
381
  type GetDeviceDataResult = {
403
382
  audio: {
@@ -447,7 +426,7 @@ declare function getDisplayMedia(constraints?: {
447
426
  };
448
427
  };
449
428
  }, contentHint?: string): Promise<MediaStream>;
450
- declare function compareLocalDevices(before: any, after: any): any;
429
+ declare function compareLocalDevices(before: MediaDeviceInfo[], after: MediaDeviceInfo[]): any;
451
430
  declare function getUpdatedDevices({ oldDevices, newDevices, currentAudioId, currentVideoId, currentSpeakerId, }: {
452
431
  oldDevices: MediaDeviceInfo[];
453
432
  newDevices: MediaDeviceInfo[];
@@ -1582,4 +1561,4 @@ declare class RtcStream {
1582
1561
  static getTypeFromId(id: string): string;
1583
1562
  }
1584
1563
 
1585
- export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutGroupJoinedEvent, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type IssuesAndMetricsByView, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, type LiveTranscriptionStartedEvent, type LiveTranscriptionStoppedEvent, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, type NewClientEvent, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomJoinedEvent, type RoomKnockedEvent, type RoomLockedEvent, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, STREAM_TYPES, type ScreenshareStartedEvent, type ScreenshareStoppedEvent, type SendClientMetadataRequest, ServerSocket, Session, SfuV2Parser, type SignalClient, type SignalEvents, type SignalKnocker, type SignalRequests, type SocketConf, type SocketManager, type Spotlight, type SpotlightAddedEvent, type SpotlightRemovedEvent, type StatsMonitorOptions, type StatsMonitorState, type StatsSubscription, TYPES, type TrackStats, type TurnTransportProtocol, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnableRequest, type VideoEnableRequestedEvent, type VideoEnabledEvent, type ViewStats, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, type ssrcStats, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
1564
+ export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutGroupJoinedEvent, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type IssuesAndMetricsByView, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, type LiveTranscriptionStartedEvent, type LiveTranscriptionStoppedEvent, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, type NewClientEvent, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomJoinedEvent, type RoomKnockedEvent, type RoomLockedEvent, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, STREAM_TYPES, type ScreenshareStartedEvent, type ScreenshareStoppedEvent, type SendClientMetadataRequest, ServerSocket, Session, SfuV2Parser, type SignalClient, type SignalEvents, type SignalKnocker, type SignalRequests, type SocketConf, type SocketManager, type Spotlight, type SpotlightAddedEvent, type SpotlightRemovedEvent, type StatsMonitorOptions, type StatsMonitorState, type StatsSubscription, TYPES, type TrackStats, type TurnTransportProtocol, type UpdatedDeviceInfo, type UpdatedDevicesInfo, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnableRequest, type VideoEnableRequestedEvent, type VideoEnabledEvent, type ViewStats, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, type ssrcStats, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
package/dist/index.d.mts CHANGED
@@ -363,41 +363,20 @@ type GetStreamResult = {
363
363
  replacedTracks?: MediaStreamTrack[];
364
364
  stream: MediaStream;
365
365
  };
366
+ type UpdatedDeviceInfo = {
367
+ deviceId?: string | null;
368
+ kind?: MediaDeviceKind;
369
+ label?: string;
370
+ };
371
+ type UpdatedDevicesInfo = {
372
+ audioinput?: UpdatedDeviceInfo;
373
+ videoinput?: UpdatedDeviceInfo;
374
+ audiooutput?: UpdatedDeviceInfo;
375
+ };
366
376
  type GetUpdatedDevicesResult = {
367
- addedDevices: {
368
- audioinput?: {
369
- deviceId: string;
370
- label: string;
371
- kind: string;
372
- };
373
- videoinput?: {
374
- deviceId: string;
375
- label: string;
376
- kind: string;
377
- };
378
- audiooutput?: {
379
- deviceId: string;
380
- label: string;
381
- kind: string;
382
- };
383
- };
384
- changedDevices: {
385
- audioinput?: {
386
- deviceId: string;
387
- label: string;
388
- kind: string;
389
- };
390
- videoinput?: {
391
- deviceId: string;
392
- label: string;
393
- kind: string;
394
- };
395
- audiooutput?: {
396
- deviceId: string;
397
- label: string;
398
- kind: string;
399
- };
400
- };
377
+ addedDevices: UpdatedDevicesInfo;
378
+ changedDevices: UpdatedDevicesInfo;
379
+ removedDevices: UpdatedDevicesInfo;
401
380
  };
402
381
  type GetDeviceDataResult = {
403
382
  audio: {
@@ -447,7 +426,7 @@ declare function getDisplayMedia(constraints?: {
447
426
  };
448
427
  };
449
428
  }, contentHint?: string): Promise<MediaStream>;
450
- declare function compareLocalDevices(before: any, after: any): any;
429
+ declare function compareLocalDevices(before: MediaDeviceInfo[], after: MediaDeviceInfo[]): any;
451
430
  declare function getUpdatedDevices({ oldDevices, newDevices, currentAudioId, currentVideoId, currentSpeakerId, }: {
452
431
  oldDevices: MediaDeviceInfo[];
453
432
  newDevices: MediaDeviceInfo[];
@@ -1582,4 +1561,4 @@ declare class RtcStream {
1582
1561
  static getTypeFromId(id: string): string;
1583
1562
  }
1584
1563
 
1585
- export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutGroupJoinedEvent, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type IssuesAndMetricsByView, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, type LiveTranscriptionStartedEvent, type LiveTranscriptionStoppedEvent, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, type NewClientEvent, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomJoinedEvent, type RoomKnockedEvent, type RoomLockedEvent, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, STREAM_TYPES, type ScreenshareStartedEvent, type ScreenshareStoppedEvent, type SendClientMetadataRequest, ServerSocket, Session, SfuV2Parser, type SignalClient, type SignalEvents, type SignalKnocker, type SignalRequests, type SocketConf, type SocketManager, type Spotlight, type SpotlightAddedEvent, type SpotlightRemovedEvent, type StatsMonitorOptions, type StatsMonitorState, type StatsSubscription, TYPES, type TrackStats, type TurnTransportProtocol, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnableRequest, type VideoEnableRequestedEvent, type VideoEnabledEvent, type ViewStats, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, type ssrcStats, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
1564
+ export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutGroupJoinedEvent, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type IssuesAndMetricsByView, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, type LiveTranscriptionStartedEvent, type LiveTranscriptionStoppedEvent, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, type NewClientEvent, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomJoinedEvent, type RoomKnockedEvent, type RoomLockedEvent, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, STREAM_TYPES, type ScreenshareStartedEvent, type ScreenshareStoppedEvent, type SendClientMetadataRequest, ServerSocket, Session, SfuV2Parser, type SignalClient, type SignalEvents, type SignalKnocker, type SignalRequests, type SocketConf, type SocketManager, type Spotlight, type SpotlightAddedEvent, type SpotlightRemovedEvent, type StatsMonitorOptions, type StatsMonitorState, type StatsSubscription, TYPES, type TrackStats, type TurnTransportProtocol, type UpdatedDeviceInfo, type UpdatedDevicesInfo, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnableRequest, type VideoEnableRequestedEvent, type VideoEnabledEvent, type ViewStats, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, type ssrcStats, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
package/dist/index.d.ts CHANGED
@@ -363,41 +363,20 @@ type GetStreamResult = {
363
363
  replacedTracks?: MediaStreamTrack[];
364
364
  stream: MediaStream;
365
365
  };
366
+ type UpdatedDeviceInfo = {
367
+ deviceId?: string | null;
368
+ kind?: MediaDeviceKind;
369
+ label?: string;
370
+ };
371
+ type UpdatedDevicesInfo = {
372
+ audioinput?: UpdatedDeviceInfo;
373
+ videoinput?: UpdatedDeviceInfo;
374
+ audiooutput?: UpdatedDeviceInfo;
375
+ };
366
376
  type GetUpdatedDevicesResult = {
367
- addedDevices: {
368
- audioinput?: {
369
- deviceId: string;
370
- label: string;
371
- kind: string;
372
- };
373
- videoinput?: {
374
- deviceId: string;
375
- label: string;
376
- kind: string;
377
- };
378
- audiooutput?: {
379
- deviceId: string;
380
- label: string;
381
- kind: string;
382
- };
383
- };
384
- changedDevices: {
385
- audioinput?: {
386
- deviceId: string;
387
- label: string;
388
- kind: string;
389
- };
390
- videoinput?: {
391
- deviceId: string;
392
- label: string;
393
- kind: string;
394
- };
395
- audiooutput?: {
396
- deviceId: string;
397
- label: string;
398
- kind: string;
399
- };
400
- };
377
+ addedDevices: UpdatedDevicesInfo;
378
+ changedDevices: UpdatedDevicesInfo;
379
+ removedDevices: UpdatedDevicesInfo;
401
380
  };
402
381
  type GetDeviceDataResult = {
403
382
  audio: {
@@ -447,7 +426,7 @@ declare function getDisplayMedia(constraints?: {
447
426
  };
448
427
  };
449
428
  }, contentHint?: string): Promise<MediaStream>;
450
- declare function compareLocalDevices(before: any, after: any): any;
429
+ declare function compareLocalDevices(before: MediaDeviceInfo[], after: MediaDeviceInfo[]): any;
451
430
  declare function getUpdatedDevices({ oldDevices, newDevices, currentAudioId, currentVideoId, currentSpeakerId, }: {
452
431
  oldDevices: MediaDeviceInfo[];
453
432
  newDevices: MediaDeviceInfo[];
@@ -1582,4 +1561,4 @@ declare class RtcStream {
1582
1561
  static getTypeFromId(id: string): string;
1583
1562
  }
1584
1563
 
1585
- export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutGroupJoinedEvent, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type IssuesAndMetricsByView, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, type LiveTranscriptionStartedEvent, type LiveTranscriptionStoppedEvent, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, type NewClientEvent, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomJoinedEvent, type RoomKnockedEvent, type RoomLockedEvent, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, STREAM_TYPES, type ScreenshareStartedEvent, type ScreenshareStoppedEvent, type SendClientMetadataRequest, ServerSocket, Session, SfuV2Parser, type SignalClient, type SignalEvents, type SignalKnocker, type SignalRequests, type SocketConf, type SocketManager, type Spotlight, type SpotlightAddedEvent, type SpotlightRemovedEvent, type StatsMonitorOptions, type StatsMonitorState, type StatsSubscription, TYPES, type TrackStats, type TurnTransportProtocol, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnableRequest, type VideoEnableRequestedEvent, type VideoEnabledEvent, type ViewStats, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, type ssrcStats, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
1564
+ export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutGroupJoinedEvent, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type IssuesAndMetricsByView, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, type LiveTranscriptionStartedEvent, type LiveTranscriptionStoppedEvent, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, type NewClientEvent, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomJoinedEvent, type RoomKnockedEvent, type RoomLockedEvent, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, STREAM_TYPES, type ScreenshareStartedEvent, type ScreenshareStoppedEvent, type SendClientMetadataRequest, ServerSocket, Session, SfuV2Parser, type SignalClient, type SignalEvents, type SignalKnocker, type SignalRequests, type SocketConf, type SocketManager, type Spotlight, type SpotlightAddedEvent, type SpotlightRemovedEvent, type StatsMonitorOptions, type StatsMonitorState, type StatsSubscription, TYPES, type TrackStats, type TurnTransportProtocol, type UpdatedDeviceInfo, type UpdatedDevicesInfo, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnableRequest, type VideoEnableRequestedEvent, type VideoEnabledEvent, type ViewStats, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, type ssrcStats, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
package/dist/index.mjs CHANGED
@@ -3360,14 +3360,15 @@ function compareLocalDevices(before, after) {
3360
3360
  }
3361
3361
  function getUpdatedDevices({ oldDevices, newDevices, currentAudioId, currentVideoId, currentSpeakerId, }) {
3362
3362
  const changesByKind = compareLocalDevices(oldDevices, newDevices);
3363
+ const removedDevices = {};
3363
3364
  const changedDevices = {};
3364
3365
  const addedDevices = {};
3365
- [
3366
+ const kindToDeviceIdMappings = [
3366
3367
  ["audioinput", currentAudioId],
3367
3368
  ["videoinput", currentVideoId],
3368
3369
  ["audiooutput", currentSpeakerId],
3369
- ].forEach(([kind, currentDeviceId]) => {
3370
- kind = kind || "";
3370
+ ];
3371
+ kindToDeviceIdMappings.forEach(([kind, currentDeviceId]) => {
3371
3372
  const changes = changesByKind[kind];
3372
3373
  if (!changes) {
3373
3374
  return;
@@ -3384,13 +3385,17 @@ function getUpdatedDevices({ oldDevices, newDevices, currentAudioId, currentVide
3384
3385
  changedDevices[kind] = { deviceId: currentDeviceId };
3385
3386
  }
3386
3387
  }
3387
- if (Object.keys(changes.added).length) {
3388
+ if (Object.keys(changes.added).length > 0) {
3388
3389
  const [deviceAdded] = Object.keys(changes.added).slice(0, 1);
3389
3390
  const add = changes.added[deviceAdded];
3390
3391
  addedDevices[kind] = { deviceId: add.deviceId, label: add.label, kind: add.kind };
3391
3392
  }
3393
+ if (Object.keys(changes.removed).length > 0) {
3394
+ const [deviceRemoved] = Object.keys(changes.removed).slice(0, 1);
3395
+ removedDevices[kind] = changes.removed[deviceRemoved];
3396
+ }
3392
3397
  });
3393
- return { addedDevices, changedDevices };
3398
+ return { addedDevices, changedDevices, removedDevices };
3394
3399
  }
3395
3400
 
3396
3401
  var _a$3;
@@ -3360,14 +3360,15 @@ function compareLocalDevices(before, after) {
3360
3360
  }
3361
3361
  function getUpdatedDevices({ oldDevices, newDevices, currentAudioId, currentVideoId, currentSpeakerId, }) {
3362
3362
  const changesByKind = compareLocalDevices(oldDevices, newDevices);
3363
+ const removedDevices = {};
3363
3364
  const changedDevices = {};
3364
3365
  const addedDevices = {};
3365
- [
3366
+ const kindToDeviceIdMappings = [
3366
3367
  ["audioinput", currentAudioId],
3367
3368
  ["videoinput", currentVideoId],
3368
3369
  ["audiooutput", currentSpeakerId],
3369
- ].forEach(([kind, currentDeviceId]) => {
3370
- kind = kind || "";
3370
+ ];
3371
+ kindToDeviceIdMappings.forEach(([kind, currentDeviceId]) => {
3371
3372
  const changes = changesByKind[kind];
3372
3373
  if (!changes) {
3373
3374
  return;
@@ -3384,13 +3385,17 @@ function getUpdatedDevices({ oldDevices, newDevices, currentAudioId, currentVide
3384
3385
  changedDevices[kind] = { deviceId: currentDeviceId };
3385
3386
  }
3386
3387
  }
3387
- if (Object.keys(changes.added).length) {
3388
+ if (Object.keys(changes.added).length > 0) {
3388
3389
  const [deviceAdded] = Object.keys(changes.added).slice(0, 1);
3389
3390
  const add = changes.added[deviceAdded];
3390
3391
  addedDevices[kind] = { deviceId: add.deviceId, label: add.label, kind: add.kind };
3391
3392
  }
3393
+ if (Object.keys(changes.removed).length > 0) {
3394
+ const [deviceRemoved] = Object.keys(changes.removed).slice(0, 1);
3395
+ removedDevices[kind] = changes.removed[deviceRemoved];
3396
+ }
3392
3397
  });
3393
- return { addedDevices, changedDevices };
3398
+ return { addedDevices, changedDevices, removedDevices };
3394
3399
  }
3395
3400
 
3396
3401
  var _a$3;
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": "1.17.6",
4
+ "version": "1.17.7",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/whereby/sdk",
7
7
  "repository": {