node-mac-recorder 2.17.20 → 2.17.21
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 +17 -198
- package/package.json +1 -1
- package/publish.sh +18 -0
- package/src/cursor_tracker.mm +37 -20
- package/cursor-debug-test.js +0 -60
- package/cursor-dpr-test.js +0 -73
- package/cursor-dpr-test.json +0 -1
- package/cursor-macbook-test.js +0 -63
- package/cursor-permission-test.js +0 -46
- package/cursor-scaling-debug.js +0 -53
- package/cursor-simple-test.js +0 -26
- package/debug-audio.js +0 -79
- package/debug-coordinates.js +0 -69
- package/debug-macos14.js +0 -110
- package/debug-primary-window.js +0 -84
- package/debug-screen-selection.js +0 -81
- package/debug-window-selector.js +0 -178
- package/test-cursor-fix.js +0 -105
- package/test-cursor-types.js +0 -117
- package/test-display-coordinates.js +0 -72
- package/test-integrated-recording.js +0 -120
- package/test-menubar-offset.js +0 -110
- package/test-output/temp_cursor_1758313956591.json +0 -1
- package/test-primary-cursor.js +0 -154
- package/test-primary-fix.js +0 -120
- package/test-recording-with-cursor.js +0 -83
- package/test-unified-cursor.js +0 -75
- package/test-window-recording.js +0 -149
package/cursor-simple-test.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const MacRecorder = require('./index.js');
|
|
2
|
-
|
|
3
|
-
console.log('🎯 Simple cursor test - Move your mouse to MacBook screen...\n');
|
|
4
|
-
|
|
5
|
-
const recorder = new MacRecorder();
|
|
6
|
-
|
|
7
|
-
// Test 10 cursor positions
|
|
8
|
-
for (let i = 0; i < 10; i++) {
|
|
9
|
-
setTimeout(() => {
|
|
10
|
-
const position = recorder.getCursorPosition();
|
|
11
|
-
console.log(`${i+1}. Cursor: (${position.x}, ${position.y}), Scale: ${position.scaleFactor || 'none'}`);
|
|
12
|
-
|
|
13
|
-
if (position.displayInfo && position.scaleFactor > 1.1) {
|
|
14
|
-
console.log(` 🎉 SCALING DETECTED! ${position.scaleFactor}x`);
|
|
15
|
-
console.log(` Logical: ${position.displayInfo.logicalWidth}x${position.displayInfo.logicalHeight}`);
|
|
16
|
-
console.log(` Physical: ${position.displayInfo.physicalWidth}x${position.displayInfo.physicalHeight}`);
|
|
17
|
-
console.log(` Raw cursor: (${position.rawX}, ${position.rawY})`);
|
|
18
|
-
process.exit(0);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (i === 9) {
|
|
22
|
-
console.log('\n⚠️ No scaling detected. Try moving mouse to MacBook internal display.');
|
|
23
|
-
process.exit(0);
|
|
24
|
-
}
|
|
25
|
-
}, i * 500);
|
|
26
|
-
}
|
package/debug-audio.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
const MacRecorder = require('./index');
|
|
2
|
-
|
|
3
|
-
async function debugAudio() {
|
|
4
|
-
const recorder = new MacRecorder();
|
|
5
|
-
|
|
6
|
-
console.log('🔍 SES CİHAZI DEBUG RAPORU\n');
|
|
7
|
-
|
|
8
|
-
try {
|
|
9
|
-
// Tüm ses cihazlarını detayları ile listele
|
|
10
|
-
const devices = await recorder.getAudioDevices();
|
|
11
|
-
console.log('📋 TÜM SES CİHAZLARI:');
|
|
12
|
-
devices.forEach((device, index) => {
|
|
13
|
-
console.log(`${index + 1}. ${device.name}`);
|
|
14
|
-
console.log(` ID: ${device.id || 'N/A'}`);
|
|
15
|
-
console.log(` Type: ${device.type || 'N/A'}`);
|
|
16
|
-
console.log(` Manufacturer: ${device.manufacturer || 'N/A'}`);
|
|
17
|
-
console.log(` Default: ${device.isDefault ? 'Yes' : 'No'}`);
|
|
18
|
-
console.log('');
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
// Sistem sesi için uygun cihazları bul
|
|
22
|
-
const systemDevices = devices.filter(device => {
|
|
23
|
-
const name = device.name.toLowerCase();
|
|
24
|
-
return name.includes('aggregate') ||
|
|
25
|
-
name.includes('blackhole') ||
|
|
26
|
-
name.includes('soundflower') ||
|
|
27
|
-
name.includes('loopback') ||
|
|
28
|
-
name.includes('system') ||
|
|
29
|
-
name.includes('imobie');
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
console.log('🎵 SİSTEM SESİ İÇİN UYGUN CİHAZLAR:');
|
|
33
|
-
if (systemDevices.length > 0) {
|
|
34
|
-
systemDevices.forEach((device, index) => {
|
|
35
|
-
console.log(`${index + 1}. ${device.name} (ID: ${device.id})`);
|
|
36
|
-
});
|
|
37
|
-
} else {
|
|
38
|
-
console.log('❌ Sistem sesi cihazı bulunamadı!');
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
console.log('\n💡 ÇÖZÜMLERİ:');
|
|
42
|
-
console.log('1. BlackHole kur: https://github.com/ExistentialAudio/BlackHole/releases');
|
|
43
|
-
console.log('2. Audio MIDI Setup ile Aggregate Device oluştur');
|
|
44
|
-
console.log('3. Sistem sesini aggregate device\'a yönlendir');
|
|
45
|
-
|
|
46
|
-
console.log('\n🔧 MANUAL AGGREGATE DEVICE OLUŞTURMA:');
|
|
47
|
-
console.log('1. Spotlight\'ta "Audio MIDI Setup" ara ve aç');
|
|
48
|
-
console.log('2. Sol alt köşedeki "+" butonuna tıkla');
|
|
49
|
-
console.log('3. "Create Aggregate Device" seç');
|
|
50
|
-
console.log('4. Hem built-in output hem de built-in input\'u seç');
|
|
51
|
-
console.log('5. İsim ver (örn: "System Audio Capture")');
|
|
52
|
-
console.log('6. System Preferences > Sound > Output\'ta yeni cihazı seç');
|
|
53
|
-
|
|
54
|
-
// Test kayıt yap
|
|
55
|
-
console.log('\n🧪 TEST KAYIT YAPILIYOR...');
|
|
56
|
-
console.log('🎵 Şimdi müzik çal veya YouTube video aç!');
|
|
57
|
-
|
|
58
|
-
const testDevice = systemDevices[0]; // İlk sistem ses cihazını kullan
|
|
59
|
-
|
|
60
|
-
await recorder.startRecording('./test-output/debug-audio.mov', {
|
|
61
|
-
includeSystemAudio: true,
|
|
62
|
-
includeMicrophone: false,
|
|
63
|
-
systemAudioDeviceId: testDevice?.id,
|
|
64
|
-
captureArea: { x: 0, y: 0, width: 300, height: 200 }
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
// 3 saniye kayıt
|
|
68
|
-
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
69
|
-
await recorder.stopRecording();
|
|
70
|
-
|
|
71
|
-
console.log('✅ Test kayıt tamamlandı: ./test-output/debug-audio.mov');
|
|
72
|
-
console.log('🔍 Dosyayı QuickTime Player ile açıp ses kontrolü yap');
|
|
73
|
-
|
|
74
|
-
} catch (error) {
|
|
75
|
-
console.error('❌ Debug hatası:', error.message);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
debugAudio();
|
package/debug-coordinates.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
const MacRecorder = require('./index');
|
|
2
|
-
|
|
3
|
-
async function debugCoordinates() {
|
|
4
|
-
const recorder = new MacRecorder();
|
|
5
|
-
const displays = await recorder.getDisplays();
|
|
6
|
-
|
|
7
|
-
console.log('🖥️ Display coordinates analysis:');
|
|
8
|
-
displays.forEach((display, index) => {
|
|
9
|
-
console.log(`Display ${index}: ${display.name}`);
|
|
10
|
-
console.log(` ID: ${display.id}`);
|
|
11
|
-
console.log(` Position: (${display.x}, ${display.y})`);
|
|
12
|
-
console.log(` Size: ${display.width}x${display.height}`);
|
|
13
|
-
console.log(` isPrimary: ${display.isPrimary}`);
|
|
14
|
-
console.log('');
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
// Calculate combined frame like we do in native code
|
|
18
|
-
let combinedFrame = { x: 0, y: 0, width: 0, height: 0 };
|
|
19
|
-
let first = true;
|
|
20
|
-
|
|
21
|
-
for (const display of displays) {
|
|
22
|
-
if (first) {
|
|
23
|
-
combinedFrame = {
|
|
24
|
-
x: display.x,
|
|
25
|
-
y: display.y,
|
|
26
|
-
width: display.width,
|
|
27
|
-
height: display.height
|
|
28
|
-
};
|
|
29
|
-
first = false;
|
|
30
|
-
} else {
|
|
31
|
-
const minX = Math.min(combinedFrame.x, display.x);
|
|
32
|
-
const minY = Math.min(combinedFrame.y, display.y);
|
|
33
|
-
const maxX = Math.max(combinedFrame.x + combinedFrame.width, display.x + display.width);
|
|
34
|
-
const maxY = Math.max(combinedFrame.y + combinedFrame.height, display.y + display.height);
|
|
35
|
-
|
|
36
|
-
combinedFrame = {
|
|
37
|
-
x: minX,
|
|
38
|
-
y: minY,
|
|
39
|
-
width: maxX - minX,
|
|
40
|
-
height: maxY - minY
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
console.log('📐 Combined frame calculation:');
|
|
46
|
-
console.log(` Origin: (${combinedFrame.x}, ${combinedFrame.y})`);
|
|
47
|
-
console.log(` Size: ${combinedFrame.width}x${combinedFrame.height}`);
|
|
48
|
-
console.log('');
|
|
49
|
-
|
|
50
|
-
console.log('🔄 Coordinate conversion examples:');
|
|
51
|
-
displays.forEach((display, index) => {
|
|
52
|
-
console.log(`Display ${index} (${display.name}):`);
|
|
53
|
-
const localOriginX = display.x - combinedFrame.x;
|
|
54
|
-
const localOriginY = display.y - combinedFrame.y;
|
|
55
|
-
console.log(` Global offset from combined: (${localOriginX}, ${localOriginY})`);
|
|
56
|
-
|
|
57
|
-
// Test window at display origin
|
|
58
|
-
const testWindowGlobalX = display.x + 100;
|
|
59
|
-
const testWindowGlobalY = display.y + 100;
|
|
60
|
-
const localWindowX = testWindowGlobalX - combinedFrame.x;
|
|
61
|
-
const localWindowY = testWindowGlobalY - combinedFrame.y;
|
|
62
|
-
|
|
63
|
-
console.log(` Test window at (${testWindowGlobalX}, ${testWindowGlobalY}) global`);
|
|
64
|
-
console.log(` -> Local coordinates: (${localWindowX}, ${localWindowY})`);
|
|
65
|
-
console.log('');
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
debugCoordinates();
|
package/debug-macos14.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
const MacRecorder = require('./index');
|
|
2
|
-
|
|
3
|
-
console.log('🧪 macOS 14/13 Debug Test');
|
|
4
|
-
console.log('=========================================');
|
|
5
|
-
console.log('');
|
|
6
|
-
console.log('This script helps debug recording issues on macOS 14 and earlier.');
|
|
7
|
-
console.log('Please run this and share the complete console output.');
|
|
8
|
-
console.log('');
|
|
9
|
-
|
|
10
|
-
async function debugMacOS14() {
|
|
11
|
-
const recorder = new MacRecorder();
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
// Create test output directory
|
|
15
|
-
const fs = require('fs');
|
|
16
|
-
if (!fs.existsSync('./test-output')) {
|
|
17
|
-
fs.mkdirSync('./test-output');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
console.log('📋 System Information:');
|
|
21
|
-
const os = require('os');
|
|
22
|
-
console.log(' OS:', os.type(), os.release());
|
|
23
|
-
console.log(' Architecture:', os.arch());
|
|
24
|
-
console.log(' Platform:', os.platform());
|
|
25
|
-
|
|
26
|
-
// Check permissions first
|
|
27
|
-
console.log('');
|
|
28
|
-
console.log('🔐 Checking Permissions...');
|
|
29
|
-
try {
|
|
30
|
-
const permissions = await recorder.checkPermissions();
|
|
31
|
-
console.log(' Screen Recording Permission:', permissions.screenRecording ? '✅ GRANTED' : '❌ DENIED');
|
|
32
|
-
console.log(' Accessibility Permission:', permissions.accessibility ? '✅ GRANTED' : '❌ DENIED');
|
|
33
|
-
|
|
34
|
-
if (!permissions.screenRecording) {
|
|
35
|
-
console.log('');
|
|
36
|
-
console.log('❌ CRITICAL: Screen Recording permission is DENIED');
|
|
37
|
-
console.log(' Please grant permission in System Preferences > Security & Privacy > Privacy > Screen Recording');
|
|
38
|
-
console.log(' Then restart this test.');
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
} catch (permError) {
|
|
42
|
-
console.log(' Permission check failed:', permError.message);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
console.log('');
|
|
46
|
-
console.log('🎯 Starting Recording Test...');
|
|
47
|
-
console.log('Expected behavior:');
|
|
48
|
-
console.log(' • System should detect macOS version');
|
|
49
|
-
console.log(' • macOS 15+ uses ScreenCaptureKit');
|
|
50
|
-
console.log(' • macOS 14/13 uses AVFoundation fallback');
|
|
51
|
-
console.log(' • You should see detailed logs below');
|
|
52
|
-
console.log('');
|
|
53
|
-
|
|
54
|
-
const outputPath = './test-output/debug-test.mov';
|
|
55
|
-
|
|
56
|
-
const success = await recorder.startRecording(outputPath, {
|
|
57
|
-
captureCursor: true,
|
|
58
|
-
includeMicrophone: false,
|
|
59
|
-
includeSystemAudio: true,
|
|
60
|
-
displayId: null // Use primary display
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
if (success) {
|
|
64
|
-
console.log('✅ Recording started successfully');
|
|
65
|
-
console.log('⏱️ Recording for 3 seconds...');
|
|
66
|
-
|
|
67
|
-
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
68
|
-
|
|
69
|
-
console.log('🛑 Stopping recording...');
|
|
70
|
-
await recorder.stopRecording();
|
|
71
|
-
|
|
72
|
-
// Check if file was created
|
|
73
|
-
const fs = require('fs');
|
|
74
|
-
if (fs.existsSync(outputPath)) {
|
|
75
|
-
const stats = fs.statSync(outputPath);
|
|
76
|
-
console.log('✅ Recording file created:', outputPath);
|
|
77
|
-
console.log(' File size:', Math.round(stats.size / 1024), 'KB');
|
|
78
|
-
console.log('');
|
|
79
|
-
console.log('🎉 SUCCESS: Recording works on your system!');
|
|
80
|
-
} else {
|
|
81
|
-
console.log('❌ Recording file was not created');
|
|
82
|
-
console.log(' Expected:', outputPath);
|
|
83
|
-
}
|
|
84
|
-
} else {
|
|
85
|
-
console.log('❌ Recording failed to start');
|
|
86
|
-
console.log('');
|
|
87
|
-
console.log('🔍 Troubleshooting Steps:');
|
|
88
|
-
console.log('1. Check console logs above for specific error messages');
|
|
89
|
-
console.log('2. Verify Screen Recording permission is granted');
|
|
90
|
-
console.log('3. Try restarting your application');
|
|
91
|
-
console.log('4. Check if output directory exists and is writable');
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
} catch (error) {
|
|
95
|
-
console.log('❌ Error during test:', error.message);
|
|
96
|
-
if (error.stack) {
|
|
97
|
-
console.log('Stack trace:', error.stack);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
console.log('');
|
|
102
|
-
console.log('📞 Support Information:');
|
|
103
|
-
console.log('If recording still fails, please share:');
|
|
104
|
-
console.log('1. Complete console output from this test');
|
|
105
|
-
console.log('2. Your macOS version (System Settings > About)');
|
|
106
|
-
console.log('3. Permission screenshots from System Settings');
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// Run the debug test
|
|
110
|
-
debugMacOS14();
|
package/debug-primary-window.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
const MacRecorder = require('./index');
|
|
2
|
-
const WindowSelector = MacRecorder.WindowSelector;
|
|
3
|
-
|
|
4
|
-
async function debugPrimaryDisplay() {
|
|
5
|
-
console.log('🔍 Debugging primary display window selector...');
|
|
6
|
-
|
|
7
|
-
const recorder = new MacRecorder();
|
|
8
|
-
const displays = await recorder.getDisplays();
|
|
9
|
-
|
|
10
|
-
console.log('📊 Display analysis:');
|
|
11
|
-
displays.forEach(display => {
|
|
12
|
-
console.log(`${display.name}: (${display.x}, ${display.y}) ${display.width}x${display.height} ${display.isPrimary ? '[PRIMARY]' : '[SECONDARY]'}`);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
// Calculate combined frame like in native code
|
|
16
|
-
const primary = displays.find(d => d.isPrimary);
|
|
17
|
-
const secondary = displays.find(d => !d.isPrimary);
|
|
18
|
-
|
|
19
|
-
console.log('\n🧮 Coordinate calculations:');
|
|
20
|
-
console.log(`Primary: (${primary.x}, ${primary.y})`);
|
|
21
|
-
console.log(`Secondary: (${secondary.x}, ${secondary.y})`);
|
|
22
|
-
|
|
23
|
-
// Combined frame calculation
|
|
24
|
-
const minX = Math.min(primary.x, secondary.x);
|
|
25
|
-
const minY = Math.min(primary.y, secondary.y);
|
|
26
|
-
const maxX = Math.max(primary.x + primary.width, secondary.x + secondary.width);
|
|
27
|
-
const maxY = Math.max(primary.y + primary.height, secondary.y + secondary.height);
|
|
28
|
-
|
|
29
|
-
const combinedFrame = {
|
|
30
|
-
x: minX,
|
|
31
|
-
y: minY,
|
|
32
|
-
width: maxX - minX,
|
|
33
|
-
height: maxY - minY
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
console.log(`Combined frame: (${combinedFrame.x}, ${combinedFrame.y}) ${combinedFrame.width}x${combinedFrame.height}`);
|
|
37
|
-
|
|
38
|
-
// Test coordinate conversion for a primary display window
|
|
39
|
-
const testPrimaryWindowX = 100; // Window at (100, 100) on primary
|
|
40
|
-
const testPrimaryWindowY = 100;
|
|
41
|
-
|
|
42
|
-
const localX = testPrimaryWindowX - combinedFrame.x;
|
|
43
|
-
const localY = testPrimaryWindowY - combinedFrame.y;
|
|
44
|
-
|
|
45
|
-
console.log(`\n🎯 Primary window test:`);
|
|
46
|
-
console.log(`Global window: (${testPrimaryWindowX}, ${testPrimaryWindowY})`);
|
|
47
|
-
console.log(`Combined origin: (${combinedFrame.x}, ${combinedFrame.y})`);
|
|
48
|
-
console.log(`Local coordinates: (${localX}, ${localY})`);
|
|
49
|
-
console.log(`Combined height: ${combinedFrame.height}`);
|
|
50
|
-
console.log(`Converted Y: ${combinedFrame.height - localY - 200}`); // Assuming 200px window height
|
|
51
|
-
|
|
52
|
-
// Test for secondary display window
|
|
53
|
-
const testSecondaryWindowX = secondary.x + 100;
|
|
54
|
-
const testSecondaryWindowY = secondary.y + 100;
|
|
55
|
-
|
|
56
|
-
const localSecondaryX = testSecondaryWindowX - combinedFrame.x;
|
|
57
|
-
const localSecondaryY = testSecondaryWindowY - combinedFrame.y;
|
|
58
|
-
|
|
59
|
-
console.log(`\n🎯 Secondary window test:`);
|
|
60
|
-
console.log(`Global window: (${testSecondaryWindowX}, ${testSecondaryWindowY})`);
|
|
61
|
-
console.log(`Local coordinates: (${localSecondaryX}, ${localSecondaryY})`);
|
|
62
|
-
console.log(`Converted Y: ${combinedFrame.height - localSecondaryY - 200}`);
|
|
63
|
-
|
|
64
|
-
console.log('\n🧪 Starting actual window selection test...');
|
|
65
|
-
console.log(' - Move cursor to primary display windows');
|
|
66
|
-
console.log(' - Check if buttons appear');
|
|
67
|
-
console.log(' - Check console logs for coordinate calculations');
|
|
68
|
-
|
|
69
|
-
const selector = new WindowSelector();
|
|
70
|
-
|
|
71
|
-
try {
|
|
72
|
-
await selector.startSelection();
|
|
73
|
-
|
|
74
|
-
// Let it run for 15 seconds for debugging
|
|
75
|
-
await new Promise(resolve => setTimeout(resolve, 15000));
|
|
76
|
-
|
|
77
|
-
await selector.stopSelection();
|
|
78
|
-
|
|
79
|
-
} catch (error) {
|
|
80
|
-
console.log(`❌ Test failed: ${error.message}`);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
debugPrimaryDisplay();
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const WindowSelector = require('./window-selector');
|
|
4
|
-
const MacRecorder = require('./index');
|
|
5
|
-
|
|
6
|
-
async function debugScreenSelection() {
|
|
7
|
-
console.log('🔍 Screen Selection Debug Test');
|
|
8
|
-
console.log('================================\n');
|
|
9
|
-
|
|
10
|
-
const selector = new WindowSelector();
|
|
11
|
-
const recorder = new MacRecorder();
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
// First, let's see what displays MacRecorder sees
|
|
15
|
-
console.log('📺 MacRecorder displays:');
|
|
16
|
-
const macDisplays = await recorder.getDisplays();
|
|
17
|
-
macDisplays.forEach((display, i) => {
|
|
18
|
-
console.log(` ${i}: ID=${display.id}, Name="${display.name}", Resolution=${display.resolution}, Primary=${display.isPrimary}`);
|
|
19
|
-
});
|
|
20
|
-
console.log('');
|
|
21
|
-
|
|
22
|
-
// Start screen selection
|
|
23
|
-
console.log('🖥️ Starting screen selection...');
|
|
24
|
-
console.log(' Move mouse to different screens and click "Start Record" on one of them');
|
|
25
|
-
console.log('');
|
|
26
|
-
|
|
27
|
-
const selectedScreen = await selector.selectScreen();
|
|
28
|
-
|
|
29
|
-
console.log('✅ Screen selected!');
|
|
30
|
-
console.log('📊 Selected screen data:');
|
|
31
|
-
console.log(JSON.stringify(selectedScreen, null, 2));
|
|
32
|
-
|
|
33
|
-
// Check if this ID exists in MacRecorder displays
|
|
34
|
-
const matchingDisplay = macDisplays.find(d => d.id === selectedScreen.id);
|
|
35
|
-
|
|
36
|
-
if (matchingDisplay) {
|
|
37
|
-
console.log('\n✅ MATCH FOUND in MacRecorder displays:');
|
|
38
|
-
console.log(` Selected: ${selectedScreen.name} (ID: ${selectedScreen.id})`);
|
|
39
|
-
console.log(` MacRecorder: ${matchingDisplay.name} (ID: ${matchingDisplay.id})`);
|
|
40
|
-
} else {
|
|
41
|
-
console.log('\n❌ NO MATCH found in MacRecorder displays!');
|
|
42
|
-
console.log(` Selected ID: ${selectedScreen.id}`);
|
|
43
|
-
console.log(` Available IDs: ${macDisplays.map(d => d.id).join(', ')}`);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
console.log('\n🎬 Testing actual recording...');
|
|
47
|
-
console.log(' Setting displayId option and starting short recording');
|
|
48
|
-
|
|
49
|
-
// Set the display ID from screen selection
|
|
50
|
-
recorder.setOptions({
|
|
51
|
-
displayId: selectedScreen.id,
|
|
52
|
-
includeSystemAudio: false,
|
|
53
|
-
includeMicrophone: false
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
const testFile = `./test-output/screen-selection-test-${Date.now()}.mov`;
|
|
57
|
-
console.log(` Recording file: ${testFile}`);
|
|
58
|
-
|
|
59
|
-
await recorder.startRecording(testFile);
|
|
60
|
-
console.log(' Recording started...');
|
|
61
|
-
|
|
62
|
-
// Record for 3 seconds
|
|
63
|
-
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
64
|
-
|
|
65
|
-
await recorder.stopRecording();
|
|
66
|
-
console.log(' Recording stopped');
|
|
67
|
-
|
|
68
|
-
console.log('\n✅ Test completed! Check the recording to see if it captured the correct screen.');
|
|
69
|
-
|
|
70
|
-
} catch (error) {
|
|
71
|
-
console.error('\n❌ Error during test:', error.message);
|
|
72
|
-
if (error.stack) {
|
|
73
|
-
console.error('Stack:', error.stack);
|
|
74
|
-
}
|
|
75
|
-
process.exit(1);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (require.main === module) {
|
|
80
|
-
debugScreenSelection();
|
|
81
|
-
}
|
package/debug-window-selector.js
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const WindowSelector = require('./window-selector');
|
|
4
|
-
|
|
5
|
-
async function debugWindowSelector() {
|
|
6
|
-
console.log('🔍 Window Selector Debug Mode');
|
|
7
|
-
console.log('=============================\n');
|
|
8
|
-
|
|
9
|
-
const selector = new WindowSelector();
|
|
10
|
-
|
|
11
|
-
try {
|
|
12
|
-
// 1. İzin kontrolü
|
|
13
|
-
console.log('1️⃣ Checking permissions...');
|
|
14
|
-
const permissions = await selector.checkPermissions();
|
|
15
|
-
console.log('Permissions:', JSON.stringify(permissions, null, 2));
|
|
16
|
-
|
|
17
|
-
if (!permissions.screenRecording || !permissions.accessibility) {
|
|
18
|
-
console.warn('⚠️ Missing permissions detected!');
|
|
19
|
-
console.warn('Go to: System Preferences > Security & Privacy > Privacy');
|
|
20
|
-
console.warn('Enable for Terminal/Node in both:');
|
|
21
|
-
console.warn('- Screen Recording');
|
|
22
|
-
console.warn('- Accessibility');
|
|
23
|
-
console.log();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// 2. Native status before start
|
|
27
|
-
console.log('\n2️⃣ Native status before start:');
|
|
28
|
-
const initialStatus = selector.getStatus();
|
|
29
|
-
console.log(JSON.stringify(initialStatus, null, 2));
|
|
30
|
-
|
|
31
|
-
// 3. Start selection with detailed logging
|
|
32
|
-
console.log('\n3️⃣ Starting window selection...');
|
|
33
|
-
|
|
34
|
-
selector.on('selectionStarted', () => {
|
|
35
|
-
console.log('✅ Selection started event received');
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
selector.on('windowEntered', (window) => {
|
|
39
|
-
console.log(`🏠 Window entered: "${window.title}" (${window.appName})`);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
selector.on('windowLeft', (window) => {
|
|
43
|
-
console.log(`🚪 Window left: "${window.title}" (${window.appName})`);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
selector.on('windowSelected', (window) => {
|
|
47
|
-
console.log('🎯 Window selected:', window.title);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
selector.on('error', (error) => {
|
|
51
|
-
console.error('❌ Error event:', error);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
await selector.startSelection();
|
|
55
|
-
|
|
56
|
-
// 4. Status after start
|
|
57
|
-
console.log('\n4️⃣ Status after start:');
|
|
58
|
-
const runningStatus = selector.getStatus();
|
|
59
|
-
console.log(JSON.stringify(runningStatus, null, 2));
|
|
60
|
-
|
|
61
|
-
// 5. Detailed native status monitoring
|
|
62
|
-
console.log('\n5️⃣ Monitoring native status (10 seconds)...');
|
|
63
|
-
console.log('Move your cursor over different windows');
|
|
64
|
-
console.log('The overlay should appear over windows\n');
|
|
65
|
-
|
|
66
|
-
for (let i = 0; i < 20; i++) {
|
|
67
|
-
await new Promise(resolve => setTimeout(resolve, 500));
|
|
68
|
-
const status = selector.getStatus();
|
|
69
|
-
|
|
70
|
-
process.stdout.write(`\r[${i+1}/20] `);
|
|
71
|
-
process.stdout.write(`Selecting: ${status.nativeStatus?.isSelecting || false}, `);
|
|
72
|
-
process.stdout.write(`Overlay: ${status.nativeStatus?.hasOverlay || false}, `);
|
|
73
|
-
process.stdout.write(`Windows: ${status.nativeStatus?.windowCount || 0}`);
|
|
74
|
-
|
|
75
|
-
if (status.nativeStatus?.currentWindow) {
|
|
76
|
-
process.stdout.write(`, Current: ${status.nativeStatus.currentWindow.appName}`);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
console.log('\n\n6️⃣ Final status:');
|
|
81
|
-
const finalStatus = selector.getStatus();
|
|
82
|
-
console.log(JSON.stringify(finalStatus, null, 2));
|
|
83
|
-
|
|
84
|
-
} catch (error) {
|
|
85
|
-
console.error('\n❌ Debug failed:', error.message);
|
|
86
|
-
console.error('Stack:', error.stack);
|
|
87
|
-
} finally {
|
|
88
|
-
console.log('\n🛑 Stopping selection...');
|
|
89
|
-
await selector.cleanup();
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// Alternative: Test native functions directly
|
|
94
|
-
async function testNativeFunctions() {
|
|
95
|
-
console.log('🧪 Testing Native Functions Directly');
|
|
96
|
-
console.log('====================================\n');
|
|
97
|
-
|
|
98
|
-
try {
|
|
99
|
-
// Try to load native binding directly
|
|
100
|
-
let nativeBinding;
|
|
101
|
-
try {
|
|
102
|
-
nativeBinding = require("./build/Release/mac_recorder.node");
|
|
103
|
-
} catch (error) {
|
|
104
|
-
try {
|
|
105
|
-
nativeBinding = require("./build/Debug/mac_recorder.node");
|
|
106
|
-
} catch (debugError) {
|
|
107
|
-
console.error('❌ Cannot load native module');
|
|
108
|
-
console.error('Release error:', error.message);
|
|
109
|
-
console.error('Debug error:', debugError.message);
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
console.log('✅ Native module loaded successfully');
|
|
115
|
-
|
|
116
|
-
// Test if window selector functions exist
|
|
117
|
-
console.log('\n🔍 Available native functions:');
|
|
118
|
-
const functions = [
|
|
119
|
-
'startWindowSelection',
|
|
120
|
-
'stopWindowSelection',
|
|
121
|
-
'getSelectedWindowInfo',
|
|
122
|
-
'getWindowSelectionStatus'
|
|
123
|
-
];
|
|
124
|
-
|
|
125
|
-
for (const func of functions) {
|
|
126
|
-
if (typeof nativeBinding[func] === 'function') {
|
|
127
|
-
console.log(`✅ ${func} - available`);
|
|
128
|
-
} else {
|
|
129
|
-
console.log(`❌ ${func} - missing`);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// Test direct native call
|
|
134
|
-
console.log('\n🚀 Testing direct native startWindowSelection...');
|
|
135
|
-
try {
|
|
136
|
-
const result = nativeBinding.startWindowSelection();
|
|
137
|
-
console.log('Native start result:', result);
|
|
138
|
-
|
|
139
|
-
if (result) {
|
|
140
|
-
console.log('✅ Native selection started');
|
|
141
|
-
|
|
142
|
-
// Check status
|
|
143
|
-
const status = nativeBinding.getWindowSelectionStatus();
|
|
144
|
-
console.log('Native status:', JSON.stringify(status, null, 2));
|
|
145
|
-
|
|
146
|
-
// Wait a bit
|
|
147
|
-
console.log('\nWaiting 3 seconds for overlay to appear...');
|
|
148
|
-
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
149
|
-
|
|
150
|
-
// Stop
|
|
151
|
-
const stopResult = nativeBinding.stopWindowSelection();
|
|
152
|
-
console.log('Native stop result:', stopResult);
|
|
153
|
-
} else {
|
|
154
|
-
console.log('❌ Native selection failed to start');
|
|
155
|
-
}
|
|
156
|
-
} catch (nativeError) {
|
|
157
|
-
console.error('❌ Native function error:', nativeError.message);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
} catch (error) {
|
|
161
|
-
console.error('❌ Native test failed:', error.message);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// Main function
|
|
166
|
-
async function main() {
|
|
167
|
-
const args = process.argv.slice(2);
|
|
168
|
-
|
|
169
|
-
if (args.includes('--native')) {
|
|
170
|
-
await testNativeFunctions();
|
|
171
|
-
} else {
|
|
172
|
-
await debugWindowSelector();
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
if (require.main === module) {
|
|
177
|
-
main().catch(console.error);
|
|
178
|
-
}
|