livekit-client 2.13.2 → 2.13.3

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.
@@ -11266,7 +11266,7 @@ function getOSVersion(ua) {
11266
11266
  return ua.includes('mac os') ? getMatch(/\(.+?(\d+_\d+(:?_\d+)?)/, ua, 1).replace(/_/g, '.') : undefined;
11267
11267
  }
11268
11268
 
11269
- var version$1 = "2.13.2";
11269
+ var version$1 = "2.13.3";
11270
11270
 
11271
11271
  const version = version$1;
11272
11272
  const protocolVersion = 16;
@@ -15533,8 +15533,21 @@ function computeBitrate(currentStats, prevStats) {
15533
15533
  return (bytesNow - bytesPrev) * 8 * 1000 / (currentStats.timestamp - prevStats.timestamp);
15534
15534
  }
15535
15535
 
15536
- class LocalTrackRecorder extends MediaRecorder {
15536
+ // Check if MediaRecorder is available
15537
+ const isMediaRecorderAvailable = typeof MediaRecorder !== 'undefined';
15538
+ // Fallback class for environments without MediaRecorder
15539
+ class FallbackRecorder {
15540
+ constructor() {
15541
+ throw new Error('MediaRecorder is not available in this environment');
15542
+ }
15543
+ }
15544
+ // Use conditional inheritance to avoid parse-time errors
15545
+ const RecorderBase = isMediaRecorderAvailable ? MediaRecorder : FallbackRecorder;
15546
+ class LocalTrackRecorder extends RecorderBase {
15537
15547
  constructor(track, options) {
15548
+ if (!isMediaRecorderAvailable) {
15549
+ throw new Error('MediaRecorder is not available in this environment');
15550
+ }
15538
15551
  super(new MediaStream([track.mediaStreamTrack]), options);
15539
15552
  let dataListener;
15540
15553
  let streamController;
@@ -15573,6 +15586,10 @@ class LocalTrackRecorder extends MediaRecorder {
15573
15586
  this.addEventListener('error', onError);
15574
15587
  }
15575
15588
  }
15589
+ // Helper function to check if recording is supported
15590
+ function isRecordingSupported() {
15591
+ return isMediaRecorderAvailable;
15592
+ }
15576
15593
 
15577
15594
  const DEFAULT_DIMENSIONS_TIMEOUT = 1000;
15578
15595
  const PRE_CONNECT_BUFFER_TIMEOUT = 10000;
@@ -16104,6 +16121,10 @@ class LocalTrack extends Track {
16104
16121
  /** @internal */
16105
16122
  startPreConnectBuffer() {
16106
16123
  let timeslice = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
16124
+ if (!isRecordingSupported()) {
16125
+ this.log.warn('MediaRecorder is not available, cannot start preconnect buffer', this.logContext);
16126
+ return;
16127
+ }
16107
16128
  if (!this.localTrackRecorder) {
16108
16129
  this.localTrackRecorder = new LocalTrackRecorder(this, {
16109
16130
  mimeType: 'audio/webm;codecs=opus'