node-mac-recorder 2.16.0 โ 2.16.1
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/.claude/settings.local.json +2 -1
- package/package.json +1 -1
- package/src/mac_recorder.mm +48 -20
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
"Bash(ELECTRON_RUN_AS_NODE=1 node -e \"\nconsole.log(''๐ต Testing both microphone and system audio'');\nconst MacRecorder = require(''./index'');\nconst recorder = new MacRecorder();\n\nasync function testBothAudio() {\n try {\n const outputPath = ''./test-output/both-audio-test.mov'';\n console.log(''๐น Starting recording with both audio sources...'');\n \n const success = await recorder.startRecording(outputPath, {\n captureCursor: true,\n includeMicrophone: true, // Mikrophone AรIK\n includeSystemAudio: true // Sistem sesi AรIK\n });\n \n if (success) {\n console.log(''โ
Recording started - waiting 5 seconds'');\n await new Promise(resolve => setTimeout(resolve, 5000));\n \n console.log(''๐ Stopping recording...'');\n await recorder.stopRecording();\n console.log(''โ
Both audio test completed!'');\n } else {\n console.log(''โ Recording failed to start'');\n }\n } catch (error) {\n console.log(''โ Error:'', error.message);\n console.log(''Stack:'', error.stack);\n }\n}\n\ntestBothAudio();\n\")",
|
|
44
44
|
"Bash(ELECTRON_RUN_AS_NODE=1 node -e \"\nconsole.log(''๐ค Testing microphone only'');\nconst MacRecorder = require(''./index'');\nconst recorder = new MacRecorder();\n\nasync function testMicrophoneOnly() {\n try {\n const outputPath = ''./test-output/microphone-only-test.mov'';\n console.log(''๐น Starting microphone only recording...'');\n \n const success = await recorder.startRecording(outputPath, {\n captureCursor: false,\n includeMicrophone: true, // Sadece mikrofon AรIK\n includeSystemAudio: false // Sistem sesi KAPALI\n });\n \n if (success) {\n console.log(''โ
Microphone recording started - waiting 3 seconds'');\n await new Promise(resolve => setTimeout(resolve, 3000));\n \n console.log(''๐ Stopping microphone recording...'');\n await recorder.stopRecording();\n console.log(''โ
Microphone only test completed!'');\n } else {\n console.log(''โ Recording failed to start'');\n }\n } catch (error) {\n console.log(''โ Error:'', error.message);\n }\n}\n\ntestMicrophoneOnly();\n\")",
|
|
45
45
|
"Bash(ELECTRON_RUN_AS_NODE=1 node -e \"\nconsole.log(''๐ Full stress test - All features + Both audio sources'');\nconst MacRecorder = require(''./index'');\nconst recorder = new MacRecorder();\n\nasync function fullStressTest() {\n try {\n const outputPath = ''./test-output/full-stress-test.mov'';\n console.log(''๐น Starting full featured recording (stress test)...'');\n \n const success = await recorder.startRecording(outputPath, {\n captureCursor: true, // Cursor kayฤฑt\n includeMicrophone: true, // Mikrofon kayฤฑt\n includeSystemAudio: true, // Sistem sesi kayฤฑt\n captureArea: { // Crop area\n x: 300,\n y: 300,\n width: 800,\n height: 500\n }\n });\n \n if (success) {\n console.log(''โ
Full stress test started - waiting 6 seconds'');\n await new Promise(resolve => setTimeout(resolve, 6000));\n \n console.log(''๐ Stopping full stress test...'');\n await recorder.stopRecording();\n console.log(''๐ FULL STRESS TEST COMPLETED WITHOUT CRASH!'');\n } else {\n console.log(''โ Recording failed to start'');\n }\n } catch (error) {\n console.log(''โ Error:'', error.message);\n console.log(''Stack:'', error.stack);\n }\n}\n\nfullStressTest();\n\")",
|
|
46
|
-
"Bash(ELECTRON_RUN_AS_NODE=1 node -e \"\nconsole.log(''๐งช Testing version detection and fallback system'');\nconst MacRecorder = require(''./index'');\nconst recorder = new MacRecorder();\n\nasync function testVersionDetection() {\n try {\n const outputPath = ''./test-output/version-detection-test.mov'';\n console.log(''๐น Starting recording with version detection...'');\n \n const success = await recorder.startRecording(outputPath, {\n captureCursor: true,\n includeMicrophone: false,\n includeSystemAudio: true\n });\n \n if (success) {\n console.log(''โ
Recording started - waiting 3 seconds'');\n await new Promise(resolve => setTimeout(resolve, 3000));\n \n console.log(''๐ Stopping recording...'');\n await recorder.stopRecording();\n console.log(''โ
Version detection test completed successfully!'');\n } else {\n console.log(''โ Recording failed to start'');\n }\n } catch (error) {\n console.log(''โ Error:'', error.message);\n }\n}\n\ntestVersionDetection();\n\")"
|
|
46
|
+
"Bash(ELECTRON_RUN_AS_NODE=1 node -e \"\nconsole.log(''๐งช Testing version detection and fallback system'');\nconst MacRecorder = require(''./index'');\nconst recorder = new MacRecorder();\n\nasync function testVersionDetection() {\n try {\n const outputPath = ''./test-output/version-detection-test.mov'';\n console.log(''๐น Starting recording with version detection...'');\n \n const success = await recorder.startRecording(outputPath, {\n captureCursor: true,\n includeMicrophone: false,\n includeSystemAudio: true\n });\n \n if (success) {\n console.log(''โ
Recording started - waiting 3 seconds'');\n await new Promise(resolve => setTimeout(resolve, 3000));\n \n console.log(''๐ Stopping recording...'');\n await recorder.stopRecording();\n console.log(''โ
Version detection test completed successfully!'');\n } else {\n console.log(''โ Recording failed to start'');\n }\n } catch (error) {\n console.log(''โ Error:'', error.message);\n }\n}\n\ntestVersionDetection();\n\")",
|
|
47
|
+
"Bash(ELECTRON_RUN_AS_NODE=1 node -e \"\nconsole.log(''๐งช Testing Electron safety measures'');\nconst MacRecorder = require(''./index'');\nconst recorder = new MacRecorder();\n\nasync function testElectronSafety() {\n try {\n const outputPath = ''./test-output/electron-safe-test.mov'';\n console.log(''๐น Starting recording in Electron environment...'');\n \n const success = await recorder.startRecording(outputPath, {\n captureCursor: true,\n includeMicrophone: false,\n includeSystemAudio: true\n });\n \n if (success) {\n console.log(''โ
Recording started safely in Electron - waiting 3 seconds'');\n await new Promise(resolve => setTimeout(resolve, 3000));\n \n console.log(''๐ Stopping recording...'');\n await recorder.stopRecording();\n console.log(''โ
Electron safety test completed successfully!'');\n } else {\n console.log(''โ ๏ธ Recording failed to start (expected in some cases)'');\n }\n } catch (error) {\n console.log(''โ Error:'', error.message);\n }\n}\n\ntestElectronSafety();\n\")"
|
|
47
48
|
],
|
|
48
49
|
"deny": []
|
|
49
50
|
}
|
package/package.json
CHANGED
package/src/mac_recorder.mm
CHANGED
|
@@ -51,8 +51,14 @@ void cleanupRecording() {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
// AVFoundation cleanup
|
|
55
|
-
|
|
54
|
+
// AVFoundation cleanup (only in non-Electron environments)
|
|
55
|
+
BOOL isElectron = (NSBundle.mainBundle.bundleIdentifier &&
|
|
56
|
+
[NSBundle.mainBundle.bundleIdentifier containsString:@"electron"]) ||
|
|
57
|
+
(NSProcessInfo.processInfo.processName &&
|
|
58
|
+
[NSProcessInfo.processInfo.processName containsString:@"Electron"]) ||
|
|
59
|
+
(NSProcessInfo.processInfo.environment[@"ELECTRON_RUN_AS_NODE"] != nil);
|
|
60
|
+
|
|
61
|
+
if (!isElectron && isAVFoundationRecording()) {
|
|
56
62
|
stopAVFoundationRecording();
|
|
57
63
|
}
|
|
58
64
|
|
|
@@ -274,7 +280,14 @@ Napi::Value StartRecording(const Napi::CallbackInfo& info) {
|
|
|
274
280
|
return Napi::Boolean::New(env, false);
|
|
275
281
|
}
|
|
276
282
|
|
|
277
|
-
// If we get here, ScreenCaptureKit failed
|
|
283
|
+
// If we get here, ScreenCaptureKit failed
|
|
284
|
+
if (isElectron) {
|
|
285
|
+
NSLog(@"โ ScreenCaptureKit failed in Electron - AVFoundation disabled for stability");
|
|
286
|
+
NSLog(@"โ Recording not available in Electron when ScreenCaptureKit fails");
|
|
287
|
+
return Napi::Boolean::New(env, false);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// Try AVFoundation fallback (only in non-Electron environments)
|
|
278
291
|
NSLog(@"๐ ScreenCaptureKit failed - attempting AVFoundation fallback");
|
|
279
292
|
|
|
280
293
|
@try {
|
|
@@ -327,24 +340,32 @@ Napi::Value StopRecording(const Napi::CallbackInfo& info) {
|
|
|
327
340
|
}
|
|
328
341
|
}
|
|
329
342
|
|
|
330
|
-
// Try AVFoundation fallback
|
|
331
|
-
|
|
332
|
-
|
|
343
|
+
// Try AVFoundation fallback (only in non-Electron environments)
|
|
344
|
+
BOOL isElectron = (NSBundle.mainBundle.bundleIdentifier &&
|
|
345
|
+
[NSBundle.mainBundle.bundleIdentifier containsString:@"electron"]) ||
|
|
346
|
+
(NSProcessInfo.processInfo.processName &&
|
|
347
|
+
[NSProcessInfo.processInfo.processName containsString:@"Electron"]) ||
|
|
348
|
+
(NSProcessInfo.processInfo.environment[@"ELECTRON_RUN_AS_NODE"] != nil);
|
|
333
349
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
350
|
+
if (!isElectron) {
|
|
351
|
+
extern bool isAVFoundationRecording();
|
|
352
|
+
extern bool stopAVFoundationRecording();
|
|
353
|
+
|
|
354
|
+
@try {
|
|
355
|
+
if (isAVFoundationRecording()) {
|
|
356
|
+
NSLog(@"๐ Stopping AVFoundation recording");
|
|
357
|
+
if (stopAVFoundationRecording()) {
|
|
358
|
+
g_isRecording = false;
|
|
359
|
+
return Napi::Boolean::New(env, true);
|
|
360
|
+
} else {
|
|
361
|
+
NSLog(@"โ Failed to stop AVFoundation recording");
|
|
362
|
+
g_isRecording = false;
|
|
363
|
+
return Napi::Boolean::New(env, false);
|
|
364
|
+
}
|
|
344
365
|
}
|
|
366
|
+
} @catch (NSException *exception) {
|
|
367
|
+
NSLog(@"โ Exception stopping AVFoundation: %@", exception.reason);
|
|
345
368
|
}
|
|
346
|
-
} @catch (NSException *exception) {
|
|
347
|
-
NSLog(@"โ Exception stopping AVFoundation: %@", exception.reason);
|
|
348
369
|
}
|
|
349
370
|
|
|
350
371
|
NSLog(@"โ ๏ธ No active recording found to stop");
|
|
@@ -606,7 +627,7 @@ Napi::Value GetDisplays(const Napi::CallbackInfo& info) {
|
|
|
606
627
|
Napi::Value GetRecordingStatus(const Napi::CallbackInfo& info) {
|
|
607
628
|
Napi::Env env = info.Env();
|
|
608
629
|
|
|
609
|
-
// Check
|
|
630
|
+
// Check recording methods
|
|
610
631
|
bool isRecording = g_isRecording;
|
|
611
632
|
|
|
612
633
|
if (@available(macOS 12.3, *)) {
|
|
@@ -615,7 +636,14 @@ Napi::Value GetRecordingStatus(const Napi::CallbackInfo& info) {
|
|
|
615
636
|
}
|
|
616
637
|
}
|
|
617
638
|
|
|
618
|
-
|
|
639
|
+
// Check AVFoundation only in non-Electron environments
|
|
640
|
+
BOOL isElectron = (NSBundle.mainBundle.bundleIdentifier &&
|
|
641
|
+
[NSBundle.mainBundle.bundleIdentifier containsString:@"electron"]) ||
|
|
642
|
+
(NSProcessInfo.processInfo.processName &&
|
|
643
|
+
[NSProcessInfo.processInfo.processName containsString:@"Electron"]) ||
|
|
644
|
+
(NSProcessInfo.processInfo.environment[@"ELECTRON_RUN_AS_NODE"] != nil);
|
|
645
|
+
|
|
646
|
+
if (!isElectron && isAVFoundationRecording()) {
|
|
619
647
|
isRecording = true;
|
|
620
648
|
}
|
|
621
649
|
|