node-mac-recorder 1.16.0 → 1.17.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.
@@ -14,7 +14,9 @@
14
14
  "Bash(mkdir:*)",
15
15
  "Bash(/dev/null)",
16
16
  "Bash(ls:*)",
17
- "Bash(touch:*)"
17
+ "Bash(touch:*)",
18
+ "Bash(git add:*)",
19
+ "Bash(git commit:*)"
18
20
  ],
19
21
  "deny": []
20
22
  }
package/index.js CHANGED
@@ -302,12 +302,51 @@ class MacRecorder extends EventEmitter {
302
302
  this.emit("timeUpdate", elapsed);
303
303
  }, 1000);
304
304
 
305
- // Kayıt tam başladığı anda event emit et
306
- this.emit("recordingStarted", {
307
- outputPath: this.outputPath,
308
- timestamp: this.recordingStartTime,
309
- options: this.options
310
- });
305
+ // Native kayıt gerçekten başladığını kontrol etmek için polling başlat
306
+ let recordingStartedEmitted = false;
307
+ const checkRecordingStatus = setInterval(() => {
308
+ try {
309
+ const nativeStatus = nativeBinding.getRecordingStatus();
310
+ if (nativeStatus && !recordingStartedEmitted) {
311
+ recordingStartedEmitted = true;
312
+ clearInterval(checkRecordingStatus);
313
+
314
+ // Kayıt gerçekten başladığı anda event emit et
315
+ this.emit("recordingStarted", {
316
+ outputPath: this.outputPath,
317
+ timestamp: Date.now(), // Gerçek başlangıç zamanı
318
+ options: this.options,
319
+ nativeConfirmed: true
320
+ });
321
+ }
322
+ } catch (error) {
323
+ // Native status check error - fallback
324
+ if (!recordingStartedEmitted) {
325
+ recordingStartedEmitted = true;
326
+ clearInterval(checkRecordingStatus);
327
+ this.emit("recordingStarted", {
328
+ outputPath: this.outputPath,
329
+ timestamp: this.recordingStartTime,
330
+ options: this.options,
331
+ nativeConfirmed: false
332
+ });
333
+ }
334
+ }
335
+ }, 50); // Her 50ms kontrol et
336
+
337
+ // Timeout fallback - 5 saniye sonra hala başlamamışsa emit et
338
+ setTimeout(() => {
339
+ if (!recordingStartedEmitted) {
340
+ recordingStartedEmitted = true;
341
+ clearInterval(checkRecordingStatus);
342
+ this.emit("recordingStarted", {
343
+ outputPath: this.outputPath,
344
+ timestamp: this.recordingStartTime,
345
+ options: this.options,
346
+ nativeConfirmed: false
347
+ });
348
+ }
349
+ }, 5000);
311
350
 
312
351
  this.emit("started", this.outputPath);
313
352
  resolve(this.outputPath);
@@ -541,27 +580,11 @@ class MacRecorder extends EventEmitter {
541
580
  // Koordinat sistemi belirle: window-relative, display-relative veya global
542
581
  if (options.windowRelative && options.windowInfo) {
543
582
  // Window-relative koordinatlar için pencere bilgilerini kullan
544
- // Y koordinat dönüşümü - pencere kaydındaki gibi
545
- const displays = await this.getDisplays();
546
- const display = displays.find(d => d.id === options.windowInfo.displayId) || displays[0];
547
-
548
- let adjustedX = options.windowInfo.x || 0;
549
- let adjustedY = options.windowInfo.y || 0;
550
-
551
- if (display) {
552
- // Pencere koordinatlarını display-relative yapmak için display offset'ini çıkar
553
- adjustedX = (options.windowInfo.x || 0) - display.x;
554
-
555
- // Y koordinat dönüşümü: CGWindow (top-left) to AVFoundation (bottom-left)
556
- const displayHeight = parseInt(display.resolution.split("x")[1]);
557
- const convertedY = displayHeight - (options.windowInfo.y || 0) - options.windowInfo.height;
558
- adjustedY = Math.max(0, convertedY - display.y);
559
- }
560
-
583
+ // Cursor pozisyonu için Y dönüşümü YAPMA - sadece window offset'ini çıkar
561
584
  this.cursorDisplayInfo = {
562
585
  displayId: options.windowInfo.displayId || null,
563
- x: adjustedX,
564
- y: adjustedY,
586
+ x: options.windowInfo.x || 0,
587
+ y: options.windowInfo.y || 0,
565
588
  width: options.windowInfo.width,
566
589
  height: options.windowInfo.height,
567
590
  windowRelative: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-mac-recorder",
3
- "version": "1.16.0",
3
+ "version": "1.17.1",
4
4
  "description": "Native macOS screen recording package for Node.js applications",
5
5
  "main": "index.js",
6
6
  "keywords": [