node-mac-recorder 2.21.12 → 2.21.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-mac-recorder",
3
- "version": "2.21.12",
3
+ "version": "2.21.13",
4
4
  "description": "Native macOS screen recording package for Node.js applications",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -103,11 +103,13 @@ static dispatch_queue_t g_audioCaptureQueue = nil;
103
103
 
104
104
  CMFormatDescriptionRef formatDescription = CMSampleBufferGetFormatDescription(sampleBuffer);
105
105
  const AudioStreamBasicDescription *asbd = formatDescription ? CMAudioFormatDescriptionGetStreamBasicDescription(formatDescription) : NULL;
106
-
107
- double sampleRate = asbd ? asbd->mSampleRate : 44100.0;
108
- NSUInteger channels = asbd ? asbd->mChannelsPerFrame : 2;
106
+
107
+ double sampleRate = asbd ? asbd->mSampleRate : 48000.0; // Default to 48kHz (not 44.1kHz)
108
+ NSUInteger channels = asbd ? asbd->mChannelsPerFrame : 1; // Default to mono
109
109
  channels = MAX((NSUInteger)1, channels);
110
110
 
111
+ MRLog(@"🎤 Audio format: %.0f Hz, %lu channel(s)", sampleRate, (unsigned long)channels);
112
+
111
113
  AudioChannelLayout layout = {0};
112
114
  size_t layoutSize = 0;
113
115
  if (channels == 1) {
@@ -192,7 +194,17 @@ static dispatch_queue_t g_audioCaptureQueue = nil;
192
194
  }
193
195
  return NO;
194
196
  }
195
-
197
+
198
+ // Configure audio output settings to ensure proper PCM format
199
+ NSDictionary *audioOutputSettings = @{
200
+ AVFormatIDKey: @(kAudioFormatLinearPCM),
201
+ AVLinearPCMBitDepthKey: @(16),
202
+ AVLinearPCMIsFloatKey: @(NO),
203
+ AVLinearPCMIsBigEndianKey: @(NO),
204
+ AVLinearPCMIsNonInterleaved: @(NO)
205
+ };
206
+ [self.audioOutput setAudioSettings:audioOutputSettings];
207
+
196
208
  if (!g_audioCaptureQueue) {
197
209
  g_audioCaptureQueue = dispatch_queue_create("native_audio_recorder.queue", DISPATCH_QUEUE_SERIAL);
198
210
  }