node-mac-recorder 2.16.4 β†’ 2.16.6

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.
@@ -48,7 +48,8 @@
48
48
  "Bash(FORCE_AVFOUNDATION=1 node -e \"\nconsole.log(''πŸ§ͺ Testing AVFoundation fallback path'');\nconst MacRecorder = require(''./index'');\nconst recorder = new MacRecorder();\n\nasync function testAVFoundationPath() {\n try {\n const outputPath = ''./test-output/force-avfoundation-test.mov'';\n console.log(''πŸ“Ή Testing AVFoundation (force mode)...'');\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'');\n await new Promise(resolve => setTimeout(resolve, 2000));\n \n await recorder.stopRecording();\n console.log(''βœ… AVFoundation test completed!'');\n } else {\n console.log(''❌ Recording failed'');\n }\n } catch (error) {\n console.log(''❌ Error:'', error.message);\n }\n}\n\ntestAVFoundationPath();\n\")",
49
49
  "Bash(FORCE_AVFOUNDATION=1 node -e \"\nconsole.log(''πŸ§ͺ Testing AVFoundation fallback path (macOS 14 simulation)'');\nconst MacRecorder = require(''./index'');\nconst recorder = new MacRecorder();\n\nasync function testAVFoundationPath() {\n try {\n const outputPath = ''./test-output/force-avfoundation-test.mov'';\n console.log(''πŸ“Ή Testing AVFoundation (simulating macOS 14)...'');\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 with AVFoundation'');\n await new Promise(resolve => setTimeout(resolve, 3000));\n \n await recorder.stopRecording();\n console.log(''βœ… AVFoundation test completed successfully!'');\n console.log(''This is how it should work on macOS 14'');\n } else {\n console.log(''❌ Recording failed to start'');\n }\n } catch (error) {\n console.log(''❌ Error:'', error.message);\n }\n}\n\ntestAVFoundationPath();\n\")",
50
50
  "Bash(FORCE_AVFOUNDATION=1 node -e \"\nconsole.log(''πŸ§ͺ Testing AVFoundation with detailed debugging'');\nconst MacRecorder = require(''./index'');\nconst recorder = new MacRecorder();\n\nasync function testWithDebugging() {\n try {\n const outputPath = ''./test-output/debug-test.mov'';\n console.log(''πŸ“Ή Starting AVFoundation test with debugging...'');\n console.log(''Expected to see detailed AVFoundation logs in console'');\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'');\n await new Promise(resolve => setTimeout(resolve, 2000));\n \n await recorder.stopRecording();\n console.log(''βœ… Test completed'');\n } else {\n console.log(''❌ Recording failed - check console logs for AVFoundation details'');\n }\n } catch (error) {\n console.log(''❌ Error:'', error.message);\n }\n}\n\ntestWithDebugging();\n\")",
51
- "Bash(FORCE_AVFOUNDATION=1 node -e \"\nconsole.log(''πŸ§ͺ Testing macOS 13/14 path (forced AVFoundation)'');\nconst MacRecorder = require(''./index'');\nconst recorder = new MacRecorder();\n\nasync function testMacOS1314Path() {\n try {\n const outputPath = ''./test-output/macos1314-test.mov'';\n console.log(''πŸ“Ή Starting test for macOS 13/14 path...'');\n console.log(''This simulates the exact path macOS 13/14 users will take'');\n console.log('''');\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(''βœ… SUCCESS: Recording started on macOS 13/14 path!'');\n await new Promise(resolve => setTimeout(resolve, 3000));\n \n await recorder.stopRecording();\n console.log(''βœ… Recording completed successfully!'');\n console.log(''πŸ“ Output:'', outputPath);\n } else {\n console.log(''❌ Recording failed to start'');\n }\n } catch (error) {\n console.log(''❌ Error:'', error.message);\n console.log(''This error would be what macOS 13/14 users see'');\n }\n}\n\ntestMacOS1314Path();\n\")"
51
+ "Bash(FORCE_AVFOUNDATION=1 node -e \"\nconsole.log(''πŸ§ͺ Testing macOS 13/14 path (forced AVFoundation)'');\nconst MacRecorder = require(''./index'');\nconst recorder = new MacRecorder();\n\nasync function testMacOS1314Path() {\n try {\n const outputPath = ''./test-output/macos1314-test.mov'';\n console.log(''πŸ“Ή Starting test for macOS 13/14 path...'');\n console.log(''This simulates the exact path macOS 13/14 users will take'');\n console.log('''');\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(''βœ… SUCCESS: Recording started on macOS 13/14 path!'');\n await new Promise(resolve => setTimeout(resolve, 3000));\n \n await recorder.stopRecording();\n console.log(''βœ… Recording completed successfully!'');\n console.log(''πŸ“ Output:'', outputPath);\n } else {\n console.log(''❌ Recording failed to start'');\n }\n } catch (error) {\n console.log(''❌ Error:'', error.message);\n console.log(''This error would be what macOS 13/14 users see'');\n }\n}\n\ntestMacOS1314Path();\n\")",
52
+ "Bash(FORCE_AVFOUNDATION=1 node -e \"\nconsole.log(''πŸ§ͺ Testing macOS 14 Direct AVFoundation Path'');\nconst MacRecorder = require(''./index'');\nconst recorder = new MacRecorder();\n\nasync function testDirectAVFoundation() {\n try {\n const outputPath = ''./test-output/direct-avfoundation-test.mov'';\n console.log(''πŸ“Ή Testing direct AVFoundation path (macOS 14 simulation)...'');\n console.log(''Expected logs:'');\n console.log('' 🎯 macOS 14 detected - directly using AVFoundation'');\n console.log('' ⏭️ Skipping ScreenCaptureKit completely, jumping to AVFoundation'');\n console.log('' 🎬 AVFoundation: Starting recording initialization'');\n console.log('''');\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(''βœ… SUCCESS: Direct AVFoundation path works!'');\n await new Promise(resolve => setTimeout(resolve, 3000));\n \n await recorder.stopRecording();\n console.log(''βœ… Recording completed successfully!'');\n console.log('''');\n console.log(''πŸŽ‰ This is exactly how macOS 14 will work:'');\n console.log(''βœ… No ScreenCaptureKit attempts'');\n console.log(''βœ… Direct AVFoundation usage'');\n console.log(''βœ… No permission errors'');\n } else {\n console.log(''❌ Recording failed'');\n }\n } catch (error) {\n console.log(''❌ Error:'', error.message);\n }\n}\n\ntestDirectAVFoundation();\n\")"
52
53
  ],
53
54
  "deny": []
54
55
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-mac-recorder",
3
- "version": "2.16.4",
3
+ "version": "2.16.6",
4
4
  "description": "Native macOS screen recording package for Node.js applications",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -206,7 +206,7 @@ Napi::Value StartRecording(const Napi::CallbackInfo& info) {
206
206
  }
207
207
 
208
208
  // Use ScreenCaptureKit only on macOS 15+ for maximum stability
209
- // macOS 14 should use AVFoundation fallback
209
+ // macOS 14/13 should skip ScreenCaptureKit completely and use AVFoundation
210
210
  if (@available(macOS 12.3, *) && isM15Plus && !forceAVFoundation) {
211
211
  NSLog(@"βœ… macOS 15+ detected - ScreenCaptureKit available with full compatibility");
212
212
 
@@ -280,20 +280,23 @@ Napi::Value StartRecording(const Napi::CallbackInfo& info) {
280
280
  NSLog(@"❌ Exception during ScreenCaptureKit availability check: %@", availabilityException.reason);
281
281
  return Napi::Boolean::New(env, false);
282
282
  }
283
- } else if (isM14Plus) {
284
- // macOS 14 - directly use AVFoundation for better compatibility
283
+ } else if (isM14Plus && !isElectron) {
284
+ // macOS 14 - directly use AVFoundation, skip all ScreenCaptureKit logic
285
285
  NSLog(@"🎯 macOS 14 detected - directly using AVFoundation for better compatibility");
286
- // Skip ScreenCaptureKit completely and go directly to AVFoundation
287
- } else if (isM13Plus) {
288
- // macOS 13 - use AVFoundation (limited features)
286
+ NSLog(@"⏭️ Skipping ScreenCaptureKit completely, jumping to AVFoundation");
287
+ goto useAVFoundation;
288
+ } else if (isM13Plus && !isElectron) {
289
+ // macOS 13 - directly use AVFoundation, skip all ScreenCaptureKit logic
289
290
  NSLog(@"🎯 macOS 13 detected - directly using AVFoundation (limited features)");
290
- // Skip ScreenCaptureKit completely and go directly to AVFoundation
291
+ NSLog(@"⏭️ Skipping ScreenCaptureKit completely, jumping to AVFoundation");
292
+ goto useAVFoundation;
291
293
  } else {
292
- NSLog(@"❌ macOS version too old (< 13.0) - Recording not supported");
294
+ NSLog(@"❌ macOS version too old (< 13.0) or Electron environment - Recording not supported");
293
295
  return Napi::Boolean::New(env, false);
294
296
  }
295
297
 
296
298
  // AVFoundation fallback logic
299
+ useAVFoundation:
297
300
  if (isElectron) {
298
301
  NSLog(@"❌ ScreenCaptureKit failed in Electron - AVFoundation disabled for stability");
299
302
  NSLog(@"❌ Recording not available in Electron when ScreenCaptureKit fails");
@@ -0,0 +1,81 @@
1
+ const MacRecorder = require('./index');
2
+
3
+ console.log('πŸ” Console Log Detection Test');
4
+ console.log('This test shows which recording method is being used');
5
+ console.log('========================================================');
6
+
7
+ async function testConsoleOutput() {
8
+ const recorder = new MacRecorder();
9
+
10
+ try {
11
+ console.log('πŸ“‹ Starting recording test...');
12
+ console.log('Expected to see detailed native logs in Console.app or terminal');
13
+ console.log('');
14
+
15
+ const outputPath = './test-output/console-log-test.mov';
16
+
17
+ // Create test output directory
18
+ const fs = require('fs');
19
+ if (!fs.existsSync('./test-output')) {
20
+ fs.mkdirSync('./test-output');
21
+ }
22
+
23
+ console.log('🎬 Calling startRecording...');
24
+ const result = await recorder.startRecording(outputPath, {
25
+ captureCursor: false,
26
+ includeMicrophone: false,
27
+ includeSystemAudio: false,
28
+ displayId: 1
29
+ });
30
+
31
+ if (result) {
32
+ console.log('βœ… Recording started successfully!');
33
+ console.log('πŸ“ Result:', result);
34
+
35
+ await new Promise(resolve => setTimeout(resolve, 2000));
36
+
37
+ console.log('πŸ›‘ Stopping recording...');
38
+ await recorder.stopRecording();
39
+ console.log('βœ… Recording stopped');
40
+
41
+ // Check what method was used by looking at file size/existence
42
+ if (fs.existsSync(outputPath)) {
43
+ const stats = fs.statSync(outputPath);
44
+ console.log('πŸ“ File created:', stats.size, 'bytes');
45
+ console.log('');
46
+ console.log('πŸŽ‰ SUCCESS: Recording works!');
47
+ }
48
+ } else {
49
+ console.log('❌ Recording failed');
50
+ }
51
+
52
+ } catch (error) {
53
+ console.log('❌ JavaScript Error:', error.message);
54
+ console.log('❌ This is the error your app would see');
55
+
56
+ // Check if it's the old error message
57
+ if (error.message.includes('ScreenCaptureKit failed')) {
58
+ console.log('');
59
+ console.log('🚨 PROBLEM: Still seeing old ScreenCaptureKit error');
60
+ console.log(' This means the new logic is not being used');
61
+ console.log(' Possible causes:');
62
+ console.log(' 1. Module not rebuilt properly');
63
+ console.log(' 2. Cache issue');
64
+ console.log(' 3. Wrong macOS version detection');
65
+ }
66
+ }
67
+
68
+ console.log('');
69
+ console.log('πŸ“Š If you see this test:');
70
+ console.log('βœ… Module loads correctly');
71
+ console.log('βœ… JavaScript layer works');
72
+ console.log('❓ Check Console.app for native logs');
73
+ console.log('');
74
+ console.log('πŸ” To see native logs:');
75
+ console.log(' 1. Open Console.app');
76
+ console.log(' 2. Filter by "node" process');
77
+ console.log(' 3. Look for "🎯 Smart Recording Engine Selection"');
78
+ console.log(' 4. Look for "macOS Version:" detection');
79
+ }
80
+
81
+ testConsoleOutput();
@@ -0,0 +1,107 @@
1
+ // macOS 14 test simΓΌlasyonu - detaylΔ± debug bilgisiyle
2
+ const MacRecorder = require('./index');
3
+
4
+ console.log('πŸ§ͺ macOS 14 Forced Test with Detailed Debugging');
5
+ console.log('====================================================');
6
+ console.log('');
7
+ console.log('This test simulates exactly what happens on macOS 14');
8
+ console.log('by forcing the AVFoundation path.');
9
+ console.log('');
10
+
11
+ // Force AVFoundation environment variable
12
+ process.env.FORCE_AVFOUNDATION = '1';
13
+
14
+ async function testMacOS14Scenario() {
15
+ const recorder = new MacRecorder();
16
+
17
+ console.log('πŸ“‹ Test Configuration:');
18
+ console.log(' - FORCE_AVFOUNDATION = 1 (simulates macOS 14)');
19
+ console.log(' - Expected: Skip ScreenCaptureKit, use AVFoundation');
20
+ console.log(' - Should see: "πŸŽ₯ Using AVFoundation" logs');
21
+ console.log('');
22
+
23
+ try {
24
+ const outputPath = './test-output/macos14-forced.mov';
25
+
26
+ // Create directory
27
+ const fs = require('fs');
28
+ if (!fs.existsSync('./test-output')) {
29
+ fs.mkdirSync('./test-output');
30
+ }
31
+
32
+ console.log('🎬 Starting recording (macOS 14 simulation)...');
33
+ console.log('Expected Console Logs:');
34
+ console.log(' πŸ”§ FORCE_AVFOUNDATION environment variable detected');
35
+ console.log(' 🎯 macOS 14 detected - directly using AVFoundation');
36
+ console.log(' πŸŽ₯ Using AVFoundation for macOS 14 compatibility');
37
+ console.log(' 🎬 AVFoundation: Starting recording initialization');
38
+ console.log(' βœ… AVFoundation recording started successfully');
39
+ console.log('');
40
+
41
+ const result = await recorder.startRecording(outputPath, {
42
+ captureCursor: true,
43
+ includeMicrophone: false,
44
+ includeSystemAudio: true,
45
+ displayId: 1
46
+ });
47
+
48
+ if (result) {
49
+ console.log('πŸŽ‰ SUCCESS: macOS 14 path works!');
50
+ console.log('πŸ“ Output file:', result);
51
+ console.log('⏱️ Recording for 3 seconds...');
52
+
53
+ await new Promise(resolve => setTimeout(resolve, 3000));
54
+
55
+ console.log('πŸ›‘ Stopping recording...');
56
+ await recorder.stopRecording();
57
+
58
+ // Verify file
59
+ if (fs.existsSync(outputPath)) {
60
+ const stats = fs.statSync(outputPath);
61
+ console.log('βœ… Recording file created successfully');
62
+ console.log(' File size:', Math.round(stats.size / 1024), 'KB');
63
+ console.log('');
64
+ console.log('πŸŽ‰ macOS 14 Recording Test: PASSED βœ…');
65
+ console.log('');
66
+ console.log('This means on real macOS 14 systems:');
67
+ console.log('βœ… Version detection will work');
68
+ console.log('βœ… AVFoundation will be used as primary method');
69
+ console.log('βœ… No ScreenCaptureKit errors will occur');
70
+ console.log('βœ… Recording will work with 15fps H.264 encoding');
71
+ } else {
72
+ console.log('❌ No output file created');
73
+ }
74
+
75
+ } else {
76
+ console.log('❌ Recording failed to start');
77
+ }
78
+
79
+ } catch (error) {
80
+ console.log('❌ Error:', error.message);
81
+
82
+ // Check if user is getting old error
83
+ if (error.message.includes('ScreenCaptureKit failed')) {
84
+ console.log('');
85
+ console.log('🚨 CRITICAL: You are seeing the OLD error message!');
86
+ console.log('');
87
+ console.log('This means:');
88
+ console.log('❌ You are using an old version of node-mac-recorder');
89
+ console.log('❌ The new macOS 14/13 compatibility is not active');
90
+ console.log('');
91
+ console.log('πŸ”§ To fix this:');
92
+ console.log('1. Update to the latest version: npm update node-mac-recorder');
93
+ console.log('2. Or rebuild: npm run build');
94
+ console.log('3. Or reinstall: npm uninstall node-mac-recorder && npm install node-mac-recorder');
95
+ console.log('');
96
+ console.log('Expected NEW error message should be:');
97
+ console.log('"Recording failed to start. Check permissions, output path, and system compatibility."');
98
+ } else {
99
+ console.log('βœ… Error message is updated (good sign)');
100
+ }
101
+ }
102
+
103
+ // Reset environment
104
+ delete process.env.FORCE_AVFOUNDATION;
105
+ }
106
+
107
+ testMacOS14Scenario();