node-mac-recorder 2.14.0 → 2.15.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-mac-recorder",
3
- "version": "2.14.0",
3
+ "version": "2.15.0",
4
4
  "description": "Native macOS screen recording package for Node.js applications",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -45,14 +45,14 @@ static NSString *g_outputPath = nil;
45
45
  // Extract configuration options
46
46
  NSNumber *displayId = config[@"displayId"];
47
47
  NSNumber *windowId = config[@"windowId"];
48
- NSValue *captureAreaValue = config[@"captureArea"];
48
+ NSDictionary *captureRect = config[@"captureRect"];
49
49
  NSNumber *captureCursor = config[@"captureCursor"];
50
50
  NSNumber *includeMicrophone = config[@"includeMicrophone"];
51
51
  NSNumber *includeSystemAudio = config[@"includeSystemAudio"];
52
52
 
53
53
  NSLog(@"🎬 Starting PURE ScreenCaptureKit recording (NO AVFoundation)");
54
- NSLog(@"🔧 Config: cursor=%@ mic=%@ system=%@ display=%@ window=%@",
55
- captureCursor, includeMicrophone, includeSystemAudio, displayId, windowId);
54
+ NSLog(@"🔧 Config: cursor=%@ mic=%@ system=%@ display=%@ window=%@ crop=%@",
55
+ captureCursor, includeMicrophone, includeSystemAudio, displayId, windowId, captureRect);
56
56
 
57
57
  // Get shareable content
58
58
  [SCShareableContent getShareableContentWithCompletionHandler:^(SCShareableContent *content, NSError *contentError) {
@@ -121,6 +121,20 @@ static NSString *g_outputPath = nil;
121
121
  recordingHeight = targetDisplay.height;
122
122
  }
123
123
 
124
+ // CROP AREA SUPPORT - Adjust dimensions and source rect
125
+ if (captureRect && captureRect[@"width"] && captureRect[@"height"]) {
126
+ CGFloat cropWidth = [captureRect[@"width"] doubleValue];
127
+ CGFloat cropHeight = [captureRect[@"height"] doubleValue];
128
+
129
+ if (cropWidth > 0 && cropHeight > 0) {
130
+ NSLog(@"🔲 Crop area specified: %.0fx%.0f at (%.0f,%.0f)",
131
+ cropWidth, cropHeight,
132
+ [captureRect[@"x"] doubleValue], [captureRect[@"y"] doubleValue]);
133
+ recordingWidth = (NSInteger)cropWidth;
134
+ recordingHeight = (NSInteger)cropHeight;
135
+ }
136
+ }
137
+
124
138
  // Configure stream with extracted options
125
139
  SCStreamConfiguration *streamConfig = [[SCStreamConfiguration alloc] init];
126
140
  streamConfig.width = recordingWidth;
@@ -129,6 +143,20 @@ static NSString *g_outputPath = nil;
129
143
  streamConfig.pixelFormat = kCVPixelFormatType_32BGRA;
130
144
  streamConfig.scalesToFit = NO;
131
145
 
146
+ // Apply crop area using sourceRect
147
+ if (captureRect && captureRect[@"x"] && captureRect[@"y"] && captureRect[@"width"] && captureRect[@"height"]) {
148
+ CGFloat cropX = [captureRect[@"x"] doubleValue];
149
+ CGFloat cropY = [captureRect[@"y"] doubleValue];
150
+ CGFloat cropWidth = [captureRect[@"width"] doubleValue];
151
+ CGFloat cropHeight = [captureRect[@"height"] doubleValue];
152
+
153
+ if (cropWidth > 0 && cropHeight > 0) {
154
+ CGRect sourceRect = CGRectMake(cropX, cropY, cropWidth, cropHeight);
155
+ streamConfig.sourceRect = sourceRect;
156
+ NSLog(@"✂️ Crop sourceRect applied: (%.0f,%.0f) %.0fx%.0f", cropX, cropY, cropWidth, cropHeight);
157
+ }
158
+ }
159
+
132
160
  // CURSOR SUPPORT
133
161
  BOOL shouldShowCursor = captureCursor ? [captureCursor boolValue] : YES;
134
162
  streamConfig.showsCursor = shouldShowCursor;