nosnia-audio-recorder 0.7.7 → 0.8.0
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.
|
@@ -103,7 +103,7 @@ RCT_EXPORT_MODULE(NosniaAudioRecorder)
|
|
|
103
103
|
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
|
|
104
104
|
[formatter setDateFormat:@"yyyyMMdd_HHmmss"];
|
|
105
105
|
NSString *timestamp = [formatter stringFromDate:[NSDate date]];
|
|
106
|
-
return [NSString stringWithFormat:@"recording_%@.
|
|
106
|
+
return [NSString stringWithFormat:@"recording_%@.m4a", timestamp];
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
RCT_EXPORT_METHOD(startRecording:(NSDictionary *)options
|
|
@@ -233,15 +233,13 @@ RCT_EXPORT_METHOD(startRecording:(NSDictionary *)options
|
|
|
233
233
|
|
|
234
234
|
// Create recording settings dictionary with safety checks
|
|
235
235
|
@try {
|
|
236
|
-
// Use
|
|
237
|
-
//
|
|
236
|
+
// Use MPEG4AAC format for MP3-compatible output
|
|
237
|
+
// Creates .m4a files which are MP3-compatible and highly reliable
|
|
238
238
|
NSDictionary *recordingSettings = @{
|
|
239
|
-
AVFormatIDKey: @(
|
|
239
|
+
AVFormatIDKey: @(kAudioFormatMPEG4AAC),
|
|
240
240
|
AVSampleRateKey: sampleRate,
|
|
241
241
|
AVNumberOfChannelsKey: channels,
|
|
242
|
-
|
|
243
|
-
AVLinearPCMIsBigEndianKey: @(NO),
|
|
244
|
-
AVLinearPCMIsNonInterleaved: @(NO),
|
|
242
|
+
AVEncoderBitRateKey: bitrate,
|
|
245
243
|
AVEncoderAudioQualityKey: @(AVAudioQualityHigh)
|
|
246
244
|
};
|
|
247
245
|
|
|
@@ -253,7 +251,7 @@ RCT_EXPORT_METHOD(startRecording:(NSDictionary *)options
|
|
|
253
251
|
|
|
254
252
|
// Validate all required keys are present
|
|
255
253
|
if (!recordingSettings[AVFormatIDKey] || !recordingSettings[AVSampleRateKey] ||
|
|
256
|
-
!recordingSettings[AVNumberOfChannelsKey] || !recordingSettings[
|
|
254
|
+
!recordingSettings[AVNumberOfChannelsKey] || !recordingSettings[AVEncoderBitRateKey]) {
|
|
257
255
|
reject(@"SETTINGS_ERROR", @"Incomplete recording settings", nil);
|
|
258
256
|
return;
|
|
259
257
|
}
|
package/package.json
CHANGED