node-mac-recorder 2.21.10 → 2.21.11
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 +1 -1
- package/src/avfoundation_recorder.mm +18 -9
package/package.json
CHANGED
|
@@ -212,22 +212,26 @@ extern "C" bool startAVFoundationRecording(const std::string& outputPath,
|
|
|
212
212
|
MRLog(@"🎤 Starting audio capture (mic=%d, system=%d)", includeMicrophone, includeSystemAudio);
|
|
213
213
|
|
|
214
214
|
// Use provided audio output path or generate one
|
|
215
|
+
NSString *audioPath = nil;
|
|
215
216
|
if (audioOutputPath && [audioOutputPath length] > 0) {
|
|
216
|
-
|
|
217
|
-
MRLog(@"🎤 Using provided audio path: %@",
|
|
217
|
+
audioPath = audioOutputPath;
|
|
218
|
+
MRLog(@"🎤 Using provided audio path: %@", audioPath);
|
|
218
219
|
} else {
|
|
219
220
|
NSString *videoDir = [outputPathStr stringByDeletingLastPathComponent];
|
|
220
221
|
NSString *audioFilename = [NSString stringWithFormat:@"avf_audio_%ld.mov", (long)[[NSDate date] timeIntervalSince1970]];
|
|
221
|
-
|
|
222
|
-
MRLog(@"🎤 Generated audio path: %@",
|
|
222
|
+
audioPath = [videoDir stringByAppendingPathComponent:audioFilename];
|
|
223
|
+
MRLog(@"🎤 Generated audio path: %@", audioPath);
|
|
223
224
|
}
|
|
224
225
|
|
|
225
226
|
// Ensure .mov extension
|
|
226
|
-
if (![
|
|
227
|
-
|
|
228
|
-
MRLog(@"🔧 Fixed audio extension to .mov: %@",
|
|
227
|
+
if (![audioPath.pathExtension.lowercaseString isEqualToString:@"mov"]) {
|
|
228
|
+
audioPath = [[audioPath stringByDeletingPathExtension] stringByAppendingPathExtension:@"mov"];
|
|
229
|
+
MRLog(@"🔧 Fixed audio extension to .mov: %@", audioPath);
|
|
229
230
|
}
|
|
230
231
|
|
|
232
|
+
// Copy to retain the string (ARC will manage it)
|
|
233
|
+
g_avAudioOutputPath = [audioPath copy];
|
|
234
|
+
|
|
231
235
|
// Create audio recorder
|
|
232
236
|
g_avAudioRecorder = createNativeAudioRecorder();
|
|
233
237
|
|
|
@@ -404,9 +408,14 @@ extern "C" bool stopAVFoundationRecording() {
|
|
|
404
408
|
// Stop audio recording if active
|
|
405
409
|
if (g_avAudioRecorder) {
|
|
406
410
|
MRLog(@"🛑 Stopping audio recording");
|
|
407
|
-
|
|
408
|
-
|
|
411
|
+
@try {
|
|
412
|
+
stopNativeAudioRecording(g_avAudioRecorder);
|
|
413
|
+
destroyNativeAudioRecorder(g_avAudioRecorder);
|
|
414
|
+
} @catch (NSException *exception) {
|
|
415
|
+
NSLog(@"⚠️ Exception while stopping audio: %@", exception.reason);
|
|
416
|
+
}
|
|
409
417
|
g_avAudioRecorder = nil;
|
|
418
|
+
g_avAudioOutputPath = nil;
|
|
410
419
|
MRLog(@"✅ Audio recording stopped");
|
|
411
420
|
}
|
|
412
421
|
|