node-mac-recorder 2.4.11 → 2.4.13
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/binding.gyp +5 -12
- package/index.js +25 -104
- package/install.js +2 -19
- package/package.json +2 -6
- package/src/audio_capture.mm +40 -96
- package/src/cursor_tracker.mm +4 -3
- package/src/mac_recorder.mm +673 -753
- package/src/screen_capture.h +0 -5
- package/src/screen_capture.mm +60 -139
- package/src/window_selector.mm +113 -399
- package/window-selector.js +34 -112
- package/ELECTRON-INTEGRATION.md +0 -710
- package/WINDOW_SELECTOR_USAGE.md +0 -447
- package/backup/binding.gyp +0 -44
- package/backup/src/audio_capture.mm +0 -116
- package/backup/src/cursor_tracker.mm +0 -518
- package/backup/src/mac_recorder.mm +0 -829
- package/backup/src/screen_capture.h +0 -19
- package/backup/src/screen_capture.mm +0 -162
- package/backup/src/screen_capture_kit.h +0 -15
- package/backup/src/window_selector.mm +0 -1457
- package/electron-window-selector.js +0 -698
- package/node-mac-recorder-2.4.2.tgz +0 -0
- package/prebuilds/darwin-arm64/node.napi.node +0 -0
- package/test-api-compatibility.js +0 -92
- package/test-audio.js +0 -94
- package/test-comprehensive.js +0 -164
- package/test-electron-window-selector.js +0 -119
- package/test-overlay-fix.js +0 -72
- package/test-recording.js +0 -142
- package/test-sck-availability.js +0 -26
- package/test-sck-simple.js +0 -37
- package/test-sck.js +0 -56
- package/test-screencapture-overlay.js +0 -54
- package/test-simple-windows.js +0 -29
- package/test-sync.js +0 -52
- package/test-window-details.js +0 -34
- package/test-windows.js +0 -57
package/test-sck-availability.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const nativeBinding = require('./build/Release/mac_recorder.node');
|
|
4
|
-
|
|
5
|
-
console.log('Testing ScreenCaptureKit availability...');
|
|
6
|
-
|
|
7
|
-
// Test the native functions directly
|
|
8
|
-
try {
|
|
9
|
-
console.log('Native binding methods:', Object.keys(nativeBinding));
|
|
10
|
-
|
|
11
|
-
// Check if we have the getWindows method
|
|
12
|
-
if (nativeBinding.getWindows) {
|
|
13
|
-
console.log('✅ getWindows method available');
|
|
14
|
-
const windows = nativeBinding.getWindows();
|
|
15
|
-
console.log(`Found ${windows.length} windows`);
|
|
16
|
-
|
|
17
|
-
if (windows.length > 0) {
|
|
18
|
-
console.log('First window:', windows[0]);
|
|
19
|
-
}
|
|
20
|
-
} else {
|
|
21
|
-
console.log('❌ getWindows method not available');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
} catch (error) {
|
|
25
|
-
console.error('Error:', error.message);
|
|
26
|
-
}
|
package/test-sck-simple.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
const MacRecorder = require('./index');
|
|
2
|
-
|
|
3
|
-
async function testScreenCaptureKit() {
|
|
4
|
-
console.log('Testing ScreenCaptureKit migration...');
|
|
5
|
-
|
|
6
|
-
const recorder = new MacRecorder();
|
|
7
|
-
|
|
8
|
-
try {
|
|
9
|
-
// Test 1: Check permissions
|
|
10
|
-
console.log('\n1. Testing checkPermissions()');
|
|
11
|
-
const permissions = await recorder.checkPermissions();
|
|
12
|
-
console.log('✅ Permissions:', permissions);
|
|
13
|
-
|
|
14
|
-
// Test 2: Get displays
|
|
15
|
-
console.log('\n2. Testing getDisplays()');
|
|
16
|
-
const displays = await recorder.getDisplays();
|
|
17
|
-
console.log(`✅ Found ${displays.length} displays:`, displays.map(d => `${d.id}:${d.width}x${d.height}`));
|
|
18
|
-
|
|
19
|
-
// Test 3: Get windows
|
|
20
|
-
console.log('\n3. Testing getWindows()');
|
|
21
|
-
const windows = await recorder.getWindows();
|
|
22
|
-
console.log(`✅ Found ${windows.length} windows:`, windows.slice(0, 3).map(w => `${w.id}:"${w.title}"`));
|
|
23
|
-
|
|
24
|
-
// Test 4: Get audio devices
|
|
25
|
-
console.log('\n4. Testing getAudioDevices()');
|
|
26
|
-
const audioDevices = await recorder.getAudioDevices();
|
|
27
|
-
console.log(`✅ Found ${audioDevices.length} audio devices:`, audioDevices.slice(0, 3).map(d => `${d.id}:"${d.name}"`));
|
|
28
|
-
|
|
29
|
-
console.log('\n🎉 All ScreenCaptureKit tests passed!');
|
|
30
|
-
console.log('\n✅ ScreenCaptureKit migration successful!');
|
|
31
|
-
|
|
32
|
-
} catch (error) {
|
|
33
|
-
console.error('❌ Test failed:', error);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
testScreenCaptureKit();
|
package/test-sck.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
const MacRecorder = require('./index');
|
|
2
|
-
|
|
3
|
-
function testScreenCaptureKit() {
|
|
4
|
-
console.log('Testing ScreenCaptureKit migration...');
|
|
5
|
-
|
|
6
|
-
const recorder = new MacRecorder();
|
|
7
|
-
|
|
8
|
-
try {
|
|
9
|
-
// Test getting displays
|
|
10
|
-
console.log('\n1. Testing getDisplays()');
|
|
11
|
-
recorder.getDisplays((err, displays) => {
|
|
12
|
-
if (err) {
|
|
13
|
-
console.error('getDisplays failed:', err);
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
console.log(`Found ${displays.length} displays:`, displays);
|
|
17
|
-
|
|
18
|
-
// Test getting windows
|
|
19
|
-
console.log('\n2. Testing getWindows()');
|
|
20
|
-
recorder.getWindows((err, windows) => {
|
|
21
|
-
if (err) {
|
|
22
|
-
console.error('getWindows failed:', err);
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
console.log(`Found ${windows.length} windows:`, windows.slice(0, 3));
|
|
26
|
-
|
|
27
|
-
// Test getting audio devices
|
|
28
|
-
console.log('\n3. Testing getAudioDevices()');
|
|
29
|
-
recorder.getAudioDevices((err, audioDevices) => {
|
|
30
|
-
if (err) {
|
|
31
|
-
console.error('getAudioDevices failed:', err);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
console.log(`Found ${audioDevices.length} audio devices:`, audioDevices.slice(0, 3));
|
|
35
|
-
|
|
36
|
-
// Test permissions
|
|
37
|
-
console.log('\n4. Testing checkPermissions()');
|
|
38
|
-
recorder.checkPermissions((err, hasPermissions) => {
|
|
39
|
-
if (err) {
|
|
40
|
-
console.error('checkPermissions failed:', err);
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
console.log(`Has permissions: ${hasPermissions}`);
|
|
44
|
-
|
|
45
|
-
console.log('\n✅ All basic tests passed! ScreenCaptureKit migration successful.');
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
} catch (error) {
|
|
52
|
-
console.error('❌ Test failed:', error);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
testScreenCaptureKit();
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const MacRecorder = require('./index.js');
|
|
4
|
-
|
|
5
|
-
async function testWindowSelector() {
|
|
6
|
-
try {
|
|
7
|
-
console.log('🧪 Testing ScreenCaptureKit-compatible window selector...');
|
|
8
|
-
|
|
9
|
-
// Create recorder instance
|
|
10
|
-
const recorder = new MacRecorder();
|
|
11
|
-
|
|
12
|
-
// Test if we can get windows
|
|
13
|
-
const windows = await recorder.getWindows();
|
|
14
|
-
console.log(`✅ Found ${windows.length} windows`);
|
|
15
|
-
|
|
16
|
-
if (windows.length > 0) {
|
|
17
|
-
console.log('🔍 Sample windows:');
|
|
18
|
-
windows.slice(0, 3).forEach((win, i) => {
|
|
19
|
-
console.log(` ${i+1}. ${win.appName || 'Unknown'} - "${win.title || 'Untitled'}" [${win.width || 0}x${win.height || 0}]`);
|
|
20
|
-
console.log(` ID: ${win.id}, Bundle: ${win.bundleId || 'N/A'}`);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
console.log('🪟 Testing window selection overlay...');
|
|
25
|
-
|
|
26
|
-
// Test window selection (will use ScreenCaptureKit if available)
|
|
27
|
-
const started = recorder.startWindowSelection();
|
|
28
|
-
console.log('Window selection started:', started);
|
|
29
|
-
|
|
30
|
-
if (started) {
|
|
31
|
-
console.log('✅ Window selector started successfully with ScreenCaptureKit integration');
|
|
32
|
-
console.log('📝 Press ESC to cancel or interact with the overlay');
|
|
33
|
-
|
|
34
|
-
// Wait a bit then cleanup
|
|
35
|
-
setTimeout(() => {
|
|
36
|
-
recorder.stopWindowSelection();
|
|
37
|
-
console.log('🧹 Window selector stopped');
|
|
38
|
-
|
|
39
|
-
console.log('✅ Test completed successfully!');
|
|
40
|
-
console.log('🎉 ScreenCaptureKit integration is working properly');
|
|
41
|
-
process.exit(0);
|
|
42
|
-
}, 10000);
|
|
43
|
-
} else {
|
|
44
|
-
console.log('❌ Failed to start window selector');
|
|
45
|
-
process.exit(1);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
} catch (error) {
|
|
49
|
-
console.error('❌ Test failed:', error.message);
|
|
50
|
-
process.exit(1);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
testWindowSelector();
|
package/test-simple-windows.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const MacRecorder = require('./index.js');
|
|
4
|
-
|
|
5
|
-
async function test() {
|
|
6
|
-
try {
|
|
7
|
-
const recorder = new MacRecorder();
|
|
8
|
-
console.log('Getting windows directly from native binding...');
|
|
9
|
-
|
|
10
|
-
const nativeBinding = require('./build/Release/mac_recorder.node');
|
|
11
|
-
const nativeWindows = nativeBinding.getWindows();
|
|
12
|
-
console.log('Native windows:', nativeWindows.length);
|
|
13
|
-
if (nativeWindows.length > 0) {
|
|
14
|
-
console.log('First native window:', nativeWindows[0]);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
console.log('\nGetting windows through MacRecorder class...');
|
|
18
|
-
const windows = await recorder.getWindows();
|
|
19
|
-
console.log('MacRecorder windows:', windows.length);
|
|
20
|
-
if (windows.length > 0) {
|
|
21
|
-
console.log('First MacRecorder window:', windows[0]);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
} catch (error) {
|
|
25
|
-
console.error('Error:', error);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
test();
|
package/test-sync.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
const MacRecorder = require('./index');
|
|
2
|
-
|
|
3
|
-
console.log('🔄 Testing ScreenCaptureKit Synchronous Operations...\n');
|
|
4
|
-
|
|
5
|
-
try {
|
|
6
|
-
const recorder = new MacRecorder();
|
|
7
|
-
console.log('✅ Recorder created successfully');
|
|
8
|
-
|
|
9
|
-
// Test if we can access the native module methods directly
|
|
10
|
-
console.log('📋 Available methods:');
|
|
11
|
-
const methods = Object.getOwnPropertyNames(recorder.__proto__);
|
|
12
|
-
methods.forEach(method => {
|
|
13
|
-
if (typeof recorder[method] === 'function') {
|
|
14
|
-
console.log(` • ${method}()`);
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
console.log('\n🎯 Testing basic functionality:');
|
|
19
|
-
|
|
20
|
-
// Test recording status (should be sync and work)
|
|
21
|
-
try {
|
|
22
|
-
const status = recorder.getStatus();
|
|
23
|
-
console.log(`✅ getStatus(): ${JSON.stringify(status)}`);
|
|
24
|
-
} catch (err) {
|
|
25
|
-
console.log(`❌ getStatus() failed: ${err.message}`);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Test cursor position (should be sync and work)
|
|
29
|
-
try {
|
|
30
|
-
const cursor = recorder.getCurrentCursorPosition();
|
|
31
|
-
console.log(`✅ getCurrentCursorPosition(): x=${cursor.x}, y=${cursor.y}, type=${cursor.cursorType}`);
|
|
32
|
-
} catch (err) {
|
|
33
|
-
console.log(`❌ getCurrentCursorPosition() failed: ${err.message}`);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Test cursor capture status (should be sync)
|
|
37
|
-
try {
|
|
38
|
-
const cursorStatus = recorder.getCursorCaptureStatus();
|
|
39
|
-
console.log(`✅ getCursorCaptureStatus(): tracking=${cursorStatus.isTracking}`);
|
|
40
|
-
} catch (err) {
|
|
41
|
-
console.log(`❌ getCursorCaptureStatus() failed: ${err.message}`);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
console.log('\n📊 ScreenCaptureKit sync tests completed');
|
|
45
|
-
console.log('⚠️ Async functions (getDisplays, getWindows, getAudioDevices) may hang due to permission dialogs');
|
|
46
|
-
console.log('💡 To fix: Grant screen recording permissions in System Preferences > Privacy & Security');
|
|
47
|
-
|
|
48
|
-
} catch (error) {
|
|
49
|
-
console.error('❌ Critical error:', error);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
process.exit(0);
|
package/test-window-details.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const MacRecorder = require('./index.js');
|
|
4
|
-
|
|
5
|
-
async function testWindowDetails() {
|
|
6
|
-
try {
|
|
7
|
-
const recorder = new MacRecorder();
|
|
8
|
-
const windows = await recorder.getWindows();
|
|
9
|
-
|
|
10
|
-
console.log(`Found ${windows.length} windows:`);
|
|
11
|
-
|
|
12
|
-
windows.forEach((win, i) => {
|
|
13
|
-
console.log(`\n${i+1}. Window ${win.id}:`);
|
|
14
|
-
console.log(` Title: "${win.title}"`);
|
|
15
|
-
console.log(` App: ${win.appName}`);
|
|
16
|
-
console.log(` Bundle: ${win.bundleId}`);
|
|
17
|
-
console.log(` Position: (${win.x}, ${win.y})`);
|
|
18
|
-
console.log(` Size: ${win.width} x ${win.height}`);
|
|
19
|
-
if (win.bounds) {
|
|
20
|
-
console.log(` Bounds: (${win.bounds.x}, ${win.bounds.y}) ${win.bounds.width}x${win.bounds.height}`);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (i >= 10) { // Limit output
|
|
24
|
-
console.log(`\n... and ${windows.length - 11} more windows`);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
} catch (error) {
|
|
30
|
-
console.error('Error:', error.message);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
testWindowDetails();
|
package/test-windows.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
const MacRecorder = require('./index');
|
|
2
|
-
|
|
3
|
-
function testWindowSelection() {
|
|
4
|
-
console.log('🔍 Testing ScreenCaptureKit Window Selection...\n');
|
|
5
|
-
|
|
6
|
-
const recorder = new MacRecorder();
|
|
7
|
-
|
|
8
|
-
try {
|
|
9
|
-
// Test window enumeration
|
|
10
|
-
recorder.getWindows((err, windows) => {
|
|
11
|
-
if (err) {
|
|
12
|
-
console.error('❌ getWindows failed:', err);
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
console.log(`✅ Found ${windows.length} windows`);
|
|
17
|
-
|
|
18
|
-
// Show first few windows with details
|
|
19
|
-
windows.slice(0, 5).forEach((window, index) => {
|
|
20
|
-
console.log(`${index + 1}. "${window.name}" - ${window.appName}`);
|
|
21
|
-
console.log(` ID: ${window.id}, Size: ${window.width}x${window.height}, Position: (${window.x}, ${window.y})`);
|
|
22
|
-
console.log(` On Screen: ${window.isOnScreen !== false ? 'Yes' : 'No'}\n`);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
// Test window thumbnails if we have windows
|
|
26
|
-
if (windows.length > 0) {
|
|
27
|
-
const firstWindow = windows[0];
|
|
28
|
-
console.log(`📸 Testing window thumbnail for: "${firstWindow.name}"`);
|
|
29
|
-
|
|
30
|
-
recorder.getWindowThumbnail(firstWindow.id, 300, 200, (err, thumbnail) => {
|
|
31
|
-
if (err) {
|
|
32
|
-
console.error('❌ getWindowThumbnail failed:', err);
|
|
33
|
-
} else {
|
|
34
|
-
console.log(`✅ Window thumbnail generated: ${thumbnail.length} characters (base64)`);
|
|
35
|
-
|
|
36
|
-
// Test window recording info
|
|
37
|
-
console.log(`\n🎬 Window recording info:`);
|
|
38
|
-
console.log(` Target Window: "${firstWindow.name}" (ID: ${firstWindow.id})`);
|
|
39
|
-
console.log(` App: ${firstWindow.appName}`);
|
|
40
|
-
console.log(` Capture Area: ${firstWindow.width}x${firstWindow.height}`);
|
|
41
|
-
console.log(` Would use windowId option for recording`);
|
|
42
|
-
|
|
43
|
-
console.log('\n✅ Window selection tests completed successfully!');
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
} else {
|
|
47
|
-
console.log('⚠️ No windows found for thumbnail testing');
|
|
48
|
-
console.log('\n✅ Window enumeration test completed successfully!');
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
} catch (error) {
|
|
53
|
-
console.error('❌ Window selection test failed:', error);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
testWindowSelection();
|