@whereby.com/media 1.6.5 → 1.8.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
@@ -3290,6 +3290,8 @@ const PROTOCOL_RESPONSES = {
3290
3290
  USER_NOTIFIED: "user_notified",
3291
3291
  VIDEO_ENABLED: "video_enabled",
3292
3292
  CLIENT_UNABLE_TO_JOIN: "client_unable_to_join",
3293
+ LIVE_TRANSCRIPTION_STARTED: "live_transcription_started",
3294
+ LIVE_TRANSCRIPTION_STOPPED: "live_transcription_stopped",
3293
3295
  };
3294
3296
  const PROTOCOL_ERRORS = {
3295
3297
  CANNOT_INVITE_YOURSELF: "cannot_invite_yourself",
@@ -5463,14 +5465,18 @@ class VegaRtcManager {
5463
5465
  }
5464
5466
  }
5465
5467
  _internalSendWebcam() {
5468
+ var _a;
5466
5469
  return __awaiter(this, void 0, void 0, function* () {
5467
5470
  logger$1.info("_internalSendWebcam()");
5471
+ if (!this._sendTransport ||
5472
+ this._webcamProducer ||
5473
+ this._webcamProducerPromise ||
5474
+ ((_a = this._webcamTrack) === null || _a === void 0 ? void 0 : _a.readyState) !== "live") {
5475
+ return;
5476
+ }
5468
5477
  this._webcamProducerPromise = (() => __awaiter(this, void 0, void 0, function* () {
5478
+ var _b;
5469
5479
  try {
5470
- if (!this._webcamTrack || !this._sendTransport || this._webcamProducer) {
5471
- this._webcamProducerPromise = null;
5472
- return;
5473
- }
5474
5480
  const currentPaused = this._webcamPaused;
5475
5481
  const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._webcamTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("video", false, this._features)), { appData: {
5476
5482
  streamId: OUTBOUND_CAM_OUTBOUND_STREAM_ID,
@@ -5491,8 +5497,10 @@ class VegaRtcManager {
5491
5497
  this._webcamProducerPromise = null;
5492
5498
  this._qualityMonitor.removeProducer(this._selfId, producer.id);
5493
5499
  });
5494
- if (this._webcamTrack !== this._webcamProducer.track)
5495
- yield this._replaceWebcamTrack();
5500
+ if (this._webcamTrack && this._webcamTrack !== ((_b = this._webcamProducer) === null || _b === void 0 ? void 0 : _b.track)) {
5501
+ this._webcamProducerPromise = null;
5502
+ this._replaceWebcamTrack();
5503
+ }
5496
5504
  if (this._webcamPaused !== this._webcamProducer.paused)
5497
5505
  this._pauseResumeWebcam();
5498
5506
  }
@@ -5502,7 +5510,7 @@ class VegaRtcManager {
5502
5510
  finally {
5503
5511
  this._webcamProducerPromise = null;
5504
5512
  if (!this._webcamTrack) {
5505
- yield this._stopProducer(this._webcamProducer);
5513
+ this._stopProducer(this._webcamProducer);
5506
5514
  this._webcamProducer = null;
5507
5515
  }
5508
5516
  }
@@ -5512,8 +5520,12 @@ class VegaRtcManager {
5512
5520
  _replaceWebcamTrack() {
5513
5521
  return __awaiter(this, void 0, void 0, function* () {
5514
5522
  logger$1.info("_replaceWebcamTrack()");
5515
- if (!this._webcamTrack || !this._webcamProducer || this._webcamProducer.closed)
5523
+ if (!this._sendTransport || !this._webcamTrack || this._webcamProducerPromise)
5516
5524
  return;
5525
+ if (!this._webcamProducer && this._webcamTrack.enabled) {
5526
+ yield this._internalSendWebcam();
5527
+ return;
5528
+ }
5517
5529
  if (this._webcamProducer.track !== this._webcamTrack) {
5518
5530
  yield this._webcamProducer.replaceTrack({ track: this._webcamTrack });
5519
5531
  yield this._replaceWebcamTrack();
package/dist/index.d.cts CHANGED
@@ -582,6 +582,7 @@ interface SignalClient {
582
582
  role: ClientRole;
583
583
  startedCloudRecordingAt: string | null;
584
584
  externalId: string | null;
585
+ isDialIn: boolean;
585
586
  }
586
587
  interface Spotlight {
587
588
  clientId: string;
@@ -705,6 +706,13 @@ interface SpotlightRemovedEvent {
705
706
  streamId: string;
706
707
  requestedByClientId: string;
707
708
  }
709
+ interface LiveTranscriptionStartedEvent {
710
+ startedAt: string;
711
+ transcriptionId: string;
712
+ }
713
+ interface LiveTranscriptionStoppedEvent {
714
+ transcriptionId: string;
715
+ }
708
716
  interface SignalEvents {
709
717
  audio_enabled: AudioEnabledEvent;
710
718
  audio_enable_requested: AudioEnableRequestedEvent;
@@ -732,6 +740,8 @@ interface SignalEvents {
732
740
  spotlight_removed: SpotlightRemovedEvent;
733
741
  streaming_stopped: void;
734
742
  video_enabled: VideoEnabledEvent;
743
+ live_transcription_started: LiveTranscriptionStartedEvent;
744
+ live_transcription_stopped: LiveTranscriptionStoppedEvent;
735
745
  }
736
746
  interface IdentifyDeviceRequest {
737
747
  deviceCredentials: Credentials;
@@ -986,7 +996,7 @@ declare class VegaConnection extends EventEmitter$1 {
986
996
  _tearDown(): void;
987
997
  close(): void;
988
998
  _onOpen(): void;
989
- _onMessage(event: any): void;
999
+ _onMessage(event: MessageEvent): void;
990
1000
  _onClose(): void;
991
1001
  _onError(error: any): void;
992
1002
  _handleResponse(socketMessage: any): void;
@@ -1318,6 +1328,8 @@ declare const PROTOCOL_RESPONSES: {
1318
1328
  USER_NOTIFIED: string;
1319
1329
  VIDEO_ENABLED: string;
1320
1330
  CLIENT_UNABLE_TO_JOIN: string;
1331
+ LIVE_TRANSCRIPTION_STARTED: string;
1332
+ LIVE_TRANSCRIPTION_STOPPED: string;
1321
1333
  };
1322
1334
  declare const PROTOCOL_ERRORS: {
1323
1335
  CANNOT_INVITE_YOURSELF: string;
@@ -1394,4 +1406,4 @@ declare class RtcStream {
1394
1406
  static getTypeFromId(id: string): string;
1395
1407
  }
1396
1408
 
1397
- export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, 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, 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 };
1409
+ export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, 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, 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 };
package/dist/index.d.mts CHANGED
@@ -582,6 +582,7 @@ interface SignalClient {
582
582
  role: ClientRole;
583
583
  startedCloudRecordingAt: string | null;
584
584
  externalId: string | null;
585
+ isDialIn: boolean;
585
586
  }
586
587
  interface Spotlight {
587
588
  clientId: string;
@@ -705,6 +706,13 @@ interface SpotlightRemovedEvent {
705
706
  streamId: string;
706
707
  requestedByClientId: string;
707
708
  }
709
+ interface LiveTranscriptionStartedEvent {
710
+ startedAt: string;
711
+ transcriptionId: string;
712
+ }
713
+ interface LiveTranscriptionStoppedEvent {
714
+ transcriptionId: string;
715
+ }
708
716
  interface SignalEvents {
709
717
  audio_enabled: AudioEnabledEvent;
710
718
  audio_enable_requested: AudioEnableRequestedEvent;
@@ -732,6 +740,8 @@ interface SignalEvents {
732
740
  spotlight_removed: SpotlightRemovedEvent;
733
741
  streaming_stopped: void;
734
742
  video_enabled: VideoEnabledEvent;
743
+ live_transcription_started: LiveTranscriptionStartedEvent;
744
+ live_transcription_stopped: LiveTranscriptionStoppedEvent;
735
745
  }
736
746
  interface IdentifyDeviceRequest {
737
747
  deviceCredentials: Credentials;
@@ -986,7 +996,7 @@ declare class VegaConnection extends EventEmitter$1 {
986
996
  _tearDown(): void;
987
997
  close(): void;
988
998
  _onOpen(): void;
989
- _onMessage(event: any): void;
999
+ _onMessage(event: MessageEvent): void;
990
1000
  _onClose(): void;
991
1001
  _onError(error: any): void;
992
1002
  _handleResponse(socketMessage: any): void;
@@ -1318,6 +1328,8 @@ declare const PROTOCOL_RESPONSES: {
1318
1328
  USER_NOTIFIED: string;
1319
1329
  VIDEO_ENABLED: string;
1320
1330
  CLIENT_UNABLE_TO_JOIN: string;
1331
+ LIVE_TRANSCRIPTION_STARTED: string;
1332
+ LIVE_TRANSCRIPTION_STOPPED: string;
1321
1333
  };
1322
1334
  declare const PROTOCOL_ERRORS: {
1323
1335
  CANNOT_INVITE_YOURSELF: string;
@@ -1394,4 +1406,4 @@ declare class RtcStream {
1394
1406
  static getTypeFromId(id: string): string;
1395
1407
  }
1396
1408
 
1397
- export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, 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, 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 };
1409
+ export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, 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, 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 };
package/dist/index.d.ts CHANGED
@@ -582,6 +582,7 @@ interface SignalClient {
582
582
  role: ClientRole;
583
583
  startedCloudRecordingAt: string | null;
584
584
  externalId: string | null;
585
+ isDialIn: boolean;
585
586
  }
586
587
  interface Spotlight {
587
588
  clientId: string;
@@ -705,6 +706,13 @@ interface SpotlightRemovedEvent {
705
706
  streamId: string;
706
707
  requestedByClientId: string;
707
708
  }
709
+ interface LiveTranscriptionStartedEvent {
710
+ startedAt: string;
711
+ transcriptionId: string;
712
+ }
713
+ interface LiveTranscriptionStoppedEvent {
714
+ transcriptionId: string;
715
+ }
708
716
  interface SignalEvents {
709
717
  audio_enabled: AudioEnabledEvent;
710
718
  audio_enable_requested: AudioEnableRequestedEvent;
@@ -732,6 +740,8 @@ interface SignalEvents {
732
740
  spotlight_removed: SpotlightRemovedEvent;
733
741
  streaming_stopped: void;
734
742
  video_enabled: VideoEnabledEvent;
743
+ live_transcription_started: LiveTranscriptionStartedEvent;
744
+ live_transcription_stopped: LiveTranscriptionStoppedEvent;
735
745
  }
736
746
  interface IdentifyDeviceRequest {
737
747
  deviceCredentials: Credentials;
@@ -986,7 +996,7 @@ declare class VegaConnection extends EventEmitter$1 {
986
996
  _tearDown(): void;
987
997
  close(): void;
988
998
  _onOpen(): void;
989
- _onMessage(event: any): void;
999
+ _onMessage(event: MessageEvent): void;
990
1000
  _onClose(): void;
991
1001
  _onError(error: any): void;
992
1002
  _handleResponse(socketMessage: any): void;
@@ -1318,6 +1328,8 @@ declare const PROTOCOL_RESPONSES: {
1318
1328
  USER_NOTIFIED: string;
1319
1329
  VIDEO_ENABLED: string;
1320
1330
  CLIENT_UNABLE_TO_JOIN: string;
1331
+ LIVE_TRANSCRIPTION_STARTED: string;
1332
+ LIVE_TRANSCRIPTION_STOPPED: string;
1321
1333
  };
1322
1334
  declare const PROTOCOL_ERRORS: {
1323
1335
  CANNOT_INVITE_YOURSELF: string;
@@ -1394,4 +1406,4 @@ declare class RtcStream {
1394
1406
  static getTypeFromId(id: string): string;
1395
1407
  }
1396
1408
 
1397
- export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, 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, 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 };
1409
+ export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, 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, 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 };
package/dist/index.mjs CHANGED
@@ -3269,6 +3269,8 @@ const PROTOCOL_RESPONSES = {
3269
3269
  USER_NOTIFIED: "user_notified",
3270
3270
  VIDEO_ENABLED: "video_enabled",
3271
3271
  CLIENT_UNABLE_TO_JOIN: "client_unable_to_join",
3272
+ LIVE_TRANSCRIPTION_STARTED: "live_transcription_started",
3273
+ LIVE_TRANSCRIPTION_STOPPED: "live_transcription_stopped",
3272
3274
  };
3273
3275
  const PROTOCOL_ERRORS = {
3274
3276
  CANNOT_INVITE_YOURSELF: "cannot_invite_yourself",
@@ -5442,14 +5444,18 @@ class VegaRtcManager {
5442
5444
  }
5443
5445
  }
5444
5446
  _internalSendWebcam() {
5447
+ var _a;
5445
5448
  return __awaiter(this, void 0, void 0, function* () {
5446
5449
  logger$1.info("_internalSendWebcam()");
5450
+ if (!this._sendTransport ||
5451
+ this._webcamProducer ||
5452
+ this._webcamProducerPromise ||
5453
+ ((_a = this._webcamTrack) === null || _a === void 0 ? void 0 : _a.readyState) !== "live") {
5454
+ return;
5455
+ }
5447
5456
  this._webcamProducerPromise = (() => __awaiter(this, void 0, void 0, function* () {
5457
+ var _b;
5448
5458
  try {
5449
- if (!this._webcamTrack || !this._sendTransport || this._webcamProducer) {
5450
- this._webcamProducerPromise = null;
5451
- return;
5452
- }
5453
5459
  const currentPaused = this._webcamPaused;
5454
5460
  const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._webcamTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("video", false, this._features)), { appData: {
5455
5461
  streamId: OUTBOUND_CAM_OUTBOUND_STREAM_ID,
@@ -5470,8 +5476,10 @@ class VegaRtcManager {
5470
5476
  this._webcamProducerPromise = null;
5471
5477
  this._qualityMonitor.removeProducer(this._selfId, producer.id);
5472
5478
  });
5473
- if (this._webcamTrack !== this._webcamProducer.track)
5474
- yield this._replaceWebcamTrack();
5479
+ if (this._webcamTrack && this._webcamTrack !== ((_b = this._webcamProducer) === null || _b === void 0 ? void 0 : _b.track)) {
5480
+ this._webcamProducerPromise = null;
5481
+ this._replaceWebcamTrack();
5482
+ }
5475
5483
  if (this._webcamPaused !== this._webcamProducer.paused)
5476
5484
  this._pauseResumeWebcam();
5477
5485
  }
@@ -5481,7 +5489,7 @@ class VegaRtcManager {
5481
5489
  finally {
5482
5490
  this._webcamProducerPromise = null;
5483
5491
  if (!this._webcamTrack) {
5484
- yield this._stopProducer(this._webcamProducer);
5492
+ this._stopProducer(this._webcamProducer);
5485
5493
  this._webcamProducer = null;
5486
5494
  }
5487
5495
  }
@@ -5491,8 +5499,12 @@ class VegaRtcManager {
5491
5499
  _replaceWebcamTrack() {
5492
5500
  return __awaiter(this, void 0, void 0, function* () {
5493
5501
  logger$1.info("_replaceWebcamTrack()");
5494
- if (!this._webcamTrack || !this._webcamProducer || this._webcamProducer.closed)
5502
+ if (!this._sendTransport || !this._webcamTrack || this._webcamProducerPromise)
5495
5503
  return;
5504
+ if (!this._webcamProducer && this._webcamTrack.enabled) {
5505
+ yield this._internalSendWebcam();
5506
+ return;
5507
+ }
5496
5508
  if (this._webcamProducer.track !== this._webcamTrack) {
5497
5509
  yield this._webcamProducer.replaceTrack({ track: this._webcamTrack });
5498
5510
  yield this._replaceWebcamTrack();
@@ -3269,6 +3269,8 @@ const PROTOCOL_RESPONSES = {
3269
3269
  USER_NOTIFIED: "user_notified",
3270
3270
  VIDEO_ENABLED: "video_enabled",
3271
3271
  CLIENT_UNABLE_TO_JOIN: "client_unable_to_join",
3272
+ LIVE_TRANSCRIPTION_STARTED: "live_transcription_started",
3273
+ LIVE_TRANSCRIPTION_STOPPED: "live_transcription_stopped",
3272
3274
  };
3273
3275
  const PROTOCOL_ERRORS = {
3274
3276
  CANNOT_INVITE_YOURSELF: "cannot_invite_yourself",
@@ -5442,14 +5444,18 @@ class VegaRtcManager {
5442
5444
  }
5443
5445
  }
5444
5446
  _internalSendWebcam() {
5447
+ var _a;
5445
5448
  return __awaiter(this, void 0, void 0, function* () {
5446
5449
  logger$1.info("_internalSendWebcam()");
5450
+ if (!this._sendTransport ||
5451
+ this._webcamProducer ||
5452
+ this._webcamProducerPromise ||
5453
+ ((_a = this._webcamTrack) === null || _a === void 0 ? void 0 : _a.readyState) !== "live") {
5454
+ return;
5455
+ }
5447
5456
  this._webcamProducerPromise = (() => __awaiter(this, void 0, void 0, function* () {
5457
+ var _b;
5448
5458
  try {
5449
- if (!this._webcamTrack || !this._sendTransport || this._webcamProducer) {
5450
- this._webcamProducerPromise = null;
5451
- return;
5452
- }
5453
5459
  const currentPaused = this._webcamPaused;
5454
5460
  const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._webcamTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("video", false, this._features)), { appData: {
5455
5461
  streamId: OUTBOUND_CAM_OUTBOUND_STREAM_ID,
@@ -5470,8 +5476,10 @@ class VegaRtcManager {
5470
5476
  this._webcamProducerPromise = null;
5471
5477
  this._qualityMonitor.removeProducer(this._selfId, producer.id);
5472
5478
  });
5473
- if (this._webcamTrack !== this._webcamProducer.track)
5474
- yield this._replaceWebcamTrack();
5479
+ if (this._webcamTrack && this._webcamTrack !== ((_b = this._webcamProducer) === null || _b === void 0 ? void 0 : _b.track)) {
5480
+ this._webcamProducerPromise = null;
5481
+ this._replaceWebcamTrack();
5482
+ }
5475
5483
  if (this._webcamPaused !== this._webcamProducer.paused)
5476
5484
  this._pauseResumeWebcam();
5477
5485
  }
@@ -5481,7 +5489,7 @@ class VegaRtcManager {
5481
5489
  finally {
5482
5490
  this._webcamProducerPromise = null;
5483
5491
  if (!this._webcamTrack) {
5484
- yield this._stopProducer(this._webcamProducer);
5492
+ this._stopProducer(this._webcamProducer);
5485
5493
  this._webcamProducer = null;
5486
5494
  }
5487
5495
  }
@@ -5491,8 +5499,12 @@ class VegaRtcManager {
5491
5499
  _replaceWebcamTrack() {
5492
5500
  return __awaiter(this, void 0, void 0, function* () {
5493
5501
  logger$1.info("_replaceWebcamTrack()");
5494
- if (!this._webcamTrack || !this._webcamProducer || this._webcamProducer.closed)
5502
+ if (!this._sendTransport || !this._webcamTrack || this._webcamProducerPromise)
5495
5503
  return;
5504
+ if (!this._webcamProducer && this._webcamTrack.enabled) {
5505
+ yield this._internalSendWebcam();
5506
+ return;
5507
+ }
5496
5508
  if (this._webcamProducer.track !== this._webcamTrack) {
5497
5509
  yield this._webcamProducer.replaceTrack({ track: this._webcamTrack });
5498
5510
  yield this._replaceWebcamTrack();
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.6.5",
4
+ "version": "1.8.0",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/whereby/sdk",
7
7
  "repository": {
@@ -64,6 +64,7 @@
64
64
  "devDependencies": {
65
65
  "@babel/core": "^7.23.2",
66
66
  "@babel/preset-env": "^7.23.2",
67
+ "jest-websocket-mock": "^2.5.0",
67
68
  "process": "^0.11.10"
68
69
  },
69
70
  "engines": {