node-mac-recorder 2.16.14 โ†’ 2.16.15

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "permissions": {
3
3
  "allow": [
4
- "Bash(FORCE_AVFOUNDATION=1 node -e \"\nconsole.log(''๐Ÿงช Testing AVFoundation area recording...'');\nconst MacRecorder = require(''./index.js'');\nconst recorder = new MacRecorder();\n\n// Test specific area recording (top-left 500x500)\nconst options = {\n captureArea: {\n x: 100,\n y: 100, \n width: 500,\n height: 500\n }\n};\n\nrecorder.startRecording(''/tmp/area-test.mov'', options)\n .then(success => {\n console.log(''Area recording:'', success ? ''โœ… SUCCESS'' : ''โŒ FAILED'');\n if (success) {\n setTimeout(() => {\n recorder.stopRecording().then(() => {\n console.log(''โœ… Area recording complete'');\n const fs = require(''fs'');\n if (fs.existsSync(''/tmp/area-test.mov'')) {\n const size = Math.round(fs.statSync(''/tmp/area-test.mov'').size/1024);\n console.log(''๐Ÿ“น File size:'', size + ''KB'');\n }\n });\n }, 2000);\n }\n })\n .catch(console.error);\n\")"
4
+ "Bash(FORCE_AVFOUNDATION=1 node -e \"\nconsole.log(''๐Ÿงช Testing area recording with scaling...'');\nconst MacRecorder = require(''./index.js'');\nconst recorder = new MacRecorder();\n\nconst options = {\n captureArea: {\n x: 200,\n y: 200, \n width: 800,\n height: 600\n }\n};\n\nrecorder.startRecording(''/tmp/area-scaling-test.mov'', options)\n .then(success => {\n console.log(''Area recording:'', success ? ''โœ… SUCCESS'' : ''โŒ FAILED'');\n if (success) {\n setTimeout(() => {\n recorder.stopRecording().then(() => {\n console.log(''โœ… Area scaling test complete'');\n const fs = require(''fs'');\n if (fs.existsSync(''/tmp/area-scaling-test.mov'')) {\n const size = Math.round(fs.statSync(''/tmp/area-scaling-test.mov'').size/1024);\n console.log(''๐Ÿ“น File size:'', size + ''KB'');\n }\n });\n }, 2000);\n }\n })\n .catch(console.error);\n\")"
5
5
  ],
6
6
  "deny": [],
7
7
  "ask": []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-mac-recorder",
3
- "version": "2.16.14",
3
+ "version": "2.16.15",
4
4
  "description": "Native macOS screen recording package for Node.js applications",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -53,14 +53,33 @@ extern "C" bool startAVFoundationRecording(const std::string& outputPath,
53
53
  return false;
54
54
  }
55
55
 
56
- // Get display dimensions - use width/height directly to avoid coordinate issues
56
+ // Get display dimensions with proper scaling for macOS 14/13 compatibility
57
57
  CGRect displayBounds = CGDisplayBounds(displayID);
58
- CGSize displaySize = CGSizeMake(CGDisplayPixelsWide(displayID), CGDisplayPixelsHigh(displayID));
59
- CGSize recordingSize = captureRect.size.width > 0 ? captureRect.size : displaySize;
60
58
 
61
- NSLog(@"๐Ÿ–ฅ๏ธ Display bounds: %.0f,%.0f %.0fx%.0f", displayBounds.origin.x, displayBounds.origin.y, displayBounds.size.width, displayBounds.size.height);
62
- NSLog(@"๐Ÿ–ฅ๏ธ Display pixels: %.0fx%.0f", displaySize.width, displaySize.height);
63
- NSLog(@"๐ŸŽฏ Recording size: %.0fx%.0f", recordingSize.width, recordingSize.height);
59
+ // Get both logical (bounds) and physical (pixels) dimensions
60
+ CGSize logicalSize = displayBounds.size;
61
+ CGSize physicalSize = CGSizeMake(CGDisplayPixelsWide(displayID), CGDisplayPixelsHigh(displayID));
62
+
63
+ // Calculate scale factor
64
+ CGFloat scaleX = physicalSize.width / logicalSize.width;
65
+ CGFloat scaleY = physicalSize.height / logicalSize.height;
66
+ CGFloat scaleFactor = MAX(scaleX, scaleY); // Use max to handle non-uniform scaling
67
+
68
+ // For AVFoundation, use logical size (what CGDisplayCreateImage actually captures)
69
+ CGSize recordingSize = captureRect.size.width > 0 ? captureRect.size : logicalSize;
70
+
71
+ NSLog(@"๐Ÿ–ฅ๏ธ Display bounds (logical): %.0fx%.0f", logicalSize.width, logicalSize.height);
72
+ NSLog(@"๐Ÿ–ฅ๏ธ Display pixels (physical): %.0fx%.0f", physicalSize.width, physicalSize.height);
73
+
74
+ if (scaleFactor > 1.5) {
75
+ NSLog(@"๐Ÿ” Scale factor: %.1fx โ†’ Retina display detected (macOS 14/13 scaling fix applied)", scaleFactor);
76
+ } else if (scaleFactor > 1.1) {
77
+ NSLog(@"๐Ÿ” Scale factor: %.1fx โ†’ Non-standard scaling detected", scaleFactor);
78
+ } else {
79
+ NSLog(@"๐Ÿ” Scale factor: %.1fx โ†’ Standard display", scaleFactor);
80
+ }
81
+
82
+ NSLog(@"๐ŸŽฏ Recording size: %.0fx%.0f (using logical dimensions for AVFoundation)", recordingSize.width, recordingSize.height);
64
83
 
65
84
  // Video settings with macOS compatibility
66
85
  NSString *codecKey;
@@ -123,9 +142,20 @@ extern "C" bool startAVFoundationRecording(const std::string& outputPath,
123
142
  g_avStartTime = CMTimeMakeWithSeconds(CACurrentMediaTime(), 600);
124
143
  [g_avWriter startSessionAtSourceTime:g_avStartTime];
125
144
 
126
- // Store recording parameters
145
+ // Store recording parameters with scaling correction
127
146
  g_avDisplayID = displayID;
128
- g_avCaptureRect = captureRect;
147
+
148
+ // Apply scaling to capture rect if provided (for macOS 14/13 compatibility)
149
+ if (!CGRectIsEmpty(captureRect)) {
150
+ // Note: captureRect comes in logical coordinates, keep as-is for CGDisplayCreateImage
151
+ g_avCaptureRect = captureRect;
152
+ NSLog(@"๐Ÿ”ฒ Capture area (logical): %.0f,%.0f %.0fx%.0f",
153
+ captureRect.origin.x, captureRect.origin.y, captureRect.size.width, captureRect.size.height);
154
+ } else {
155
+ g_avCaptureRect = CGRectZero; // Full screen
156
+ NSLog(@"๐Ÿ–ฅ๏ธ Full screen capture (logical bounds)");
157
+ }
158
+
129
159
  g_avFrameNumber = 0;
130
160
 
131
161
  // Start capture timer (10 FPS for Electron compatibility)