tamga-vdesktop 1.2.2 → 1.2.4

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/dist/cli.js CHANGED
@@ -1187,6 +1187,15 @@ var ChromiumDesktopSession = class {
1187
1187
  cdp.on("Page.screencastFrame", (payload) => {
1188
1188
  cdp.send("Page.screencastFrameAck", { sessionId: payload.sessionId }).catch(() => {
1189
1189
  });
1190
+ const now = Date.now();
1191
+ if (payload.data === tab.lastScreencastData) {
1192
+ return;
1193
+ }
1194
+ if (now < (tab.suppressSettleUntil || 0) && (tab.lastUserInputAt || 0) <= (tab.lastPngAt || 0)) {
1195
+ tab.lastScreencastData = payload.data;
1196
+ return;
1197
+ }
1198
+ tab.lastScreencastData = payload.data;
1190
1199
  const jpegBuf = Buffer.from(payload.data, "base64");
1191
1200
  const packet = Buffer.allocUnsafe(1 + jpegBuf.length);
1192
1201
  packet[0] = PACKET_VIDEO_JPEG;
@@ -1195,15 +1204,13 @@ var ChromiumDesktopSession = class {
1195
1204
  this.recordFrameTick();
1196
1205
  if (this.activeTabId === tab.id && tab.mode === "web") {
1197
1206
  this.broadcastBinary(packet);
1198
- if (Date.now() > (tab.suppressSettleUntil || 0)) {
1199
- if (tab.settleTimer) clearTimeout(tab.settleTimer);
1200
- tab.settleTimer = setTimeout(() => {
1201
- if (this.activeTabId === tab.id && tab.mode === "web") {
1202
- this.captureImmediateFrame(tab).catch(() => {
1203
- });
1204
- }
1205
- }, 220);
1206
- }
1207
+ if (tab.settleTimer) clearTimeout(tab.settleTimer);
1208
+ tab.settleTimer = setTimeout(() => {
1209
+ if (this.activeTabId === tab.id && tab.mode === "web") {
1210
+ this.captureImmediateFrame(tab).catch(() => {
1211
+ });
1212
+ }
1213
+ }, 220);
1207
1214
  }
1208
1215
  });
1209
1216
  const syncPageMeta = async () => {
@@ -1320,8 +1327,10 @@ var ChromiumDesktopSession = class {
1320
1327
  async captureImmediateFrame(tab) {
1321
1328
  if (!tab.page || tab.page.isClosed() || tab.mode !== "web") return;
1322
1329
  try {
1323
- tab.suppressSettleUntil = Date.now() + 380;
1330
+ tab.suppressSettleUntil = Date.now() + 900;
1324
1331
  const pngBuf = await tab.page.screenshot({ type: "png" });
1332
+ tab.lastPngAt = Date.now();
1333
+ tab.suppressSettleUntil = tab.lastPngAt + 550;
1325
1334
  const packet = Buffer.allocUnsafe(1 + pngBuf.length);
1326
1335
  packet[0] = PACKET_VIDEO_JPEG;
1327
1336
  pngBuf.copy(packet, 1);
@@ -1342,6 +1351,8 @@ var ChromiumDesktopSession = class {
1342
1351
  tab.mode = parsed.mode;
1343
1352
  tab.filePath = parsed.filePath;
1344
1353
  tab.url = parsed.url;
1354
+ tab.lastScreencastData = void 0;
1355
+ tab.suppressSettleUntil = 0;
1345
1356
  if (parsed.mode === "newtab") {
1346
1357
  await this.stopScreencast(tab);
1347
1358
  tab.title = "Yeni Sekme";
@@ -1446,6 +1457,8 @@ var ChromiumDesktopSession = class {
1446
1457
  const active = this.activeTabId ? this.tabs.get(this.activeTabId) : void 0;
1447
1458
  if (active?.mode === "web" && active.page && !active.page.isClosed()) {
1448
1459
  try {
1460
+ active.lastScreencastData = void 0;
1461
+ active.suppressSettleUntil = 0;
1449
1462
  await this.stopScreencast(active);
1450
1463
  await this.applyTabMetrics(active);
1451
1464
  await this.startScreencast(active);
@@ -1459,6 +1472,7 @@ var ChromiumDesktopSession = class {
1459
1472
  if (!tabId) return;
1460
1473
  const tab = this.tabs.get(tabId);
1461
1474
  if (!tab || tab.mode !== "web" || !tab.page || !tab.cdp || tab.page.isClosed()) return;
1475
+ tab.lastUserInputAt = Date.now();
1462
1476
  const kind = payload.kind;
1463
1477
  if (kind === "mouse") {
1464
1478
  const eventType = payload.eventType;
@@ -3771,7 +3785,7 @@ var VSCodeServerManager = class {
3771
3785
  };
3772
3786
 
3773
3787
  // server/index.ts
3774
- var TAMGA_VERSION = "1.2.2";
3788
+ var TAMGA_VERSION = "1.2.4";
3775
3789
  var MIME_MAP = {
3776
3790
  html: "text/html; charset=utf-8",
3777
3791
  htm: "text/html; charset=utf-8",