node-mac-recorder 2.19.4 → 2.19.5
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/.claude/settings.local.json +6 -2
- package/README.md +2 -0
- package/binding.gyp +1 -9
- package/package.json +1 -1
- package/src/screen_capture_kit.mm +23 -14
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# node-mac-recorder
|
|
2
2
|
|
|
3
|
+
*This package was developed for [https://creavit.studio](https://creavit.studio)*
|
|
4
|
+
|
|
3
5
|
A powerful native macOS screen recording Node.js package with advanced window selection, multi-display support, and automatic overlay window exclusion. Built with ScreenCaptureKit for modern macOS with intelligent window filtering and Electron compatibility.
|
|
4
6
|
|
|
5
7
|
## Features
|
package/binding.gyp
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"libraries": [
|
|
31
31
|
"-framework Foundation",
|
|
32
32
|
"-framework AppKit",
|
|
33
|
+
"-framework ScreenCaptureKit",
|
|
33
34
|
"-framework AVFoundation",
|
|
34
35
|
"-framework CoreMedia",
|
|
35
36
|
"-framework CoreVideo",
|
|
@@ -40,15 +41,6 @@
|
|
|
40
41
|
"-framework CoreAudio"
|
|
41
42
|
]
|
|
42
43
|
},
|
|
43
|
-
"conditions": [
|
|
44
|
-
['OS=="mac"', {
|
|
45
|
-
"link_settings": {
|
|
46
|
-
"libraries": [
|
|
47
|
-
"-weak_framework ScreenCaptureKit"
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
}]
|
|
51
|
-
],
|
|
52
44
|
"defines": [ "NAPI_DISABLE_CPP_EXCEPTIONS" ]
|
|
53
45
|
}
|
|
54
46
|
]
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// Pure ScreenCaptureKit implementation - NO AVFoundation
|
|
4
4
|
static SCStream * API_AVAILABLE(macos(12.3)) g_stream = nil;
|
|
5
|
-
static
|
|
5
|
+
static id g_recordingOutput API_AVAILABLE(macos(15.0)) = nil;
|
|
6
6
|
static id<SCStreamDelegate> API_AVAILABLE(macos(12.3)) g_streamDelegate = nil;
|
|
7
7
|
static BOOL g_isRecording = NO;
|
|
8
8
|
static BOOL g_isCleaningUp = NO; // Prevent recursive cleanup
|
|
@@ -42,7 +42,8 @@ static NSString *g_outputPath = nil;
|
|
|
42
42
|
|
|
43
43
|
+ (BOOL)isScreenCaptureKitAvailable {
|
|
44
44
|
if (@available(macOS 15.0, *)) {
|
|
45
|
-
|
|
45
|
+
Class recordingOutputClass = NSClassFromString(@"SCRecordingOutput");
|
|
46
|
+
return [SCShareableContent class] != nil && [SCStream class] != nil && recordingOutputClass != nil;
|
|
46
47
|
}
|
|
47
48
|
return NO;
|
|
48
49
|
}
|
|
@@ -275,17 +276,23 @@ static NSString *g_outputPath = nil;
|
|
|
275
276
|
}
|
|
276
277
|
|
|
277
278
|
if (@available(macOS 15.0, *)) {
|
|
278
|
-
// Create recording output configuration
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
279
|
+
// Create recording output configuration using runtime class lookup
|
|
280
|
+
Class recordingConfigClass = NSClassFromString(@"SCRecordingOutputConfiguration");
|
|
281
|
+
Class recordingOutputClass = NSClassFromString(@"SCRecordingOutput");
|
|
282
|
+
|
|
283
|
+
if (recordingConfigClass && recordingOutputClass) {
|
|
284
|
+
id recordingConfig = [[recordingConfigClass alloc] init];
|
|
285
|
+
[recordingConfig setValue:outputURL forKey:@"outputURL"];
|
|
286
|
+
// Use string constant for video codec
|
|
287
|
+
[recordingConfig setValue:@"avc1" forKey:@"videoCodecType"];
|
|
288
|
+
|
|
289
|
+
// Audio configuration - using available properties
|
|
290
|
+
// Note: Specific audio routing handled by ScreenCaptureKit automatically
|
|
291
|
+
|
|
292
|
+
// Create recording output with correct initializer
|
|
293
|
+
g_recordingOutput = [[recordingOutputClass alloc] initWithConfiguration:recordingConfig
|
|
294
|
+
delegate:nil];
|
|
295
|
+
}
|
|
289
296
|
if (shouldCaptureMic && shouldCaptureSystemAudio) {
|
|
290
297
|
NSLog(@"🔧 Created SCRecordingOutput with microphone and system audio");
|
|
291
298
|
} else if (shouldCaptureMic) {
|
|
@@ -320,7 +327,9 @@ static NSString *g_outputPath = nil;
|
|
|
320
327
|
BOOL outputAdded = NO;
|
|
321
328
|
|
|
322
329
|
if (@available(macOS 15.0, *)) {
|
|
323
|
-
|
|
330
|
+
if (g_recordingOutput && [g_stream respondsToSelector:@selector(addRecordingOutput:error:)]) {
|
|
331
|
+
outputAdded = [g_stream addRecordingOutput:g_recordingOutput error:&outputError];
|
|
332
|
+
}
|
|
324
333
|
}
|
|
325
334
|
|
|
326
335
|
if (!outputAdded || outputError) {
|