nosnia-audio-recorder 0.8.1 → 0.8.2

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.
@@ -189,25 +189,20 @@ RCT_EXPORT_METHOD(startRecording:(NSDictionary *)options
189
189
  return;
190
190
  }
191
191
 
192
- // Set audio category - use Record category with multiple options for compatibility
192
+ // Set audio category - use Record category with DuckOthers only
193
+ // Note: DefaultToSpeaker is NOT compatible with Record category
193
194
  NSError *categoryError = nil;
194
- AVAudioSessionCategoryOptions options = AVAudioSessionCategoryOptionDuckOthers |
195
- AVAudioSessionCategoryOptionDefaultToSpeaker;
195
+ AVAudioSessionCategoryOptions options = AVAudioSessionCategoryOptionDuckOthers;
196
196
  BOOL categorySuccess = [audioSession setCategory:AVAudioSessionCategoryRecord
197
197
  withOptions:options
198
198
  error:&categoryError];
199
199
  if (!categorySuccess || categoryError) {
200
- // Try without DefaultToSpeaker if it fails
201
- categoryError = nil;
202
- categorySuccess = [audioSession setCategory:AVAudioSessionCategoryRecord
203
- withOptions:AVAudioSessionCategoryOptionDuckOthers
204
- error:&categoryError];
205
- if (!categorySuccess || categoryError) {
206
- NSString *msg = categoryError ? categoryError.description : @"Failed to set audio category";
207
- reject(@"AUDIO_SESSION_ERROR", msg, categoryError);
208
- return;
209
- }
200
+ NSString *msg = categoryError ? categoryError.description : @"Failed to set audio category";
201
+ NSLog(@"[NosniaAudioRecorder] Audio category error: %@", msg);
202
+ reject(@"AUDIO_SESSION_ERROR", msg, categoryError);
203
+ return;
210
204
  }
205
+ NSLog(@"[NosniaAudioRecorder] Audio category set to Record with DuckOthers");
211
206
 
212
207
  // Set audio mode to default for recording
213
208
  NSError *modeError = nil;
@@ -237,10 +232,9 @@ RCT_EXPORT_METHOD(startRecording:(NSDictionary *)options
237
232
  // Only use essential keys that are universally supported
238
233
  NSMutableDictionary *recordingSettings = [NSMutableDictionary dictionary];
239
234
  [recordingSettings setObject:@(kAudioFormatMPEG4AAC) forKey:AVFormatIDKey];
240
- [recordingSettings setObject:sampleRate forKey:AVSampleRateKey];
235
+ [recordingSettings setObject:@([sampleRate doubleValue]) forKey:AVSampleRateKey];
241
236
  [recordingSettings setObject:channels forKey:AVNumberOfChannelsKey];
242
237
  [recordingSettings setObject:bitrate forKey:AVEncoderBitRateKey];
243
- [recordingSettings setObject:@(AVAudioQualityMedium) forKey:AVEncoderAudioQualityKey];
244
238
 
245
239
  NSLog(@"[NosniaAudioRecorder] Recording settings: %@", recordingSettings);
246
240
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nosnia-audio-recorder",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
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",