nosnia-audio-recorder 0.9.12 → 0.9.14

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.
@@ -268,9 +268,11 @@ RCT_EXPORT_METHOD(startRecording:(NSDictionary *)options
268
268
  // Set audio category - use PlayAndRecord for better simulator/device compatibility
269
269
  // This works reliably on both real devices and simulators
270
270
  NSError *categoryError = nil;
271
- AVAudioSessionCategoryOptions options = AVAudioSessionCategoryOptionDefaultToSpeaker;
271
+ AVAudioSessionCategoryOptions categoryOptions = AVAudioSessionCategoryOptionDefaultToSpeaker |
272
+ AVAudioSessionCategoryOptionAllowBluetooth |
273
+ AVAudioSessionCategoryOptionAllowAirPlay;
272
274
  BOOL categorySuccess = [audioSession setCategory:AVAudioSessionCategoryPlayAndRecord
273
- withOptions:options
275
+ withOptions:categoryOptions
274
276
  error:&categoryError];
275
277
  if (!categorySuccess || categoryError) {
276
278
  NSString *msg = categoryError ? categoryError.description : @"Failed to set audio category";
@@ -278,7 +280,7 @@ RCT_EXPORT_METHOD(startRecording:(NSDictionary *)options
278
280
  reject(@"AUDIO_SESSION_ERROR", msg, categoryError);
279
281
  return;
280
282
  }
281
- NSLog(@"[NosniaAudioRecorder] Audio category set to PlayAndRecord with DefaultToSpeaker");
283
+ NSLog(@"[NosniaAudioRecorder] Audio category set to PlayAndRecord with multiple options");
282
284
 
283
285
  // Set audio mode to default for recording
284
286
  NSError *modeError = nil;
@@ -354,6 +356,13 @@ RCT_EXPORT_METHOD(startRecording:(NSDictionary *)options
354
356
  NSError *recordStartError = nil;
355
357
  BOOL recordStarted = NO;
356
358
 
359
+ // CRITICAL: Ensure audio session is active BEFORE attempting to record
360
+ // In Release builds, this is NOT automatically done by the system
361
+ AVAudioSession *audioSession = [AVAudioSession sharedInstance];
362
+ NSError *preActivateError = nil;
363
+ BOOL preActivateSuccess = [audioSession setActive:YES error:&preActivateError];
364
+ NSLog(@"[NosniaAudioRecorder] Pre-activation check: success=%d, error=%@", preActivateSuccess, preActivateError);
365
+
357
366
  // Try to prepare recorder first
358
367
  NSLog(@"[NosniaAudioRecorder] Preparing to record with settings: %@", _audioRecorder.settings);
359
368
  NSLog(@"[NosniaAudioRecorder] Recording URL: %@", _recordingURL);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nosnia-audio-recorder",
3
- "version": "0.9.12",
3
+ "version": "0.9.14",
4
4
  "description": "This is a modern audio recorder which actually works cross platform",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",