node-mac-recorder 2.21.14 → 2.21.15
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 +27 -28
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -507,45 +507,44 @@ class MacRecorder extends EventEmitter {
|
|
|
507
507
|
};
|
|
508
508
|
}
|
|
509
509
|
|
|
510
|
-
// SYNC FIX: Start
|
|
511
|
-
//
|
|
512
|
-
|
|
513
|
-
const standardCursorOptions = {
|
|
514
|
-
videoRelative: true,
|
|
515
|
-
displayInfo: this.recordingDisplayInfo,
|
|
516
|
-
recordingType: this.options.windowId ? 'window' :
|
|
517
|
-
this.options.captureArea ? 'area' : 'display',
|
|
518
|
-
captureArea: this.options.captureArea,
|
|
519
|
-
windowId: this.options.windowId,
|
|
520
|
-
startTimestamp: sessionTimestamp // Use the same timestamp base
|
|
521
|
-
};
|
|
522
|
-
|
|
523
|
-
try {
|
|
524
|
-
await this.startCursorCapture(cursorFilePath, standardCursorOptions);
|
|
525
|
-
console.log('✅ SYNC: Cursor tracking started successfully');
|
|
526
|
-
} catch (cursorError) {
|
|
527
|
-
console.warn('⚠️ Cursor tracking failed to start:', cursorError.message);
|
|
528
|
-
// Continue with recording even if cursor fails
|
|
529
|
-
}
|
|
510
|
+
// CRITICAL SYNC FIX: Start native recording FIRST (video/audio/camera)
|
|
511
|
+
// Then IMMEDIATELY start cursor tracking with the SAME timestamp
|
|
512
|
+
// This ensures ALL components capture their first frame at the same time
|
|
530
513
|
|
|
531
514
|
let success;
|
|
532
515
|
try {
|
|
533
|
-
console.log('🎯 SYNC: Starting
|
|
516
|
+
console.log('🎯 SYNC: Starting native recording (screen/audio/camera) at timestamp:', sessionTimestamp);
|
|
534
517
|
success = nativeBinding.startRecording(
|
|
535
518
|
outputPath,
|
|
536
519
|
recordingOptions
|
|
537
520
|
);
|
|
538
521
|
if (success) {
|
|
539
|
-
console.log('✅ SYNC:
|
|
522
|
+
console.log('✅ SYNC: Native recording started successfully');
|
|
540
523
|
}
|
|
541
524
|
} catch (error) {
|
|
542
|
-
// console.log('Native recording failed, trying alternative method');
|
|
543
525
|
success = false;
|
|
544
|
-
console.warn('❌
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
526
|
+
console.warn('❌ Native recording failed to start:', error.message);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
// Only start cursor if native recording started successfully
|
|
530
|
+
if (success) {
|
|
531
|
+
const standardCursorOptions = {
|
|
532
|
+
videoRelative: true,
|
|
533
|
+
displayInfo: this.recordingDisplayInfo,
|
|
534
|
+
recordingType: this.options.windowId ? 'window' :
|
|
535
|
+
this.options.captureArea ? 'area' : 'display',
|
|
536
|
+
captureArea: this.options.captureArea,
|
|
537
|
+
windowId: this.options.windowId,
|
|
538
|
+
startTimestamp: sessionTimestamp // Use the same timestamp base
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
try {
|
|
542
|
+
console.log('🎯 SYNC: Starting cursor tracking at timestamp:', sessionTimestamp);
|
|
543
|
+
await this.startCursorCapture(cursorFilePath, standardCursorOptions);
|
|
544
|
+
console.log('✅ SYNC: Cursor tracking started successfully');
|
|
545
|
+
} catch (cursorError) {
|
|
546
|
+
console.warn('⚠️ Cursor tracking failed to start:', cursorError.message);
|
|
547
|
+
// Continue with recording even if cursor fails - don't stop native recording
|
|
549
548
|
}
|
|
550
549
|
}
|
|
551
550
|
|