node-mac-recorder 2.22.24 → 2.22.32

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.
@@ -342,23 +342,17 @@ static void FinishWriter(AVAssetWriter *writer, AVAssetWriterInput *input) {
342
342
  if (!writer) {
343
343
  return;
344
344
  }
345
-
346
- // markAsFinished sadece AVAssetWriterStatusWriting (1) durumunda çağrılabilir
347
- // Status 0 (Unknown) veya diğer durumlarda crash eder
348
- if (input && writer.status == AVAssetWriterStatusWriting) {
345
+
346
+ if (input) {
349
347
  [input markAsFinished];
350
348
  }
351
-
352
- if (writer.status == AVAssetWriterStatusWriting) {
353
- dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
354
- [writer finishWritingWithCompletionHandler:^{
355
- dispatch_semaphore_signal(semaphore);
356
- }];
357
- dispatch_time_t timeout = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC));
358
- dispatch_semaphore_wait(semaphore, timeout);
359
- } else if (writer.status == AVAssetWriterStatusFailed) {
360
- NSLog(@"⚠️ Writer already failed: %@", writer.error);
361
- }
349
+
350
+ dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
351
+ [writer finishWritingWithCompletionHandler:^{
352
+ dispatch_semaphore_signal(semaphore);
353
+ }];
354
+ dispatch_time_t timeout = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC));
355
+ dispatch_semaphore_wait(semaphore, timeout);
362
356
  }
363
357
 
364
358
  static void CleanupWriters(void) {
@@ -379,10 +373,10 @@ static void CleanupWriters(void) {
379
373
  }
380
374
 
381
375
  if (g_audioWriter) {
382
- if (g_systemAudioInput && g_audioWriter.status == AVAssetWriterStatusWriting) {
376
+ if (g_systemAudioInput) {
383
377
  [g_systemAudioInput markAsFinished];
384
378
  }
385
- if (g_microphoneAudioInput && g_audioWriter.status == AVAssetWriterStatusWriting) {
379
+ if (g_microphoneAudioInput) {
386
380
  [g_microphoneAudioInput markAsFinished];
387
381
  }
388
382
  FinishWriter(g_audioWriter, nil);
@@ -57,9 +57,12 @@ static NSTimer *g_screenTrackingTimer = nil;
57
57
  static NSInteger g_currentActiveScreenIndex = -1;
58
58
 
59
59
  static bool shouldAllowElectronWindows() {
60
- NSString *flag = [[[NSProcessInfo processInfo] environment] objectForKey:@"CREAVIT_ALLOW_ELECTRON_WINDOWS"];
61
- if (!flag) return false;
60
+ // NSProcessInfo.environment snapshot'lanır ve runtime değişikliklerini yansıtmaz.
61
+ // getenv() ile process.env güncellemelerini her seferinde okuyoruz.
62
+ const char *raw = getenv("CREAVIT_ALLOW_ELECTRON_WINDOWS");
63
+ if (!raw) return false;
62
64
 
65
+ NSString *flag = [NSString stringWithUTF8String:raw];
63
66
  NSString *normalized = [[flag lowercaseString] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
64
67
  return [normalized isEqualToString:@"1"] ||
65
68
  [normalized isEqualToString:@"true"] ||
@@ -1,110 +0,0 @@
1
- "use strict";
2
-
3
- async function resolveCursorDisplayInfo(recorder, options) {
4
- if (options.videoRelative && options.displayInfo) {
5
- let videoOffsetX = 0;
6
- let videoOffsetY = 0;
7
- let videoWidth =
8
- options.displayInfo.width || options.displayInfo.logicalWidth;
9
- let videoHeight =
10
- options.displayInfo.height || options.displayInfo.logicalHeight;
11
-
12
- if (options.recordingType === "window" && options.windowId) {
13
- if (options.captureArea) {
14
- videoOffsetX = options.captureArea.x;
15
- videoOffsetY = options.captureArea.y;
16
- videoWidth = options.captureArea.width;
17
- videoHeight = options.captureArea.height;
18
- }
19
- } else if (options.recordingType === "area" && options.captureArea) {
20
- videoOffsetX = options.captureArea.x;
21
- videoOffsetY = options.captureArea.y;
22
- videoWidth = options.captureArea.width;
23
- videoHeight = options.captureArea.height;
24
- }
25
-
26
- recorder.cursorDisplayInfo = {
27
- displayId: options.displayInfo.displayId || options.displayInfo.id,
28
- displayX: options.displayInfo.x || 0,
29
- displayY: options.displayInfo.y || 0,
30
- displayWidth:
31
- options.displayInfo.width || options.displayInfo.logicalWidth,
32
- displayHeight:
33
- options.displayInfo.height || options.displayInfo.logicalHeight,
34
- videoOffsetX,
35
- videoOffsetY,
36
- videoWidth,
37
- videoHeight,
38
- videoRelative: true,
39
- recordingType: options.recordingType || "display",
40
- captureArea: options.captureArea,
41
- windowId: options.windowId,
42
- multiWindowBounds: options.multiWindowBounds || null,
43
- };
44
- return;
45
- }
46
-
47
- if (recorder.recordingDisplayInfo) {
48
- recorder.cursorDisplayInfo = {
49
- ...recorder.recordingDisplayInfo,
50
- displayX: recorder.recordingDisplayInfo.x || 0,
51
- displayY: recorder.recordingDisplayInfo.y || 0,
52
- displayWidth:
53
- recorder.recordingDisplayInfo.width ||
54
- recorder.recordingDisplayInfo.logicalWidth,
55
- displayHeight:
56
- recorder.recordingDisplayInfo.height ||
57
- recorder.recordingDisplayInfo.logicalHeight,
58
- videoOffsetX: 0,
59
- videoOffsetY: 0,
60
- videoWidth:
61
- recorder.recordingDisplayInfo.width ||
62
- recorder.recordingDisplayInfo.logicalWidth,
63
- videoHeight:
64
- recorder.recordingDisplayInfo.height ||
65
- recorder.recordingDisplayInfo.logicalHeight,
66
- videoRelative: true,
67
- recordingType: options.recordingType || "display",
68
- multiWindowBounds: options.multiWindowBounds || null,
69
- };
70
- return;
71
- }
72
-
73
- try {
74
- const displays = await recorder.getDisplays();
75
- const mainDisplay =
76
- displays.find((d) => d.isPrimary) || displays[0];
77
- if (mainDisplay) {
78
- let w = mainDisplay.width;
79
- let h = mainDisplay.height;
80
- const res = mainDisplay.resolution;
81
- if ((w == null || h == null) && res) {
82
- const parts = String(res).split("x");
83
- if (w == null) {
84
- w = parseInt(parts[0], 10);
85
- }
86
- if (h == null) {
87
- h = parseInt(parts[1], 10);
88
- }
89
- }
90
- if (!Number.isFinite(w) || w <= 0) {
91
- w = 1920;
92
- }
93
- if (!Number.isFinite(h) || h <= 0) {
94
- h = 1080;
95
- }
96
- recorder.cursorDisplayInfo = {
97
- displayId: mainDisplay.id,
98
- x: mainDisplay.x,
99
- y: mainDisplay.y,
100
- width: w,
101
- height: h,
102
- multiWindowBounds: options.multiWindowBounds || null,
103
- };
104
- }
105
- } catch {
106
- recorder.cursorDisplayInfo = null;
107
- }
108
- }
109
-
110
- module.exports = { resolveCursorDisplayInfo };