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.
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-mac-recorder",
3
- "version": "2.16.0",
3
+ "version": "2.16.1",
4
4
  "description": "Native macOS screen recording package for Node.js applications",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -51,8 +51,14 @@ void cleanupRecording() {
51
51
  }
52
52
  }
53
53
 
54
- // AVFoundation cleanup
55
- if (isAVFoundationRecording()) {
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 - try AVFoundation fallback
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
- extern bool isAVFoundationRecording();
332
- extern bool stopAVFoundationRecording();
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
- @try {
335
- if (isAVFoundationRecording()) {
336
- NSLog(@"๐Ÿ›‘ Stopping AVFoundation recording");
337
- if (stopAVFoundationRecording()) {
338
- g_isRecording = false;
339
- return Napi::Boolean::New(env, true);
340
- } else {
341
- NSLog(@"โŒ Failed to stop AVFoundation recording");
342
- g_isRecording = false;
343
- return Napi::Boolean::New(env, false);
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 both recording methods
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
- if (isAVFoundationRecording()) {
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