@whereby.com/media 1.22.0 → 1.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -2711,10 +2711,10 @@ class ReconnectManager extends EventEmitter {
2711
2711
  socket.on(PROTOCOL_RESPONSES.SCREENSHARE_STOPPED, (payload) => this._onScreenshareChanged(payload, false));
2712
2712
  }
2713
2713
  _onRoomJoined(payload) {
2714
- var _a, _b;
2714
+ var _a;
2715
2715
  return __awaiter(this, void 0, void 0, function* () {
2716
2716
  this.reconnectThresholdInMs = (payload.disconnectTimeout || 0) * 0.8;
2717
- if (!((_a = payload.room) === null || _a === void 0 ? void 0 : _a.clients)) {
2717
+ if (payload === null || payload === void 0 ? void 0 : payload.error) {
2718
2718
  this.emit(PROTOCOL_RESPONSES.ROOM_JOINED, payload);
2719
2719
  return;
2720
2720
  }
@@ -2722,7 +2722,7 @@ class ReconnectManager extends EventEmitter {
2722
2722
  this.emit(PROTOCOL_RESPONSES.ROOM_JOINED, payload);
2723
2723
  return;
2724
2724
  }
2725
- const myDeviceId = (_b = payload.room.clients.find((c) => payload.selfId === c.id)) === null || _b === void 0 ? void 0 : _b.deviceId;
2725
+ const myDeviceId = (_a = payload.room.clients.find((c) => payload.selfId === c.id)) === null || _a === void 0 ? void 0 : _a.deviceId;
2726
2726
  if (!myDeviceId) {
2727
2727
  this.emit(PROTOCOL_RESPONSES.ROOM_JOINED, payload);
2728
2728
  return;
@@ -3369,7 +3369,12 @@ class P2pRtcManager {
3369
3369
  this._emit(rtcManagerEvents.PC_ON_ANSWER_FAILURE, e);
3370
3370
  });
3371
3371
  }),
3372
- this._serverSocket.on(PROTOCOL_RESPONSES.ROOM_JOINED, ({ room: { sfuServer: isSfu } }) => {
3372
+ this._serverSocket.on(PROTOCOL_RESPONSES.ROOM_JOINED, (payload) => {
3373
+ var _a, _b;
3374
+ if (payload === null || payload === void 0 ? void 0 : payload.error) {
3375
+ return;
3376
+ }
3377
+ const isSfu = (_b = (_a = payload === null || payload === void 0 ? void 0 : payload.room) === null || _a === void 0 ? void 0 : _a.sfuServer) !== null && _b !== void 0 ? _b : false;
3373
3378
  if (isSfu || !this._wasScreenSharing)
3374
3379
  return;
3375
3380
  const screenShareStreamId = Object.keys(this.localStreams).find((id) => id !== CAMERA_STREAM_ID);
@@ -5119,7 +5124,10 @@ class VegaRtcManager {
5119
5124
  return;
5120
5125
  }
5121
5126
  this._updateAndScheduleMediaServersRefresh(data);
5122
- }), this._serverSocket.on(PROTOCOL_RESPONSES.ROOM_JOINED, () => {
5127
+ }), this._serverSocket.on(PROTOCOL_RESPONSES.ROOM_JOINED, (payload) => {
5128
+ if (payload === null || payload === void 0 ? void 0 : payload.error) {
5129
+ return;
5130
+ }
5123
5131
  if (this._screenVideoTrack)
5124
5132
  this._emitScreenshareStarted();
5125
5133
  if (this._features.sfuReconnectV2On && !this._hasVegaConnection && this._reconnect) {
package/dist/index.d.cts CHANGED
@@ -743,6 +743,7 @@ interface Spotlight {
743
743
  clientId: string;
744
744
  streamId: string;
745
745
  }
746
+ type RoomMode = "normal" | "group";
746
747
  interface AudioEnabledEvent {
747
748
  clientId: string;
748
749
  isAudioEnabled: boolean;
@@ -823,10 +824,50 @@ interface BreakoutConfig {
823
824
  } | null;
824
825
  startedAt?: Date | null;
825
826
  }
826
- interface RoomJoinedEvent {
827
- error?: string;
827
+ interface RoomLockedError {
828
+ error: "room_locked";
829
+ isClaimed: boolean;
828
830
  isLocked: boolean;
829
- room?: {
831
+ selfId: string;
832
+ logoUrl?: string;
833
+ knockPageBackgroundImageUrl?: string;
834
+ }
835
+ interface RoomFullError {
836
+ error: "room_full";
837
+ isClaimed: boolean;
838
+ }
839
+ interface RoomConcurrencyControlsError {
840
+ error: "room_concurrency_control_error";
841
+ }
842
+ interface CannotJoinUnclaimedRoomError {
843
+ error: "room_unclaimed";
844
+ }
845
+ interface OrganizationPlanExhaustedError {
846
+ error: "free_tier_exhausted";
847
+ }
848
+ interface RoomMeetingTimeExhaustedError {
849
+ error: "room_meeting_time_exhausted";
850
+ }
851
+ interface MaxViewerLimitReachedError {
852
+ error: "max_viewer_limit_reached";
853
+ isClaimed: boolean;
854
+ }
855
+ interface HostPresenceControlsError {
856
+ error: "host_presence_controls_error";
857
+ }
858
+ interface InternalServerError {
859
+ error: "internal_server_error";
860
+ }
861
+ type ForbiddenErrorNames = "missing_parameters" | "invalid_parameters" | "invalid_room_name" | "invalid_key" | "invalid_avatar";
862
+ interface ForbiddenError {
863
+ error: ForbiddenErrorNames;
864
+ }
865
+ type RoomJoinedErrors = RoomLockedError | RoomFullError | RoomConcurrencyControlsError | CannotJoinUnclaimedRoomError | OrganizationPlanExhaustedError | RoomMeetingTimeExhaustedError | MaxViewerLimitReachedError | HostPresenceControlsError | ForbiddenError | InternalServerError;
866
+ interface RoomJoinedSuccess {
867
+ room: {
868
+ mode: RoomMode;
869
+ isClaimed: boolean;
870
+ isLocked: boolean;
830
871
  clients: SignalClient[];
831
872
  knockers: SignalKnocker[];
832
873
  spotlights: Spotlight[];
@@ -836,10 +877,11 @@ interface RoomJoinedEvent {
836
877
  } | null;
837
878
  };
838
879
  selfId: string;
839
- breakoutGroup: string | null;
840
- clientClaim?: string;
880
+ breakoutGroup?: string | null;
881
+ clientClaim: string;
841
882
  breakout?: BreakoutConfig;
842
883
  }
884
+ type RoomJoinedEvent = RoomJoinedErrors | RoomJoinedSuccess;
843
885
  interface BreakoutSessionUpdatedEvent extends BreakoutConfig {
844
886
  }
845
887
  interface RoomKnockedEvent {
@@ -1663,4 +1705,4 @@ declare class RtcStream {
1663
1705
  static getTypeFromId(id: string): string;
1664
1706
  }
1665
1707
 
1666
- export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutConfig, type BreakoutGroupJoinedEvent, type BreakoutSessionUpdatedEvent, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Codec, 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, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDevice, 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, sortCodecs, type ssrcStats, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, turnServerOverride, variance };
1708
+ export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutConfig, type BreakoutGroupJoinedEvent, type BreakoutSessionUpdatedEvent, type CannotJoinUnclaimedRoomError, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Codec, type Credentials, type CustomMediaStreamTrack, EVENTS, type ForbiddenError, type ForbiddenErrorNames, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type HostPresenceControlsError, type IdentifyDeviceRequest, type InternalServerError, 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 MaxViewerLimitReachedError, type NewClientEvent, NoDevicesError, type OrganizationPlanExhaustedError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomConcurrencyControlsError, type RoomFullError, type RoomJoinedErrors, type RoomJoinedEvent, type RoomJoinedSuccess, type RoomKnockedEvent, type RoomLockedError, type RoomLockedEvent, type RoomMeetingTimeExhaustedError, type RoomMode, 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, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDevice, 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, sortCodecs, type ssrcStats, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, turnServerOverride, variance };
package/dist/index.d.mts CHANGED
@@ -743,6 +743,7 @@ interface Spotlight {
743
743
  clientId: string;
744
744
  streamId: string;
745
745
  }
746
+ type RoomMode = "normal" | "group";
746
747
  interface AudioEnabledEvent {
747
748
  clientId: string;
748
749
  isAudioEnabled: boolean;
@@ -823,10 +824,50 @@ interface BreakoutConfig {
823
824
  } | null;
824
825
  startedAt?: Date | null;
825
826
  }
826
- interface RoomJoinedEvent {
827
- error?: string;
827
+ interface RoomLockedError {
828
+ error: "room_locked";
829
+ isClaimed: boolean;
828
830
  isLocked: boolean;
829
- room?: {
831
+ selfId: string;
832
+ logoUrl?: string;
833
+ knockPageBackgroundImageUrl?: string;
834
+ }
835
+ interface RoomFullError {
836
+ error: "room_full";
837
+ isClaimed: boolean;
838
+ }
839
+ interface RoomConcurrencyControlsError {
840
+ error: "room_concurrency_control_error";
841
+ }
842
+ interface CannotJoinUnclaimedRoomError {
843
+ error: "room_unclaimed";
844
+ }
845
+ interface OrganizationPlanExhaustedError {
846
+ error: "free_tier_exhausted";
847
+ }
848
+ interface RoomMeetingTimeExhaustedError {
849
+ error: "room_meeting_time_exhausted";
850
+ }
851
+ interface MaxViewerLimitReachedError {
852
+ error: "max_viewer_limit_reached";
853
+ isClaimed: boolean;
854
+ }
855
+ interface HostPresenceControlsError {
856
+ error: "host_presence_controls_error";
857
+ }
858
+ interface InternalServerError {
859
+ error: "internal_server_error";
860
+ }
861
+ type ForbiddenErrorNames = "missing_parameters" | "invalid_parameters" | "invalid_room_name" | "invalid_key" | "invalid_avatar";
862
+ interface ForbiddenError {
863
+ error: ForbiddenErrorNames;
864
+ }
865
+ type RoomJoinedErrors = RoomLockedError | RoomFullError | RoomConcurrencyControlsError | CannotJoinUnclaimedRoomError | OrganizationPlanExhaustedError | RoomMeetingTimeExhaustedError | MaxViewerLimitReachedError | HostPresenceControlsError | ForbiddenError | InternalServerError;
866
+ interface RoomJoinedSuccess {
867
+ room: {
868
+ mode: RoomMode;
869
+ isClaimed: boolean;
870
+ isLocked: boolean;
830
871
  clients: SignalClient[];
831
872
  knockers: SignalKnocker[];
832
873
  spotlights: Spotlight[];
@@ -836,10 +877,11 @@ interface RoomJoinedEvent {
836
877
  } | null;
837
878
  };
838
879
  selfId: string;
839
- breakoutGroup: string | null;
840
- clientClaim?: string;
880
+ breakoutGroup?: string | null;
881
+ clientClaim: string;
841
882
  breakout?: BreakoutConfig;
842
883
  }
884
+ type RoomJoinedEvent = RoomJoinedErrors | RoomJoinedSuccess;
843
885
  interface BreakoutSessionUpdatedEvent extends BreakoutConfig {
844
886
  }
845
887
  interface RoomKnockedEvent {
@@ -1663,4 +1705,4 @@ declare class RtcStream {
1663
1705
  static getTypeFromId(id: string): string;
1664
1706
  }
1665
1707
 
1666
- export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutConfig, type BreakoutGroupJoinedEvent, type BreakoutSessionUpdatedEvent, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Codec, 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, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDevice, 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, sortCodecs, type ssrcStats, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, turnServerOverride, variance };
1708
+ export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutConfig, type BreakoutGroupJoinedEvent, type BreakoutSessionUpdatedEvent, type CannotJoinUnclaimedRoomError, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Codec, type Credentials, type CustomMediaStreamTrack, EVENTS, type ForbiddenError, type ForbiddenErrorNames, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type HostPresenceControlsError, type IdentifyDeviceRequest, type InternalServerError, 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 MaxViewerLimitReachedError, type NewClientEvent, NoDevicesError, type OrganizationPlanExhaustedError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomConcurrencyControlsError, type RoomFullError, type RoomJoinedErrors, type RoomJoinedEvent, type RoomJoinedSuccess, type RoomKnockedEvent, type RoomLockedError, type RoomLockedEvent, type RoomMeetingTimeExhaustedError, type RoomMode, 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, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDevice, 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, sortCodecs, type ssrcStats, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, turnServerOverride, variance };
package/dist/index.d.ts CHANGED
@@ -743,6 +743,7 @@ interface Spotlight {
743
743
  clientId: string;
744
744
  streamId: string;
745
745
  }
746
+ type RoomMode = "normal" | "group";
746
747
  interface AudioEnabledEvent {
747
748
  clientId: string;
748
749
  isAudioEnabled: boolean;
@@ -823,10 +824,50 @@ interface BreakoutConfig {
823
824
  } | null;
824
825
  startedAt?: Date | null;
825
826
  }
826
- interface RoomJoinedEvent {
827
- error?: string;
827
+ interface RoomLockedError {
828
+ error: "room_locked";
829
+ isClaimed: boolean;
828
830
  isLocked: boolean;
829
- room?: {
831
+ selfId: string;
832
+ logoUrl?: string;
833
+ knockPageBackgroundImageUrl?: string;
834
+ }
835
+ interface RoomFullError {
836
+ error: "room_full";
837
+ isClaimed: boolean;
838
+ }
839
+ interface RoomConcurrencyControlsError {
840
+ error: "room_concurrency_control_error";
841
+ }
842
+ interface CannotJoinUnclaimedRoomError {
843
+ error: "room_unclaimed";
844
+ }
845
+ interface OrganizationPlanExhaustedError {
846
+ error: "free_tier_exhausted";
847
+ }
848
+ interface RoomMeetingTimeExhaustedError {
849
+ error: "room_meeting_time_exhausted";
850
+ }
851
+ interface MaxViewerLimitReachedError {
852
+ error: "max_viewer_limit_reached";
853
+ isClaimed: boolean;
854
+ }
855
+ interface HostPresenceControlsError {
856
+ error: "host_presence_controls_error";
857
+ }
858
+ interface InternalServerError {
859
+ error: "internal_server_error";
860
+ }
861
+ type ForbiddenErrorNames = "missing_parameters" | "invalid_parameters" | "invalid_room_name" | "invalid_key" | "invalid_avatar";
862
+ interface ForbiddenError {
863
+ error: ForbiddenErrorNames;
864
+ }
865
+ type RoomJoinedErrors = RoomLockedError | RoomFullError | RoomConcurrencyControlsError | CannotJoinUnclaimedRoomError | OrganizationPlanExhaustedError | RoomMeetingTimeExhaustedError | MaxViewerLimitReachedError | HostPresenceControlsError | ForbiddenError | InternalServerError;
866
+ interface RoomJoinedSuccess {
867
+ room: {
868
+ mode: RoomMode;
869
+ isClaimed: boolean;
870
+ isLocked: boolean;
830
871
  clients: SignalClient[];
831
872
  knockers: SignalKnocker[];
832
873
  spotlights: Spotlight[];
@@ -836,10 +877,11 @@ interface RoomJoinedEvent {
836
877
  } | null;
837
878
  };
838
879
  selfId: string;
839
- breakoutGroup: string | null;
840
- clientClaim?: string;
880
+ breakoutGroup?: string | null;
881
+ clientClaim: string;
841
882
  breakout?: BreakoutConfig;
842
883
  }
884
+ type RoomJoinedEvent = RoomJoinedErrors | RoomJoinedSuccess;
843
885
  interface BreakoutSessionUpdatedEvent extends BreakoutConfig {
844
886
  }
845
887
  interface RoomKnockedEvent {
@@ -1663,4 +1705,4 @@ declare class RtcStream {
1663
1705
  static getTypeFromId(id: string): string;
1664
1706
  }
1665
1707
 
1666
- export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutConfig, type BreakoutGroupJoinedEvent, type BreakoutSessionUpdatedEvent, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Codec, 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, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDevice, 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, sortCodecs, type ssrcStats, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, turnServerOverride, variance };
1708
+ export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutConfig, type BreakoutGroupJoinedEvent, type BreakoutSessionUpdatedEvent, type CannotJoinUnclaimedRoomError, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Codec, type Credentials, type CustomMediaStreamTrack, EVENTS, type ForbiddenError, type ForbiddenErrorNames, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type HostPresenceControlsError, type IdentifyDeviceRequest, type InternalServerError, 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 MaxViewerLimitReachedError, type NewClientEvent, NoDevicesError, type OrganizationPlanExhaustedError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomConcurrencyControlsError, type RoomFullError, type RoomJoinedErrors, type RoomJoinedEvent, type RoomJoinedSuccess, type RoomKnockedEvent, type RoomLockedError, type RoomLockedEvent, type RoomMeetingTimeExhaustedError, type RoomMode, 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, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDevice, 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, sortCodecs, type ssrcStats, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, turnServerOverride, variance };
package/dist/index.mjs CHANGED
@@ -2686,10 +2686,10 @@ class ReconnectManager extends EventEmitter {
2686
2686
  socket.on(PROTOCOL_RESPONSES.SCREENSHARE_STOPPED, (payload) => this._onScreenshareChanged(payload, false));
2687
2687
  }
2688
2688
  _onRoomJoined(payload) {
2689
- var _a, _b;
2689
+ var _a;
2690
2690
  return __awaiter(this, void 0, void 0, function* () {
2691
2691
  this.reconnectThresholdInMs = (payload.disconnectTimeout || 0) * 0.8;
2692
- if (!((_a = payload.room) === null || _a === void 0 ? void 0 : _a.clients)) {
2692
+ if (payload === null || payload === void 0 ? void 0 : payload.error) {
2693
2693
  this.emit(PROTOCOL_RESPONSES.ROOM_JOINED, payload);
2694
2694
  return;
2695
2695
  }
@@ -2697,7 +2697,7 @@ class ReconnectManager extends EventEmitter {
2697
2697
  this.emit(PROTOCOL_RESPONSES.ROOM_JOINED, payload);
2698
2698
  return;
2699
2699
  }
2700
- const myDeviceId = (_b = payload.room.clients.find((c) => payload.selfId === c.id)) === null || _b === void 0 ? void 0 : _b.deviceId;
2700
+ const myDeviceId = (_a = payload.room.clients.find((c) => payload.selfId === c.id)) === null || _a === void 0 ? void 0 : _a.deviceId;
2701
2701
  if (!myDeviceId) {
2702
2702
  this.emit(PROTOCOL_RESPONSES.ROOM_JOINED, payload);
2703
2703
  return;
@@ -3344,7 +3344,12 @@ class P2pRtcManager {
3344
3344
  this._emit(rtcManagerEvents.PC_ON_ANSWER_FAILURE, e);
3345
3345
  });
3346
3346
  }),
3347
- this._serverSocket.on(PROTOCOL_RESPONSES.ROOM_JOINED, ({ room: { sfuServer: isSfu } }) => {
3347
+ this._serverSocket.on(PROTOCOL_RESPONSES.ROOM_JOINED, (payload) => {
3348
+ var _a, _b;
3349
+ if (payload === null || payload === void 0 ? void 0 : payload.error) {
3350
+ return;
3351
+ }
3352
+ const isSfu = (_b = (_a = payload === null || payload === void 0 ? void 0 : payload.room) === null || _a === void 0 ? void 0 : _a.sfuServer) !== null && _b !== void 0 ? _b : false;
3348
3353
  if (isSfu || !this._wasScreenSharing)
3349
3354
  return;
3350
3355
  const screenShareStreamId = Object.keys(this.localStreams).find((id) => id !== CAMERA_STREAM_ID);
@@ -5094,7 +5099,10 @@ class VegaRtcManager {
5094
5099
  return;
5095
5100
  }
5096
5101
  this._updateAndScheduleMediaServersRefresh(data);
5097
- }), this._serverSocket.on(PROTOCOL_RESPONSES.ROOM_JOINED, () => {
5102
+ }), this._serverSocket.on(PROTOCOL_RESPONSES.ROOM_JOINED, (payload) => {
5103
+ if (payload === null || payload === void 0 ? void 0 : payload.error) {
5104
+ return;
5105
+ }
5098
5106
  if (this._screenVideoTrack)
5099
5107
  this._emitScreenshareStarted();
5100
5108
  if (this._features.sfuReconnectV2On && !this._hasVegaConnection && this._reconnect) {
@@ -2686,10 +2686,10 @@ class ReconnectManager extends EventEmitter {
2686
2686
  socket.on(PROTOCOL_RESPONSES.SCREENSHARE_STOPPED, (payload) => this._onScreenshareChanged(payload, false));
2687
2687
  }
2688
2688
  _onRoomJoined(payload) {
2689
- var _a, _b;
2689
+ var _a;
2690
2690
  return __awaiter(this, void 0, void 0, function* () {
2691
2691
  this.reconnectThresholdInMs = (payload.disconnectTimeout || 0) * 0.8;
2692
- if (!((_a = payload.room) === null || _a === void 0 ? void 0 : _a.clients)) {
2692
+ if (payload === null || payload === void 0 ? void 0 : payload.error) {
2693
2693
  this.emit(PROTOCOL_RESPONSES.ROOM_JOINED, payload);
2694
2694
  return;
2695
2695
  }
@@ -2697,7 +2697,7 @@ class ReconnectManager extends EventEmitter {
2697
2697
  this.emit(PROTOCOL_RESPONSES.ROOM_JOINED, payload);
2698
2698
  return;
2699
2699
  }
2700
- const myDeviceId = (_b = payload.room.clients.find((c) => payload.selfId === c.id)) === null || _b === void 0 ? void 0 : _b.deviceId;
2700
+ const myDeviceId = (_a = payload.room.clients.find((c) => payload.selfId === c.id)) === null || _a === void 0 ? void 0 : _a.deviceId;
2701
2701
  if (!myDeviceId) {
2702
2702
  this.emit(PROTOCOL_RESPONSES.ROOM_JOINED, payload);
2703
2703
  return;
@@ -3344,7 +3344,12 @@ class P2pRtcManager {
3344
3344
  this._emit(rtcManagerEvents.PC_ON_ANSWER_FAILURE, e);
3345
3345
  });
3346
3346
  }),
3347
- this._serverSocket.on(PROTOCOL_RESPONSES.ROOM_JOINED, ({ room: { sfuServer: isSfu } }) => {
3347
+ this._serverSocket.on(PROTOCOL_RESPONSES.ROOM_JOINED, (payload) => {
3348
+ var _a, _b;
3349
+ if (payload === null || payload === void 0 ? void 0 : payload.error) {
3350
+ return;
3351
+ }
3352
+ const isSfu = (_b = (_a = payload === null || payload === void 0 ? void 0 : payload.room) === null || _a === void 0 ? void 0 : _a.sfuServer) !== null && _b !== void 0 ? _b : false;
3348
3353
  if (isSfu || !this._wasScreenSharing)
3349
3354
  return;
3350
3355
  const screenShareStreamId = Object.keys(this.localStreams).find((id) => id !== CAMERA_STREAM_ID);
@@ -5094,7 +5099,10 @@ class VegaRtcManager {
5094
5099
  return;
5095
5100
  }
5096
5101
  this._updateAndScheduleMediaServersRefresh(data);
5097
- }), this._serverSocket.on(PROTOCOL_RESPONSES.ROOM_JOINED, () => {
5102
+ }), this._serverSocket.on(PROTOCOL_RESPONSES.ROOM_JOINED, (payload) => {
5103
+ if (payload === null || payload === void 0 ? void 0 : payload.error) {
5104
+ return;
5105
+ }
5098
5106
  if (this._screenVideoTrack)
5099
5107
  this._emitScreenshareStarted();
5100
5108
  if (this._features.sfuReconnectV2On && !this._hasVegaConnection && this._reconnect) {
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.22.0",
4
+ "version": "1.23.0",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/whereby/sdk",
7
7
  "repository": {