node-mac-recorder 2.17.19 โ 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 +21 -200
- package/package.json +1 -1
- package/publish.sh +18 -0
- package/src/cursor_tracker.mm +37 -20
- package/cursor-data-1751364226346.json +0 -1
- package/cursor-data-1751364314136.json +0 -1
- package/cursor-data.json +0 -1
- 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-cursor-output.json +0 -1
- 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/examples/electron-integration-example.js +0 -230
- package/examples/electron-preload.js +0 -46
- package/examples/electron-renderer.html +0 -634
- package/examples/integration-example.js +0 -228
- package/examples/window-selector-example.js +0 -254
- package/quick-cursor-test.json +0 -1
- package/test-both-cursor.json +0 -1
- 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/primary-fix-test-1758266910543.json +0 -1
- package/test-output/unified-cursor-1758313640878.json +0 -1
- package/test-output/unified-cursor-1758313689471.json +0 -1
- package/test-primary-cursor.js +0 -154
- package/test-primary-fix.js +0 -120
- package/test-unified-cursor.js +0 -75
- package/test-window-recording.js +0 -149
package/cursor-scaling-debug.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
const MacRecorder = require('./index.js');
|
|
2
|
-
|
|
3
|
-
async function debugCursorScaling() {
|
|
4
|
-
console.log('๐ Debugging cursor scaling detection...\n');
|
|
5
|
-
|
|
6
|
-
const recorder = new MacRecorder();
|
|
7
|
-
|
|
8
|
-
// Get all displays
|
|
9
|
-
const displays = await recorder.getDisplays();
|
|
10
|
-
console.log('๐บ Available displays:');
|
|
11
|
-
displays.forEach((display, index) => {
|
|
12
|
-
console.log(` Display ${index}: ID=${display.id}, ${display.resolution} at (${display.x}, ${display.y}), Primary: ${display.isPrimary}`);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
console.log('\n๐ฏ Current cursor position analysis:');
|
|
16
|
-
const position = recorder.getCursorPosition();
|
|
17
|
-
|
|
18
|
-
console.log(` Logical position: (${position.x}, ${position.y})`);
|
|
19
|
-
console.log(` Cursor type: ${position.cursorType}`);
|
|
20
|
-
console.log(` Event type: ${position.eventType}`);
|
|
21
|
-
|
|
22
|
-
if (position.scaleFactor) {
|
|
23
|
-
console.log(` Scale factor detected: ${position.scaleFactor}x`);
|
|
24
|
-
if (position.displayInfo) {
|
|
25
|
-
const info = position.displayInfo;
|
|
26
|
-
console.log(` Display bounds: (${info.displayX}, ${info.displayY})`);
|
|
27
|
-
console.log(` Logical size: ${info.logicalWidth}x${info.logicalHeight}`);
|
|
28
|
-
console.log(` Physical size: ${info.physicalWidth}x${info.physicalHeight}`);
|
|
29
|
-
console.log(` Raw position: (${position.rawX}, ${position.rawY})`);
|
|
30
|
-
}
|
|
31
|
-
} else {
|
|
32
|
-
console.log(` โ No scale factor detected`);
|
|
33
|
-
console.log(` This could mean:`);
|
|
34
|
-
console.log(` - getDisplayScalingInfo() didn't find the correct display`);
|
|
35
|
-
console.log(` - Display detection logic needs debugging`);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Find which display the cursor is on
|
|
39
|
-
console.log('\n๐ Manual display detection:');
|
|
40
|
-
displays.forEach((display, index) => {
|
|
41
|
-
const inX = position.x >= display.x && position.x < display.x + parseInt(display.resolution.split('x')[0]);
|
|
42
|
-
const inY = position.y >= display.y && position.y < display.y + parseInt(display.resolution.split('x')[1]);
|
|
43
|
-
const isInside = inX && inY;
|
|
44
|
-
|
|
45
|
-
console.log(` Display ${index} (${display.resolution}): ${isInside ? 'โ
CURSOR IS HERE' : 'โ'}`);
|
|
46
|
-
console.log(` Bounds: X(${display.x} - ${display.x + parseInt(display.resolution.split('x')[0])}), Y(${display.y} - ${display.y + parseInt(display.resolution.split('x')[1])})`);
|
|
47
|
-
console.log(` Cursor: X(${position.x}), Y(${position.y})`);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
process.exit(0);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
debugCursorScaling().catch(console.error);
|
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-cursor-output.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{"x":48,"y":72,"timestamp":22,"unixTimeMs":1752410259890,"cursorType":"pointer","type":"move"},{"x":47,"y":71,"timestamp":87,"unixTimeMs":1752410259955,"cursorType":"pointer","type":"mousedown"},{"x":47,"y":71,"timestamp":107,"unixTimeMs":1752410259975,"cursorType":"pointer","type":"move"},{"x":47,"y":71,"timestamp":169,"unixTimeMs":1752410260037,"cursorType":"pointer","type":"mouseup"},{"x":47,"y":71,"timestamp":781,"unixTimeMs":1752410260649,"cursorType":"default","type":"move"}]
|
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
|
-
}
|