node-mac-recorder 2.12.4 → 2.13.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 +1 -1
- package/src/mac_recorder.mm +36 -7
- package/src/screen_capture_kit.h +1 -4
- package/src/screen_capture_kit.mm +222 -339
- package/src/screen_capture_kit_backup.mm +507 -0
- package/src/screen_capture_kit_new.mm +240 -0
- package/src/screen_capture_kit_simple.mm +302 -0
- package/src/window_selector.mm +31 -1
package/package.json
CHANGED
package/src/mac_recorder.mm
CHANGED
|
@@ -14,9 +14,13 @@
|
|
|
14
14
|
// Cursor tracker function declarations
|
|
15
15
|
Napi::Object InitCursorTracker(Napi::Env env, Napi::Object exports);
|
|
16
16
|
|
|
17
|
-
// Window selector function declarations
|
|
17
|
+
// Window selector function declarations
|
|
18
18
|
Napi::Object InitWindowSelector(Napi::Env env, Napi::Object exports);
|
|
19
19
|
|
|
20
|
+
// Window selector overlay functions (external)
|
|
21
|
+
extern "C" void hideOverlays();
|
|
22
|
+
extern "C" void showOverlays();
|
|
23
|
+
|
|
20
24
|
@interface MacRecorderDelegate : NSObject <AVCaptureFileOutputRecordingDelegate>
|
|
21
25
|
@property (nonatomic, copy) void (^completionHandler)(NSURL *outputURL, NSError *error);
|
|
22
26
|
@end
|
|
@@ -50,6 +54,10 @@ void cleanupRecording() {
|
|
|
50
54
|
g_screenInput = nil;
|
|
51
55
|
g_audioInput = nil;
|
|
52
56
|
g_delegate = nil;
|
|
57
|
+
|
|
58
|
+
// Show overlay windows again after cleanup
|
|
59
|
+
showOverlays();
|
|
60
|
+
|
|
53
61
|
g_isRecording = false;
|
|
54
62
|
}
|
|
55
63
|
|
|
@@ -208,9 +216,12 @@ Napi::Value StartRecording(const Napi::CallbackInfo& info) {
|
|
|
208
216
|
NSLog(@"❌ macOS version too old for ScreenCaptureKit (< 12.3)");
|
|
209
217
|
}
|
|
210
218
|
|
|
211
|
-
// Fallback: Use AVFoundation
|
|
219
|
+
// Fallback: Use AVFoundation with overlay hiding
|
|
212
220
|
NSLog(@"🎬 RECORDING METHOD: AVFoundation");
|
|
213
|
-
NSLog(@"📼
|
|
221
|
+
NSLog(@"📼 Using AVFoundation with overlay hiding for video compatibility");
|
|
222
|
+
|
|
223
|
+
// Hide overlay windows during recording
|
|
224
|
+
hideOverlays();
|
|
214
225
|
|
|
215
226
|
// Create capture session
|
|
216
227
|
g_captureSession = [[AVCaptureSession alloc] init];
|
|
@@ -382,11 +393,31 @@ Napi::Value StartRecording(const Napi::CallbackInfo& info) {
|
|
|
382
393
|
Napi::Value StopRecording(const Napi::CallbackInfo& info) {
|
|
383
394
|
Napi::Env env = info.Env();
|
|
384
395
|
|
|
396
|
+
NSLog(@"📞 StopRecording native method called");
|
|
397
|
+
|
|
398
|
+
// Check if ScreenCaptureKit is recording first
|
|
399
|
+
BOOL screenCaptureKitStopped = NO;
|
|
400
|
+
if (@available(macOS 12.3, *)) {
|
|
401
|
+
if ([ScreenCaptureKitRecorder isRecording]) {
|
|
402
|
+
NSLog(@"🛑 Stopping ScreenCaptureKit recording");
|
|
403
|
+
[ScreenCaptureKitRecorder stopRecording];
|
|
404
|
+
screenCaptureKitStopped = YES;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// If ScreenCaptureKit handled it, return early
|
|
409
|
+
if (screenCaptureKitStopped) {
|
|
410
|
+
return Napi::Boolean::New(env, true);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
// Otherwise, handle AVFoundation recording
|
|
385
414
|
if (!g_isRecording || !g_movieFileOutput) {
|
|
415
|
+
NSLog(@"❌ No AVFoundation recording in progress");
|
|
386
416
|
return Napi::Boolean::New(env, false);
|
|
387
417
|
}
|
|
388
418
|
|
|
389
419
|
@try {
|
|
420
|
+
NSLog(@"🛑 Stopping AVFoundation recording");
|
|
390
421
|
if (g_movieFileOutput) {
|
|
391
422
|
[g_movieFileOutput stopRecording];
|
|
392
423
|
}
|
|
@@ -394,10 +425,8 @@ Napi::Value StopRecording(const Napi::CallbackInfo& info) {
|
|
|
394
425
|
[g_captureSession stopRunning];
|
|
395
426
|
}
|
|
396
427
|
|
|
397
|
-
//
|
|
398
|
-
|
|
399
|
-
[ScreenCaptureKitRecorder stopRecording];
|
|
400
|
-
}
|
|
428
|
+
// Show overlay windows again after recording
|
|
429
|
+
showOverlays();
|
|
401
430
|
|
|
402
431
|
g_isRecording = false;
|
|
403
432
|
return Napi::Boolean::New(env, true);
|
package/src/screen_capture_kit.h
CHANGED
|
@@ -11,9 +11,6 @@ API_AVAILABLE(macos(12.3))
|
|
|
11
11
|
error:(NSError **)error;
|
|
12
12
|
+ (void)stopRecording;
|
|
13
13
|
+ (BOOL)isRecording;
|
|
14
|
-
+ (
|
|
15
|
-
height:(NSInteger)height
|
|
16
|
-
outputPath:(NSString *)outputPath
|
|
17
|
-
includeAudio:(BOOL)includeAudio;
|
|
14
|
+
+ (void)createVideoFromFrames;
|
|
18
15
|
|
|
19
16
|
@end
|