node-mac-recorder 2.12.0 → 2.12.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/package.json +1 -1
- package/src/mac_recorder.mm +3 -0
- package/src/screen_capture_kit.mm +34 -2
package/package.json
CHANGED
package/src/mac_recorder.mm
CHANGED
|
@@ -188,6 +188,7 @@ Napi::Value StartRecording(const Napi::CallbackInfo& info) {
|
|
|
188
188
|
if ([ScreenCaptureKitRecorder startRecordingWithConfiguration:sckConfig
|
|
189
189
|
delegate:g_delegate
|
|
190
190
|
error:&sckError]) {
|
|
191
|
+
NSLog(@"🎬 RECORDING METHOD: ScreenCaptureKit");
|
|
191
192
|
NSLog(@"✅ ScreenCaptureKit recording started with window exclusion");
|
|
192
193
|
g_isRecording = true;
|
|
193
194
|
return Napi::Boolean::New(env, true);
|
|
@@ -198,6 +199,7 @@ Napi::Value StartRecording(const Napi::CallbackInfo& info) {
|
|
|
198
199
|
}
|
|
199
200
|
|
|
200
201
|
// Fallback: Use AVFoundation (older macOS or ScreenCaptureKit failure)
|
|
202
|
+
NSLog(@"🎬 RECORDING METHOD: AVFoundation");
|
|
201
203
|
NSLog(@"📼 Falling back to AVFoundation - overlay windows may appear in recording");
|
|
202
204
|
|
|
203
205
|
// Create capture session
|
|
@@ -356,6 +358,7 @@ Napi::Value StartRecording(const Napi::CallbackInfo& info) {
|
|
|
356
358
|
NSURL *outputURL = [NSURL fileURLWithPath:[NSString stringWithUTF8String:outputPath.c_str()]];
|
|
357
359
|
[g_movieFileOutput startRecordingToOutputFileURL:outputURL recordingDelegate:g_delegate];
|
|
358
360
|
|
|
361
|
+
NSLog(@"✅ AVFoundation recording started");
|
|
359
362
|
g_isRecording = true;
|
|
360
363
|
return Napi::Boolean::New(env, true);
|
|
361
364
|
|
|
@@ -74,11 +74,43 @@ static BOOL g_isRecording = NO;
|
|
|
74
74
|
// Also try to exclude Electron app if running (common overlay use case)
|
|
75
75
|
for (SCWindow *window in content.windows) {
|
|
76
76
|
NSString *appName = window.owningApplication.applicationName;
|
|
77
|
+
NSString *windowTitle = window.title ? window.title : @"<No Title>";
|
|
78
|
+
|
|
79
|
+
// Debug: Log all windows to see what we're dealing with (only for small subset)
|
|
80
|
+
if ([appName containsString:@"Electron"] || [windowTitle containsString:@"camera"]) {
|
|
81
|
+
NSLog(@"📋 Found potential exclude window: '%@' from app: '%@' (PID: %d, Level: %ld)",
|
|
82
|
+
windowTitle, appName, window.owningApplication.processID, (long)window.windowLayer);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Comprehensive Electron window detection
|
|
86
|
+
BOOL shouldExclude = NO;
|
|
87
|
+
|
|
88
|
+
// Check app name patterns
|
|
77
89
|
if ([appName containsString:@"Electron"] ||
|
|
78
90
|
[appName isEqualToString:@"electron"] ||
|
|
79
|
-
[
|
|
91
|
+
[appName isEqualToString:@"Electron Helper"]) {
|
|
92
|
+
shouldExclude = YES;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Check window title patterns
|
|
96
|
+
if ([windowTitle containsString:@"Electron"] ||
|
|
97
|
+
[windowTitle containsString:@"camera"] ||
|
|
98
|
+
[windowTitle containsString:@"Camera"] ||
|
|
99
|
+
[windowTitle containsString:@"overlay"] ||
|
|
100
|
+
[windowTitle containsString:@"Overlay"]) {
|
|
101
|
+
shouldExclude = YES;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Check window properties (transparent, always on top windows)
|
|
105
|
+
if (window.windowLayer > 100) { // High window levels (like alwaysOnTop)
|
|
106
|
+
shouldExclude = YES;
|
|
107
|
+
NSLog(@"📋 High-level window detected: '%@' (Level: %ld)", windowTitle, (long)window.windowLayer);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (shouldExclude) {
|
|
80
111
|
[excludedWindows addObject:window];
|
|
81
|
-
NSLog(@"🚫 Excluding
|
|
112
|
+
NSLog(@"🚫 Excluding window: '%@' from %@ (PID: %d, Level: %ld)",
|
|
113
|
+
windowTitle, appName, window.owningApplication.processID, (long)window.windowLayer);
|
|
82
114
|
}
|
|
83
115
|
}
|
|
84
116
|
|