node-mac-recorder 1.17.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/index.js +45 -6
- 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);
|