livekit-client 2.13.2 → 2.13.4

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.
@@ -11192,6 +11192,10 @@ function cloneDeep(value) {
11192
11192
  return value;
11193
11193
  }
11194
11194
  if (typeof structuredClone === 'function') {
11195
+ if (typeof value === 'object' && value !== null) {
11196
+ // ensure that the value is not a proxy by spreading it
11197
+ return structuredClone(Object.assign({}, value));
11198
+ }
11195
11199
  return structuredClone(value);
11196
11200
  } else {
11197
11201
  return JSON.parse(JSON.stringify(value));
@@ -11266,7 +11270,7 @@ function getOSVersion(ua) {
11266
11270
  return ua.includes('mac os') ? getMatch(/\(.+?(\d+_\d+(:?_\d+)?)/, ua, 1).replace(/_/g, '.') : undefined;
11267
11271
  }
11268
11272
 
11269
- var version$1 = "2.13.2";
11273
+ var version$1 = "2.13.4";
11270
11274
 
11271
11275
  const version = version$1;
11272
11276
  const protocolVersion = 16;
@@ -15533,8 +15537,21 @@ function computeBitrate(currentStats, prevStats) {
15533
15537
  return (bytesNow - bytesPrev) * 8 * 1000 / (currentStats.timestamp - prevStats.timestamp);
15534
15538
  }
15535
15539
 
15536
- class LocalTrackRecorder extends MediaRecorder {
15540
+ // Check if MediaRecorder is available
15541
+ const isMediaRecorderAvailable = typeof MediaRecorder !== 'undefined';
15542
+ // Fallback class for environments without MediaRecorder
15543
+ class FallbackRecorder {
15544
+ constructor() {
15545
+ throw new Error('MediaRecorder is not available in this environment');
15546
+ }
15547
+ }
15548
+ // Use conditional inheritance to avoid parse-time errors
15549
+ const RecorderBase = isMediaRecorderAvailable ? MediaRecorder : FallbackRecorder;
15550
+ class LocalTrackRecorder extends RecorderBase {
15537
15551
  constructor(track, options) {
15552
+ if (!isMediaRecorderAvailable) {
15553
+ throw new Error('MediaRecorder is not available in this environment');
15554
+ }
15538
15555
  super(new MediaStream([track.mediaStreamTrack]), options);
15539
15556
  let dataListener;
15540
15557
  let streamController;
@@ -15573,6 +15590,10 @@ class LocalTrackRecorder extends MediaRecorder {
15573
15590
  this.addEventListener('error', onError);
15574
15591
  }
15575
15592
  }
15593
+ // Helper function to check if recording is supported
15594
+ function isRecordingSupported() {
15595
+ return isMediaRecorderAvailable;
15596
+ }
15576
15597
 
15577
15598
  const DEFAULT_DIMENSIONS_TIMEOUT = 1000;
15578
15599
  const PRE_CONNECT_BUFFER_TIMEOUT = 10000;
@@ -16104,6 +16125,10 @@ class LocalTrack extends Track {
16104
16125
  /** @internal */
16105
16126
  startPreConnectBuffer() {
16106
16127
  let timeslice = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
16128
+ if (!isRecordingSupported()) {
16129
+ this.log.warn('MediaRecorder is not available, cannot start preconnect buffer', this.logContext);
16130
+ return;
16131
+ }
16107
16132
  if (!this.localTrackRecorder) {
16108
16133
  this.localTrackRecorder = new LocalTrackRecorder(this, {
16109
16134
  mimeType: 'audio/webm;codecs=opus'
@@ -20372,6 +20397,7 @@ class LocalParticipant extends Participant {
20372
20397
  }
20373
20398
  });
20374
20399
  this.engine.on(EngineEvent.Connected, this.handleReconnected).on(EngineEvent.SignalConnected, this.handleSignalConnected).on(EngineEvent.SignalRestarted, this.handleReconnected).on(EngineEvent.SignalResumed, this.handleReconnected).on(EngineEvent.Restarting, this.handleReconnecting).on(EngineEvent.Resuming, this.handleReconnecting).on(EngineEvent.LocalTrackUnpublished, this.handleLocalTrackUnpublished).on(EngineEvent.SubscribedQualityUpdate, this.handleSubscribedQualityUpdate).on(EngineEvent.Disconnected, this.handleDisconnected).on(EngineEvent.SignalRequestResponse, this.handleSignalRequestResponse).on(EngineEvent.DataPacketReceived, this.handleDataPacket);
20400
+ this.signalConnectedFuture = undefined;
20375
20401
  }
20376
20402
  /**
20377
20403
  * Sets and updates the metadata of the local participant.
@@ -24502,6 +24528,36 @@ function mapArgs(args) {
24502
24528
  });
24503
24529
  }
24504
24530
 
24531
+ // This file was generated from JSON Schema using quicktype, do not modify it directly.
24532
+ // The code generation lives at https://github.com/livekit/attribute-definitions
24533
+ //
24534
+ // To parse this data:
24535
+ //
24536
+ // import { Convert, AgentAttributes, TranscriptionAttributes } from "./file";
24537
+ //
24538
+ // const agentAttributes = Convert.toAgentAttributes(json);
24539
+ // const transcriptionAttributes = Convert.toTranscriptionAttributes(json);
24540
+ // Converts JSON strings to/from your types
24541
+ class Convert {
24542
+ static toAgentAttributes(json) {
24543
+ return JSON.parse(json);
24544
+ }
24545
+ static agentAttributesToJson(value) {
24546
+ return JSON.stringify(value);
24547
+ }
24548
+ static toTranscriptionAttributes(json) {
24549
+ return JSON.parse(json);
24550
+ }
24551
+ static transcriptionAttributesToJson(value) {
24552
+ return JSON.stringify(value);
24553
+ }
24554
+ }
24555
+
24556
+ var attributeTypings = /*#__PURE__*/Object.freeze({
24557
+ __proto__: null,
24558
+ Convert: Convert
24559
+ });
24560
+
24505
24561
  var CheckStatus;
24506
24562
  (function (CheckStatus) {
24507
24563
  CheckStatus[CheckStatus["IDLE"] = 0] = "IDLE";
@@ -25316,5 +25372,5 @@ function isFacingModeValue(item) {
25316
25372
  return item === undefined || allowedValues.includes(item);
25317
25373
  }
25318
25374
 
25319
- export { AudioPresets, BackupCodecPolicy, BaseKeyProvider, CheckStatus, Checker, ConnectionCheck, ConnectionError, ConnectionErrorReason, ConnectionQuality, ConnectionState, CriticalTimers, CryptorError, CryptorErrorReason, CryptorEvent, DataPacket_Kind, DefaultReconnectPolicy, DeviceUnsupportedError, DisconnectReason, EncryptionEvent, EngineEvent, ExternalE2EEKeyProvider, KeyHandlerEvent, KeyProviderEvent, LivekitError, LocalAudioTrack, LocalParticipant, LocalTrack, LocalTrackPublication, LocalTrackRecorder, LocalVideoTrack, LogLevel, LoggerNames, MediaDeviceFailure, _ as Mutex, NegotiationError, Participant, ParticipantEvent, ParticipantInfo_Kind as ParticipantKind, PublishDataError, PublishTrackError, RemoteAudioTrack, RemoteParticipant, RemoteTrack, RemoteTrackPublication, RemoteVideoTrack, Room, RoomEvent, RpcError, ScreenSharePresets, SignalRequestError, SubscriptionError, Track, TrackEvent, TrackInvalidError, TrackPublication, TrackType, UnexpectedConnectionState, UnsupportedServer, VideoPreset, VideoPresets, VideoPresets43, VideoQuality, attachToElement, compareVersions, createAudioAnalyser, createE2EEKey, createKeyMaterialFromBuffer, createKeyMaterialFromString, createLocalAudioTrack, createLocalScreenTracks, createLocalTracks, createLocalVideoTrack, deriveKeys, detachTrack, facingModeFromDeviceLabel, facingModeFromLocalTrack, getBrowser, getEmptyAudioStreamTrack, getEmptyVideoStreamTrack, getLogger, importKey, isAudioTrack, isBackupCodec, isBrowserSupported, isE2EESupported, isInsertableStreamSupported, isLocalParticipant, isLocalTrack, isRemoteParticipant, isRemoteTrack, isScriptTransformSupported, isVideoFrame, isVideoTrack, needsRbspUnescaping, parseRbsp, protocolVersion, ratchet, setLogExtension, setLogLevel, supportsAV1, supportsAdaptiveStream, supportsDynacast, supportsVP9, version, videoCodecs, writeRbsp };
25375
+ export { AudioPresets, BackupCodecPolicy, BaseKeyProvider, CheckStatus, Checker, ConnectionCheck, ConnectionError, ConnectionErrorReason, ConnectionQuality, ConnectionState, CriticalTimers, CryptorError, CryptorErrorReason, CryptorEvent, DataPacket_Kind, DefaultReconnectPolicy, DeviceUnsupportedError, DisconnectReason, EncryptionEvent, EngineEvent, ExternalE2EEKeyProvider, KeyHandlerEvent, KeyProviderEvent, LivekitError, LocalAudioTrack, LocalParticipant, LocalTrack, LocalTrackPublication, LocalTrackRecorder, LocalVideoTrack, LogLevel, LoggerNames, MediaDeviceFailure, _ as Mutex, NegotiationError, Participant, ParticipantEvent, ParticipantInfo_Kind as ParticipantKind, PublishDataError, PublishTrackError, RemoteAudioTrack, RemoteParticipant, RemoteTrack, RemoteTrackPublication, RemoteVideoTrack, Room, RoomEvent, RpcError, ScreenSharePresets, SignalRequestError, SubscriptionError, Track, TrackEvent, TrackInvalidError, TrackPublication, TrackType, UnexpectedConnectionState, UnsupportedServer, VideoPreset, VideoPresets, VideoPresets43, VideoQuality, attachToElement, attributeTypings as attributes, compareVersions, createAudioAnalyser, createE2EEKey, createKeyMaterialFromBuffer, createKeyMaterialFromString, createLocalAudioTrack, createLocalScreenTracks, createLocalTracks, createLocalVideoTrack, deriveKeys, detachTrack, facingModeFromDeviceLabel, facingModeFromLocalTrack, getBrowser, getEmptyAudioStreamTrack, getEmptyVideoStreamTrack, getLogger, importKey, isAudioTrack, isBackupCodec, isBrowserSupported, isE2EESupported, isInsertableStreamSupported, isLocalParticipant, isLocalTrack, isRemoteParticipant, isRemoteTrack, isScriptTransformSupported, isVideoFrame, isVideoTrack, needsRbspUnescaping, parseRbsp, protocolVersion, ratchet, setLogExtension, setLogLevel, supportsAV1, supportsAdaptiveStream, supportsDynacast, supportsVP9, version, videoCodecs, writeRbsp };
25320
25376
  //# sourceMappingURL=livekit-client.esm.mjs.map