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.
- package/.claude/settings.local.json +3 -1
- package/index.js +48 -25
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -302,12 +302,51 @@ class MacRecorder extends EventEmitter {
|
|
|
302
302
|
this.emit("timeUpdate", elapsed);
|
|
303
303
|
}, 1000);
|
|
304
304
|
|
|
305
|
-
//
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
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
|
|
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:
|
|
564
|
-
y:
|
|
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,
|