@whereby.com/media 1.14.0 → 1.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1421,10 +1421,6 @@ class VegaConnection extends EventEmitter.EventEmitter {
1421
1421
  var _a;
1422
1422
  (_a = this.socket) === null || _a === void 0 ? void 0 : _a.close();
1423
1423
  }
1424
- isConnected() {
1425
- var _a, _b;
1426
- return ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === WebSocket.OPEN || ((_b = this.socket) === null || _b === void 0 ? void 0 : _b.readyState) === WebSocket.CONNECTING;
1427
- }
1428
1424
  _onOpen() {
1429
1425
  logger$9.info("Connected");
1430
1426
  this.emit("open");
@@ -5080,6 +5076,7 @@ class VegaRtcManager {
5080
5076
  this._socketListenerDeregisterFunctions = [];
5081
5077
  this._reconnect = true;
5082
5078
  this._reconnectTimeOut = null;
5079
+ this._hasVegaConnection = false;
5083
5080
  this._qualityMonitor = new VegaMediaQualityMonitor();
5084
5081
  this._qualityMonitor.on(PROTOCOL_EVENTS.MEDIA_QUALITY_CHANGED, (payload) => {
5085
5082
  this._emitToPWA(PROTOCOL_EVENTS.MEDIA_QUALITY_CHANGED, payload);
@@ -5114,7 +5111,7 @@ class VegaRtcManager {
5114
5111
  }), this._serverSocket.on(PROTOCOL_RESPONSES.ROOM_JOINED, () => {
5115
5112
  if (this._screenVideoTrack)
5116
5113
  this._emitScreenshareStarted();
5117
- if (this._features.sfuReconnectV2On && !this._vegaConnection.isConnected() && this._reconnect) {
5114
+ if (this._features.sfuReconnectV2On && !this._hasVegaConnection && this._reconnect) {
5118
5115
  this._connect();
5119
5116
  }
5120
5117
  }));
@@ -5128,6 +5125,8 @@ class VegaRtcManager {
5128
5125
  }
5129
5126
  _connect() {
5130
5127
  if (this._features.sfuReconnectV2On) {
5128
+ if (this._hasVegaConnection)
5129
+ return;
5131
5130
  if (!this._serverSocket.isConnected()) {
5132
5131
  const reconnectThresholdInMs = this._serverSocket.getReconnectThreshold();
5133
5132
  if (!reconnectThresholdInMs)
@@ -5145,6 +5144,7 @@ class VegaRtcManager {
5145
5144
  const queryString = searchParams.toString();
5146
5145
  const wsUrl = `wss://${host}?${queryString}`;
5147
5146
  this._vegaConnection = new VegaConnection(wsUrl);
5147
+ this._hasVegaConnection = true;
5148
5148
  this._vegaConnection.on("open", () => this._join());
5149
5149
  this._vegaConnection.on("close", () => this._onClose());
5150
5150
  this._vegaConnection.on("message", (message) => this._onMessage(message));
@@ -5152,6 +5152,7 @@ class VegaRtcManager {
5152
5152
  _onClose() {
5153
5153
  var _a, _b;
5154
5154
  logger$1.info("_onClose()");
5155
+ this._hasVegaConnection = false;
5155
5156
  (_a = this._sendTransport) === null || _a === void 0 ? void 0 : _a.close();
5156
5157
  (_b = this._receiveTransport) === null || _b === void 0 ? void 0 : _b.close();
5157
5158
  this._sendTransport = null;
@@ -5848,7 +5849,7 @@ class VegaRtcManager {
5848
5849
  if (!videoTrack.effectTrack) {
5849
5850
  this._monitorVideoTrack(videoTrack);
5850
5851
  }
5851
- const beforeEffectTrack = beforeEffectTracks.find(t => t.kind === "video");
5852
+ const beforeEffectTrack = beforeEffectTracks.find((t) => t.kind === "video");
5852
5853
  if (beforeEffectTrack) {
5853
5854
  this._monitorVideoTrack(beforeEffectTrack);
5854
5855
  }
@@ -5859,7 +5860,7 @@ class VegaRtcManager {
5859
5860
  if (!audioTrack.effectTrack) {
5860
5861
  this._monitorAudioTrack(audioTrack);
5861
5862
  }
5862
- const beforeEffectTrack = beforeEffectTracks.find(t => t.kind === "audio");
5863
+ const beforeEffectTrack = beforeEffectTracks.find((t) => t.kind === "audio");
5863
5864
  if (beforeEffectTrack) {
5864
5865
  this._monitorAudioTrack(beforeEffectTrack);
5865
5866
  }
@@ -5930,7 +5931,9 @@ class VegaRtcManager {
5930
5931
  }
5931
5932
  if (!enable) {
5932
5933
  clearTimeout(this._stopCameraTimeout);
5933
- const stopCameraDelay = ((_a = localStream.getVideoTracks().find((t) => !t.enabled)) === null || _a === void 0 ? void 0 : _a.readyState) === "ended" ? 0 : 5000;
5934
+ const stopCameraDelay = ((_a = localStream.getVideoTracks().find((t) => !t.enabled)) === null || _a === void 0 ? void 0 : _a.readyState) === "ended"
5935
+ ? 0
5936
+ : 5000;
5934
5937
  this._stopCameraTimeout = setTimeout(() => {
5935
5938
  localStream.getVideoTracks().forEach((track) => {
5936
5939
  if (track.enabled === false) {
package/dist/index.d.cts CHANGED
@@ -442,6 +442,10 @@ interface AudioEnableRequestedEvent {
442
442
  requestedByClientId: string;
443
443
  enable: boolean;
444
444
  }
445
+ interface VideoEnableRequestedEvent {
446
+ requestedByClientId: string;
447
+ enable: boolean;
448
+ }
445
449
  interface SpotlightAddedEvent {
446
450
  clientId: string;
447
451
  streamId: string;
@@ -487,6 +491,7 @@ interface SignalEvents {
487
491
  spotlight_removed: SpotlightRemovedEvent;
488
492
  streaming_stopped: void;
489
493
  video_enabled: VideoEnabledEvent;
494
+ video_enable_requested: VideoEnableRequestedEvent;
490
495
  live_transcription_started: LiveTranscriptionStartedEvent;
491
496
  live_transcription_stopped: LiveTranscriptionStoppedEvent;
492
497
  }
@@ -520,6 +525,10 @@ interface AudioEnableRequest {
520
525
  clientIds: string[];
521
526
  enable: boolean;
522
527
  }
528
+ interface VideoEnableRequest {
529
+ clientIds: string[];
530
+ enable: boolean;
531
+ }
523
532
  interface AddSpotlightRequest {
524
533
  clientId: string;
525
534
  streamId: string;
@@ -550,6 +559,7 @@ interface SignalRequests {
550
559
  leave_room: void;
551
560
  remove_spotlight: RemoveSpotlightRequest;
552
561
  request_audio_enable: AudioEnableRequest;
562
+ request_video_enable: VideoEnableRequest;
553
563
  send_client_metadata: {
554
564
  type: string;
555
565
  payload: {
@@ -1080,7 +1090,6 @@ declare class VegaConnection extends EventEmitter$1 {
1080
1090
  _setupSocket(): void;
1081
1091
  _tearDown(): void;
1082
1092
  close(): void;
1083
- isConnected(): boolean;
1084
1093
  _onOpen(): void;
1085
1094
  _onMessage(event: MessageEvent): void;
1086
1095
  _onClose(): void;
@@ -1208,6 +1217,7 @@ declare class VegaRtcManager implements RtcManager {
1208
1217
  _mediaserverConfigTtlSeconds: any;
1209
1218
  _videoTrackBeingMonitored?: CustomMediaStreamTrack;
1210
1219
  _audioTrackBeingMonitored?: CustomMediaStreamTrack;
1220
+ _hasVegaConnection: boolean;
1211
1221
  constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, eventClaim, deviceHandlerFactory, }: {
1212
1222
  selfId: any;
1213
1223
  room: any;
@@ -1491,4 +1501,4 @@ declare class RtcStream {
1491
1501
  static getTypeFromId(id: string): string;
1492
1502
  }
1493
1503
 
1494
- export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type 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, TYPES, type TurnTransportProtocol, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnabledEvent, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getStream2, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
1504
+ export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type 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, TYPES, type TurnTransportProtocol, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnableRequest, type VideoEnableRequestedEvent, type VideoEnabledEvent, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getStream2, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
package/dist/index.d.mts CHANGED
@@ -442,6 +442,10 @@ interface AudioEnableRequestedEvent {
442
442
  requestedByClientId: string;
443
443
  enable: boolean;
444
444
  }
445
+ interface VideoEnableRequestedEvent {
446
+ requestedByClientId: string;
447
+ enable: boolean;
448
+ }
445
449
  interface SpotlightAddedEvent {
446
450
  clientId: string;
447
451
  streamId: string;
@@ -487,6 +491,7 @@ interface SignalEvents {
487
491
  spotlight_removed: SpotlightRemovedEvent;
488
492
  streaming_stopped: void;
489
493
  video_enabled: VideoEnabledEvent;
494
+ video_enable_requested: VideoEnableRequestedEvent;
490
495
  live_transcription_started: LiveTranscriptionStartedEvent;
491
496
  live_transcription_stopped: LiveTranscriptionStoppedEvent;
492
497
  }
@@ -520,6 +525,10 @@ interface AudioEnableRequest {
520
525
  clientIds: string[];
521
526
  enable: boolean;
522
527
  }
528
+ interface VideoEnableRequest {
529
+ clientIds: string[];
530
+ enable: boolean;
531
+ }
523
532
  interface AddSpotlightRequest {
524
533
  clientId: string;
525
534
  streamId: string;
@@ -550,6 +559,7 @@ interface SignalRequests {
550
559
  leave_room: void;
551
560
  remove_spotlight: RemoveSpotlightRequest;
552
561
  request_audio_enable: AudioEnableRequest;
562
+ request_video_enable: VideoEnableRequest;
553
563
  send_client_metadata: {
554
564
  type: string;
555
565
  payload: {
@@ -1080,7 +1090,6 @@ declare class VegaConnection extends EventEmitter$1 {
1080
1090
  _setupSocket(): void;
1081
1091
  _tearDown(): void;
1082
1092
  close(): void;
1083
- isConnected(): boolean;
1084
1093
  _onOpen(): void;
1085
1094
  _onMessage(event: MessageEvent): void;
1086
1095
  _onClose(): void;
@@ -1208,6 +1217,7 @@ declare class VegaRtcManager implements RtcManager {
1208
1217
  _mediaserverConfigTtlSeconds: any;
1209
1218
  _videoTrackBeingMonitored?: CustomMediaStreamTrack;
1210
1219
  _audioTrackBeingMonitored?: CustomMediaStreamTrack;
1220
+ _hasVegaConnection: boolean;
1211
1221
  constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, eventClaim, deviceHandlerFactory, }: {
1212
1222
  selfId: any;
1213
1223
  room: any;
@@ -1491,4 +1501,4 @@ declare class RtcStream {
1491
1501
  static getTypeFromId(id: string): string;
1492
1502
  }
1493
1503
 
1494
- export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type 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, TYPES, type TurnTransportProtocol, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnabledEvent, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getStream2, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
1504
+ export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type 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, TYPES, type TurnTransportProtocol, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnableRequest, type VideoEnableRequestedEvent, type VideoEnabledEvent, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getStream2, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
package/dist/index.d.ts CHANGED
@@ -442,6 +442,10 @@ interface AudioEnableRequestedEvent {
442
442
  requestedByClientId: string;
443
443
  enable: boolean;
444
444
  }
445
+ interface VideoEnableRequestedEvent {
446
+ requestedByClientId: string;
447
+ enable: boolean;
448
+ }
445
449
  interface SpotlightAddedEvent {
446
450
  clientId: string;
447
451
  streamId: string;
@@ -487,6 +491,7 @@ interface SignalEvents {
487
491
  spotlight_removed: SpotlightRemovedEvent;
488
492
  streaming_stopped: void;
489
493
  video_enabled: VideoEnabledEvent;
494
+ video_enable_requested: VideoEnableRequestedEvent;
490
495
  live_transcription_started: LiveTranscriptionStartedEvent;
491
496
  live_transcription_stopped: LiveTranscriptionStoppedEvent;
492
497
  }
@@ -520,6 +525,10 @@ interface AudioEnableRequest {
520
525
  clientIds: string[];
521
526
  enable: boolean;
522
527
  }
528
+ interface VideoEnableRequest {
529
+ clientIds: string[];
530
+ enable: boolean;
531
+ }
523
532
  interface AddSpotlightRequest {
524
533
  clientId: string;
525
534
  streamId: string;
@@ -550,6 +559,7 @@ interface SignalRequests {
550
559
  leave_room: void;
551
560
  remove_spotlight: RemoveSpotlightRequest;
552
561
  request_audio_enable: AudioEnableRequest;
562
+ request_video_enable: VideoEnableRequest;
553
563
  send_client_metadata: {
554
564
  type: string;
555
565
  payload: {
@@ -1080,7 +1090,6 @@ declare class VegaConnection extends EventEmitter$1 {
1080
1090
  _setupSocket(): void;
1081
1091
  _tearDown(): void;
1082
1092
  close(): void;
1083
- isConnected(): boolean;
1084
1093
  _onOpen(): void;
1085
1094
  _onMessage(event: MessageEvent): void;
1086
1095
  _onClose(): void;
@@ -1208,6 +1217,7 @@ declare class VegaRtcManager implements RtcManager {
1208
1217
  _mediaserverConfigTtlSeconds: any;
1209
1218
  _videoTrackBeingMonitored?: CustomMediaStreamTrack;
1210
1219
  _audioTrackBeingMonitored?: CustomMediaStreamTrack;
1220
+ _hasVegaConnection: boolean;
1211
1221
  constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, eventClaim, deviceHandlerFactory, }: {
1212
1222
  selfId: any;
1213
1223
  room: any;
@@ -1491,4 +1501,4 @@ declare class RtcStream {
1491
1501
  static getTypeFromId(id: string): string;
1492
1502
  }
1493
1503
 
1494
- export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type 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, TYPES, type TurnTransportProtocol, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnabledEvent, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getStream2, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
1504
+ export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type 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, TYPES, type TurnTransportProtocol, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnableRequest, type VideoEnableRequestedEvent, type VideoEnabledEvent, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getStream2, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
package/dist/index.mjs CHANGED
@@ -1400,10 +1400,6 @@ class VegaConnection extends EventEmitter {
1400
1400
  var _a;
1401
1401
  (_a = this.socket) === null || _a === void 0 ? void 0 : _a.close();
1402
1402
  }
1403
- isConnected() {
1404
- var _a, _b;
1405
- return ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === WebSocket.OPEN || ((_b = this.socket) === null || _b === void 0 ? void 0 : _b.readyState) === WebSocket.CONNECTING;
1406
- }
1407
1403
  _onOpen() {
1408
1404
  logger$9.info("Connected");
1409
1405
  this.emit("open");
@@ -5059,6 +5055,7 @@ class VegaRtcManager {
5059
5055
  this._socketListenerDeregisterFunctions = [];
5060
5056
  this._reconnect = true;
5061
5057
  this._reconnectTimeOut = null;
5058
+ this._hasVegaConnection = false;
5062
5059
  this._qualityMonitor = new VegaMediaQualityMonitor();
5063
5060
  this._qualityMonitor.on(PROTOCOL_EVENTS.MEDIA_QUALITY_CHANGED, (payload) => {
5064
5061
  this._emitToPWA(PROTOCOL_EVENTS.MEDIA_QUALITY_CHANGED, payload);
@@ -5093,7 +5090,7 @@ class VegaRtcManager {
5093
5090
  }), this._serverSocket.on(PROTOCOL_RESPONSES.ROOM_JOINED, () => {
5094
5091
  if (this._screenVideoTrack)
5095
5092
  this._emitScreenshareStarted();
5096
- if (this._features.sfuReconnectV2On && !this._vegaConnection.isConnected() && this._reconnect) {
5093
+ if (this._features.sfuReconnectV2On && !this._hasVegaConnection && this._reconnect) {
5097
5094
  this._connect();
5098
5095
  }
5099
5096
  }));
@@ -5107,6 +5104,8 @@ class VegaRtcManager {
5107
5104
  }
5108
5105
  _connect() {
5109
5106
  if (this._features.sfuReconnectV2On) {
5107
+ if (this._hasVegaConnection)
5108
+ return;
5110
5109
  if (!this._serverSocket.isConnected()) {
5111
5110
  const reconnectThresholdInMs = this._serverSocket.getReconnectThreshold();
5112
5111
  if (!reconnectThresholdInMs)
@@ -5124,6 +5123,7 @@ class VegaRtcManager {
5124
5123
  const queryString = searchParams.toString();
5125
5124
  const wsUrl = `wss://${host}?${queryString}`;
5126
5125
  this._vegaConnection = new VegaConnection(wsUrl);
5126
+ this._hasVegaConnection = true;
5127
5127
  this._vegaConnection.on("open", () => this._join());
5128
5128
  this._vegaConnection.on("close", () => this._onClose());
5129
5129
  this._vegaConnection.on("message", (message) => this._onMessage(message));
@@ -5131,6 +5131,7 @@ class VegaRtcManager {
5131
5131
  _onClose() {
5132
5132
  var _a, _b;
5133
5133
  logger$1.info("_onClose()");
5134
+ this._hasVegaConnection = false;
5134
5135
  (_a = this._sendTransport) === null || _a === void 0 ? void 0 : _a.close();
5135
5136
  (_b = this._receiveTransport) === null || _b === void 0 ? void 0 : _b.close();
5136
5137
  this._sendTransport = null;
@@ -5827,7 +5828,7 @@ class VegaRtcManager {
5827
5828
  if (!videoTrack.effectTrack) {
5828
5829
  this._monitorVideoTrack(videoTrack);
5829
5830
  }
5830
- const beforeEffectTrack = beforeEffectTracks.find(t => t.kind === "video");
5831
+ const beforeEffectTrack = beforeEffectTracks.find((t) => t.kind === "video");
5831
5832
  if (beforeEffectTrack) {
5832
5833
  this._monitorVideoTrack(beforeEffectTrack);
5833
5834
  }
@@ -5838,7 +5839,7 @@ class VegaRtcManager {
5838
5839
  if (!audioTrack.effectTrack) {
5839
5840
  this._monitorAudioTrack(audioTrack);
5840
5841
  }
5841
- const beforeEffectTrack = beforeEffectTracks.find(t => t.kind === "audio");
5842
+ const beforeEffectTrack = beforeEffectTracks.find((t) => t.kind === "audio");
5842
5843
  if (beforeEffectTrack) {
5843
5844
  this._monitorAudioTrack(beforeEffectTrack);
5844
5845
  }
@@ -5909,7 +5910,9 @@ class VegaRtcManager {
5909
5910
  }
5910
5911
  if (!enable) {
5911
5912
  clearTimeout(this._stopCameraTimeout);
5912
- const stopCameraDelay = ((_a = localStream.getVideoTracks().find((t) => !t.enabled)) === null || _a === void 0 ? void 0 : _a.readyState) === "ended" ? 0 : 5000;
5913
+ const stopCameraDelay = ((_a = localStream.getVideoTracks().find((t) => !t.enabled)) === null || _a === void 0 ? void 0 : _a.readyState) === "ended"
5914
+ ? 0
5915
+ : 5000;
5913
5916
  this._stopCameraTimeout = setTimeout(() => {
5914
5917
  localStream.getVideoTracks().forEach((track) => {
5915
5918
  if (track.enabled === false) {
@@ -1400,10 +1400,6 @@ class VegaConnection extends EventEmitter {
1400
1400
  var _a;
1401
1401
  (_a = this.socket) === null || _a === void 0 ? void 0 : _a.close();
1402
1402
  }
1403
- isConnected() {
1404
- var _a, _b;
1405
- return ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === WebSocket.OPEN || ((_b = this.socket) === null || _b === void 0 ? void 0 : _b.readyState) === WebSocket.CONNECTING;
1406
- }
1407
1403
  _onOpen() {
1408
1404
  logger$9.info("Connected");
1409
1405
  this.emit("open");
@@ -5059,6 +5055,7 @@ class VegaRtcManager {
5059
5055
  this._socketListenerDeregisterFunctions = [];
5060
5056
  this._reconnect = true;
5061
5057
  this._reconnectTimeOut = null;
5058
+ this._hasVegaConnection = false;
5062
5059
  this._qualityMonitor = new VegaMediaQualityMonitor();
5063
5060
  this._qualityMonitor.on(PROTOCOL_EVENTS.MEDIA_QUALITY_CHANGED, (payload) => {
5064
5061
  this._emitToPWA(PROTOCOL_EVENTS.MEDIA_QUALITY_CHANGED, payload);
@@ -5093,7 +5090,7 @@ class VegaRtcManager {
5093
5090
  }), this._serverSocket.on(PROTOCOL_RESPONSES.ROOM_JOINED, () => {
5094
5091
  if (this._screenVideoTrack)
5095
5092
  this._emitScreenshareStarted();
5096
- if (this._features.sfuReconnectV2On && !this._vegaConnection.isConnected() && this._reconnect) {
5093
+ if (this._features.sfuReconnectV2On && !this._hasVegaConnection && this._reconnect) {
5097
5094
  this._connect();
5098
5095
  }
5099
5096
  }));
@@ -5107,6 +5104,8 @@ class VegaRtcManager {
5107
5104
  }
5108
5105
  _connect() {
5109
5106
  if (this._features.sfuReconnectV2On) {
5107
+ if (this._hasVegaConnection)
5108
+ return;
5110
5109
  if (!this._serverSocket.isConnected()) {
5111
5110
  const reconnectThresholdInMs = this._serverSocket.getReconnectThreshold();
5112
5111
  if (!reconnectThresholdInMs)
@@ -5124,6 +5123,7 @@ class VegaRtcManager {
5124
5123
  const queryString = searchParams.toString();
5125
5124
  const wsUrl = `wss://${host}?${queryString}`;
5126
5125
  this._vegaConnection = new VegaConnection(wsUrl);
5126
+ this._hasVegaConnection = true;
5127
5127
  this._vegaConnection.on("open", () => this._join());
5128
5128
  this._vegaConnection.on("close", () => this._onClose());
5129
5129
  this._vegaConnection.on("message", (message) => this._onMessage(message));
@@ -5131,6 +5131,7 @@ class VegaRtcManager {
5131
5131
  _onClose() {
5132
5132
  var _a, _b;
5133
5133
  logger$1.info("_onClose()");
5134
+ this._hasVegaConnection = false;
5134
5135
  (_a = this._sendTransport) === null || _a === void 0 ? void 0 : _a.close();
5135
5136
  (_b = this._receiveTransport) === null || _b === void 0 ? void 0 : _b.close();
5136
5137
  this._sendTransport = null;
@@ -5827,7 +5828,7 @@ class VegaRtcManager {
5827
5828
  if (!videoTrack.effectTrack) {
5828
5829
  this._monitorVideoTrack(videoTrack);
5829
5830
  }
5830
- const beforeEffectTrack = beforeEffectTracks.find(t => t.kind === "video");
5831
+ const beforeEffectTrack = beforeEffectTracks.find((t) => t.kind === "video");
5831
5832
  if (beforeEffectTrack) {
5832
5833
  this._monitorVideoTrack(beforeEffectTrack);
5833
5834
  }
@@ -5838,7 +5839,7 @@ class VegaRtcManager {
5838
5839
  if (!audioTrack.effectTrack) {
5839
5840
  this._monitorAudioTrack(audioTrack);
5840
5841
  }
5841
- const beforeEffectTrack = beforeEffectTracks.find(t => t.kind === "audio");
5842
+ const beforeEffectTrack = beforeEffectTracks.find((t) => t.kind === "audio");
5842
5843
  if (beforeEffectTrack) {
5843
5844
  this._monitorAudioTrack(beforeEffectTrack);
5844
5845
  }
@@ -5909,7 +5910,9 @@ class VegaRtcManager {
5909
5910
  }
5910
5911
  if (!enable) {
5911
5912
  clearTimeout(this._stopCameraTimeout);
5912
- const stopCameraDelay = ((_a = localStream.getVideoTracks().find((t) => !t.enabled)) === null || _a === void 0 ? void 0 : _a.readyState) === "ended" ? 0 : 5000;
5913
+ const stopCameraDelay = ((_a = localStream.getVideoTracks().find((t) => !t.enabled)) === null || _a === void 0 ? void 0 : _a.readyState) === "ended"
5914
+ ? 0
5915
+ : 5000;
5913
5916
  this._stopCameraTimeout = setTimeout(() => {
5914
5917
  localStream.getVideoTracks().forEach((track) => {
5915
5918
  if (track.enabled === false) {
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.14.0",
4
+ "version": "1.14.2",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/whereby/sdk",
7
7
  "repository": {