node-mac-recorder 1.2.9 → 1.2.10
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 +5 -5
- package/package.json +1 -1
- package/src/mac_recorder.mm +17 -3
package/index.js
CHANGED
|
@@ -163,7 +163,7 @@ class MacRecorder extends EventEmitter {
|
|
|
163
163
|
targetWindow.y >= display.y &&
|
|
164
164
|
targetWindow.y < display.y + displayHeight
|
|
165
165
|
) {
|
|
166
|
-
targetDisplayId =
|
|
166
|
+
targetDisplayId = display.id; // Use actual display ID, not array index
|
|
167
167
|
// Koordinatları display'e göre normalize et
|
|
168
168
|
adjustedX = targetWindow.x - display.x;
|
|
169
169
|
adjustedY = targetWindow.y - display.y;
|
|
@@ -175,7 +175,7 @@ class MacRecorder extends EventEmitter {
|
|
|
175
175
|
if (targetDisplayId === null) {
|
|
176
176
|
const mainDisplay = displays.find((d) => d.x === 0 && d.y === 0);
|
|
177
177
|
if (mainDisplay) {
|
|
178
|
-
targetDisplayId =
|
|
178
|
+
targetDisplayId = mainDisplay.id; // Use actual display ID, not array index
|
|
179
179
|
adjustedX = Math.max(
|
|
180
180
|
0,
|
|
181
181
|
Math.min(
|
|
@@ -200,7 +200,7 @@ class MacRecorder extends EventEmitter {
|
|
|
200
200
|
this.options.displayId = targetDisplayId;
|
|
201
201
|
|
|
202
202
|
// Recording için display bilgisini sakla (cursor capture için)
|
|
203
|
-
const targetDisplay = displays
|
|
203
|
+
const targetDisplay = displays.find(d => d.id === targetDisplayId);
|
|
204
204
|
this.recordingDisplayInfo = {
|
|
205
205
|
displayId: targetDisplayId,
|
|
206
206
|
x: targetDisplay.x,
|
|
@@ -233,8 +233,8 @@ class MacRecorder extends EventEmitter {
|
|
|
233
233
|
if (this.options.displayId !== null && !this.recordingDisplayInfo) {
|
|
234
234
|
try {
|
|
235
235
|
const displays = await this.getDisplays();
|
|
236
|
-
|
|
237
|
-
|
|
236
|
+
const targetDisplay = displays.find(d => d.id === this.options.displayId);
|
|
237
|
+
if (targetDisplay) {
|
|
238
238
|
this.recordingDisplayInfo = {
|
|
239
239
|
displayId: this.options.displayId,
|
|
240
240
|
x: targetDisplay.x,
|
package/package.json
CHANGED
package/src/mac_recorder.mm
CHANGED
|
@@ -113,16 +113,30 @@ Napi::Value StartRecording(const Napi::CallbackInfo& info) {
|
|
|
113
113
|
if (options.Has("displayId") && !options.Get("displayId").IsNull()) {
|
|
114
114
|
double displayIdNum = options.Get("displayId").As<Napi::Number>().DoubleValue();
|
|
115
115
|
|
|
116
|
-
//
|
|
116
|
+
// Use the display ID directly (not as an index)
|
|
117
|
+
// The JavaScript layer passes the actual CGDirectDisplayID
|
|
118
|
+
displayID = (CGDirectDisplayID)displayIdNum;
|
|
119
|
+
|
|
120
|
+
// Verify that this display ID is valid
|
|
117
121
|
uint32_t displayCount;
|
|
118
122
|
CGGetActiveDisplayList(0, NULL, &displayCount);
|
|
119
123
|
if (displayCount > 0) {
|
|
120
124
|
CGDirectDisplayID *displays = (CGDirectDisplayID*)malloc(displayCount * sizeof(CGDirectDisplayID));
|
|
121
125
|
CGGetActiveDisplayList(displayCount, displays, &displayCount);
|
|
122
126
|
|
|
123
|
-
|
|
124
|
-
|
|
127
|
+
bool validDisplay = false;
|
|
128
|
+
for (uint32_t i = 0; i < displayCount; i++) {
|
|
129
|
+
if (displays[i] == displayID) {
|
|
130
|
+
validDisplay = true;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (!validDisplay) {
|
|
136
|
+
// Fallback to main display if invalid ID provided
|
|
137
|
+
displayID = CGMainDisplayID();
|
|
125
138
|
}
|
|
139
|
+
|
|
126
140
|
free(displays);
|
|
127
141
|
}
|
|
128
142
|
}
|