@midscene/android-playground 1.12.1-beta-20260827032340.0 → 1.12.1

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/es/bin.mjs CHANGED
@@ -3,7 +3,8 @@ import { createScrcpyPreviewDescriptor, definePlaygroundPlatform, launchPrepared
3
3
  import { AndroidAgent, AndroidDevice, getConnectedDevicesWithDetails } from "@midscene/android";
4
4
  import { PLAYGROUND_SERVER_PORT, SCRCPY_ADB_CONNECT_TIMEOUT_MS, SCRCPY_PREVIEW_METADATA_TIMEOUT_MS, SCRCPY_PUSH_TIMEOUT_MS, SCRCPY_SERVER_PORT, SCRCPY_START_TIMEOUT_MS, SCRCPY_VIDEO_STREAM_TIMEOUT_MS } from "@midscene/shared/constants";
5
5
  import { findAvailablePort } from "@midscene/shared/node";
6
- import { execFile } from "node:child_process";
6
+ import { exec } from "node:child_process";
7
+ import { createReadStream } from "node:fs";
7
8
  import { createServer } from "node:http";
8
9
  import { fileURLToPath } from "node:url";
9
10
  import { promisify } from "node:util";
@@ -224,7 +225,7 @@ function scrcpy_server_define_property(obj, key, value) {
224
225
  return obj;
225
226
  }
226
227
  const debugPage = getDebug('android:playground');
227
- const promiseExecFile = promisify(execFile);
228
+ const promiseExec = promisify(exec);
228
229
  const LOOPBACK_HOSTS = new Set([
229
230
  'localhost',
230
231
  '127.0.0.1',
@@ -325,9 +326,7 @@ class ScrcpyServer {
325
326
  try {
326
327
  if (this.adbClient) debugPage('use existing adb client');
327
328
  else {
328
- await withTimeout(promiseExecFile('adb', [
329
- 'start-server'
330
- ]), SCRCPY_ADB_CONNECT_TIMEOUT_MS, `Timed out starting adb server after ${Math.round(SCRCPY_ADB_CONNECT_TIMEOUT_MS / 1000)}s`);
329
+ await withTimeout(promiseExec('adb start-server'), SCRCPY_ADB_CONNECT_TIMEOUT_MS, `Timed out starting adb server after ${Math.round(SCRCPY_ADB_CONNECT_TIMEOUT_MS / 1000)}s`);
331
330
  debugPage('adb server started');
332
331
  debugPage('initialize adb client');
333
332
  this.adbClient = new AdbServerClient(new AdbServerNodeTcpConnector({
@@ -365,18 +364,13 @@ class ScrcpyServer {
365
364
  }
366
365
  async startScrcpy(adb, options = {}, onProgress) {
367
366
  const { AdbScrcpyClient, AdbScrcpyOptions3_3_3 } = await import("@yume-chan/adb-scrcpy");
367
+ const { ReadableStream } = await import("@yume-chan/stream-extra");
368
368
  const { DefaultServerPath } = await import("@yume-chan/scrcpy");
369
369
  const currentDir = 'undefined' != typeof __dirname ? __dirname : node_path.dirname(fileURLToPath(import.meta.url));
370
370
  const serverBinPath = node_path.resolve(currentDir, '../../bin/scrcpy-server');
371
371
  try {
372
372
  onProgress?.('pushing-server');
373
- await withTimeout(promiseExecFile('adb', [
374
- '-s',
375
- adb.serial,
376
- 'push',
377
- serverBinPath,
378
- DefaultServerPath
379
- ]), SCRCPY_PUSH_TIMEOUT_MS, `Timed out pushing scrcpy server to device after ${Math.round(SCRCPY_PUSH_TIMEOUT_MS / 1000)}s`);
373
+ await withTimeout(AdbScrcpyClient.pushServer(adb, ReadableStream.from(createReadStream(serverBinPath))), SCRCPY_PUSH_TIMEOUT_MS, `Timed out pushing scrcpy server to device after ${Math.round(SCRCPY_PUSH_TIMEOUT_MS / 1000)}s`);
380
374
  const scrcpyOptions = new AdbScrcpyOptions3_3_3({
381
375
  audio: false,
382
376
  control: true,
package/dist/es/index.mjs CHANGED
@@ -3,7 +3,8 @@ import { AndroidAgent, AndroidDevice, getConnectedDevicesWithDetails } from "@mi
3
3
  import { createScrcpyPreviewDescriptor, definePlaygroundPlatform } from "@midscene/playground";
4
4
  import { PLAYGROUND_SERVER_PORT, SCRCPY_ADB_CONNECT_TIMEOUT_MS, SCRCPY_PREVIEW_METADATA_TIMEOUT_MS, SCRCPY_PUSH_TIMEOUT_MS, SCRCPY_SERVER_PORT, SCRCPY_START_TIMEOUT_MS, SCRCPY_VIDEO_STREAM_TIMEOUT_MS } from "@midscene/shared/constants";
5
5
  import { findAvailablePort } from "@midscene/shared/node";
6
- import { execFile } from "node:child_process";
6
+ import { exec } from "node:child_process";
7
+ import { createReadStream } from "node:fs";
7
8
  import { createServer } from "node:http";
8
9
  import { fileURLToPath } from "node:url";
9
10
  import { promisify } from "node:util";
@@ -224,7 +225,7 @@ function scrcpy_server_define_property(obj, key, value) {
224
225
  return obj;
225
226
  }
226
227
  const debugPage = getDebug('android:playground');
227
- const promiseExecFile = promisify(execFile);
228
+ const promiseExec = promisify(exec);
228
229
  const LOOPBACK_HOSTS = new Set([
229
230
  'localhost',
230
231
  '127.0.0.1',
@@ -325,9 +326,7 @@ class ScrcpyServer {
325
326
  try {
326
327
  if (this.adbClient) debugPage('use existing adb client');
327
328
  else {
328
- await withTimeout(promiseExecFile('adb', [
329
- 'start-server'
330
- ]), SCRCPY_ADB_CONNECT_TIMEOUT_MS, `Timed out starting adb server after ${Math.round(SCRCPY_ADB_CONNECT_TIMEOUT_MS / 1000)}s`);
329
+ await withTimeout(promiseExec('adb start-server'), SCRCPY_ADB_CONNECT_TIMEOUT_MS, `Timed out starting adb server after ${Math.round(SCRCPY_ADB_CONNECT_TIMEOUT_MS / 1000)}s`);
331
330
  debugPage('adb server started');
332
331
  debugPage('initialize adb client');
333
332
  this.adbClient = new AdbServerClient(new AdbServerNodeTcpConnector({
@@ -365,18 +364,13 @@ class ScrcpyServer {
365
364
  }
366
365
  async startScrcpy(adb, options = {}, onProgress) {
367
366
  const { AdbScrcpyClient, AdbScrcpyOptions3_3_3 } = await import("@yume-chan/adb-scrcpy");
367
+ const { ReadableStream } = await import("@yume-chan/stream-extra");
368
368
  const { DefaultServerPath } = await import("@yume-chan/scrcpy");
369
369
  const currentDir = 'undefined' != typeof __dirname ? __dirname : node_path.dirname(fileURLToPath(import.meta.url));
370
370
  const serverBinPath = node_path.resolve(currentDir, '../../bin/scrcpy-server');
371
371
  try {
372
372
  onProgress?.('pushing-server');
373
- await withTimeout(promiseExecFile('adb', [
374
- '-s',
375
- adb.serial,
376
- 'push',
377
- serverBinPath,
378
- DefaultServerPath
379
- ]), SCRCPY_PUSH_TIMEOUT_MS, `Timed out pushing scrcpy server to device after ${Math.round(SCRCPY_PUSH_TIMEOUT_MS / 1000)}s`);
373
+ await withTimeout(AdbScrcpyClient.pushServer(adb, ReadableStream.from(createReadStream(serverBinPath))), SCRCPY_PUSH_TIMEOUT_MS, `Timed out pushing scrcpy server to device after ${Math.round(SCRCPY_PUSH_TIMEOUT_MS / 1000)}s`);
380
374
  const scrcpyOptions = new AdbScrcpyOptions3_3_3({
381
375
  audio: false,
382
376
  control: true,
package/dist/lib/bin.js CHANGED
@@ -162,6 +162,7 @@ const androidPlaygroundPlatform = (0, playground_namespaceObject.definePlaygroun
162
162
  }
163
163
  });
164
164
  const external_node_child_process_namespaceObject = require("node:child_process");
165
+ const external_node_fs_namespaceObject = require("node:fs");
165
166
  const external_node_http_namespaceObject = require("node:http");
166
167
  require("node:url");
167
168
  const external_node_util_namespaceObject = require("node:util");
@@ -250,7 +251,7 @@ function scrcpy_server_define_property(obj, key, value) {
250
251
  return obj;
251
252
  }
252
253
  const debugPage = (0, logger_namespaceObject.getDebug)('android:playground');
253
- const promiseExecFile = (0, external_node_util_namespaceObject.promisify)(external_node_child_process_namespaceObject.execFile);
254
+ const promiseExec = (0, external_node_util_namespaceObject.promisify)(external_node_child_process_namespaceObject.exec);
254
255
  const LOOPBACK_HOSTS = new Set([
255
256
  'localhost',
256
257
  '127.0.0.1',
@@ -351,9 +352,7 @@ class ScrcpyServer {
351
352
  try {
352
353
  if (this.adbClient) debugPage('use existing adb client');
353
354
  else {
354
- await withTimeout(promiseExecFile('adb', [
355
- 'start-server'
356
- ]), constants_namespaceObject.SCRCPY_ADB_CONNECT_TIMEOUT_MS, `Timed out starting adb server after ${Math.round(constants_namespaceObject.SCRCPY_ADB_CONNECT_TIMEOUT_MS / 1000)}s`);
355
+ await withTimeout(promiseExec('adb start-server'), constants_namespaceObject.SCRCPY_ADB_CONNECT_TIMEOUT_MS, `Timed out starting adb server after ${Math.round(constants_namespaceObject.SCRCPY_ADB_CONNECT_TIMEOUT_MS / 1000)}s`);
357
356
  debugPage('adb server started');
358
357
  debugPage('initialize adb client');
359
358
  this.adbClient = new AdbServerClient(new AdbServerNodeTcpConnector({
@@ -391,18 +390,13 @@ class ScrcpyServer {
391
390
  }
392
391
  async startScrcpy(adb, options = {}, onProgress) {
393
392
  const { AdbScrcpyClient, AdbScrcpyOptions3_3_3 } = await import("@yume-chan/adb-scrcpy");
393
+ const { ReadableStream } = await import("@yume-chan/stream-extra");
394
394
  const { DefaultServerPath } = await import("@yume-chan/scrcpy");
395
395
  const currentDir = __dirname;
396
396
  const serverBinPath = external_node_path_default().resolve(currentDir, '../../bin/scrcpy-server');
397
397
  try {
398
398
  onProgress?.('pushing-server');
399
- await withTimeout(promiseExecFile('adb', [
400
- '-s',
401
- adb.serial,
402
- 'push',
403
- serverBinPath,
404
- DefaultServerPath
405
- ]), constants_namespaceObject.SCRCPY_PUSH_TIMEOUT_MS, `Timed out pushing scrcpy server to device after ${Math.round(constants_namespaceObject.SCRCPY_PUSH_TIMEOUT_MS / 1000)}s`);
399
+ await withTimeout(AdbScrcpyClient.pushServer(adb, ReadableStream.from((0, external_node_fs_namespaceObject.createReadStream)(serverBinPath))), constants_namespaceObject.SCRCPY_PUSH_TIMEOUT_MS, `Timed out pushing scrcpy server to device after ${Math.round(constants_namespaceObject.SCRCPY_PUSH_TIMEOUT_MS / 1000)}s`);
406
400
  const scrcpyOptions = new AdbScrcpyOptions3_3_3({
407
401
  audio: false,
408
402
  control: true,
package/dist/lib/index.js CHANGED
@@ -177,6 +177,7 @@ const androidPlaygroundPlatform = (0, playground_namespaceObject.definePlaygroun
177
177
  }
178
178
  });
179
179
  const external_node_child_process_namespaceObject = require("node:child_process");
180
+ const external_node_fs_namespaceObject = require("node:fs");
180
181
  const external_node_http_namespaceObject = require("node:http");
181
182
  require("node:url");
182
183
  const external_node_util_namespaceObject = require("node:util");
@@ -265,7 +266,7 @@ function scrcpy_server_define_property(obj, key, value) {
265
266
  return obj;
266
267
  }
267
268
  const debugPage = (0, logger_namespaceObject.getDebug)('android:playground');
268
- const promiseExecFile = (0, external_node_util_namespaceObject.promisify)(external_node_child_process_namespaceObject.execFile);
269
+ const promiseExec = (0, external_node_util_namespaceObject.promisify)(external_node_child_process_namespaceObject.exec);
269
270
  const LOOPBACK_HOSTS = new Set([
270
271
  'localhost',
271
272
  '127.0.0.1',
@@ -366,9 +367,7 @@ class ScrcpyServer {
366
367
  try {
367
368
  if (this.adbClient) debugPage('use existing adb client');
368
369
  else {
369
- await withTimeout(promiseExecFile('adb', [
370
- 'start-server'
371
- ]), constants_namespaceObject.SCRCPY_ADB_CONNECT_TIMEOUT_MS, `Timed out starting adb server after ${Math.round(constants_namespaceObject.SCRCPY_ADB_CONNECT_TIMEOUT_MS / 1000)}s`);
370
+ await withTimeout(promiseExec('adb start-server'), constants_namespaceObject.SCRCPY_ADB_CONNECT_TIMEOUT_MS, `Timed out starting adb server after ${Math.round(constants_namespaceObject.SCRCPY_ADB_CONNECT_TIMEOUT_MS / 1000)}s`);
372
371
  debugPage('adb server started');
373
372
  debugPage('initialize adb client');
374
373
  this.adbClient = new AdbServerClient(new AdbServerNodeTcpConnector({
@@ -406,18 +405,13 @@ class ScrcpyServer {
406
405
  }
407
406
  async startScrcpy(adb, options = {}, onProgress) {
408
407
  const { AdbScrcpyClient, AdbScrcpyOptions3_3_3 } = await import("@yume-chan/adb-scrcpy");
408
+ const { ReadableStream } = await import("@yume-chan/stream-extra");
409
409
  const { DefaultServerPath } = await import("@yume-chan/scrcpy");
410
410
  const currentDir = __dirname;
411
411
  const serverBinPath = external_node_path_default().resolve(currentDir, '../../bin/scrcpy-server');
412
412
  try {
413
413
  onProgress?.('pushing-server');
414
- await withTimeout(promiseExecFile('adb', [
415
- '-s',
416
- adb.serial,
417
- 'push',
418
- serverBinPath,
419
- DefaultServerPath
420
- ]), constants_namespaceObject.SCRCPY_PUSH_TIMEOUT_MS, `Timed out pushing scrcpy server to device after ${Math.round(constants_namespaceObject.SCRCPY_PUSH_TIMEOUT_MS / 1000)}s`);
414
+ await withTimeout(AdbScrcpyClient.pushServer(adb, ReadableStream.from((0, external_node_fs_namespaceObject.createReadStream)(serverBinPath))), constants_namespaceObject.SCRCPY_PUSH_TIMEOUT_MS, `Timed out pushing scrcpy server to device after ${Math.round(constants_namespaceObject.SCRCPY_PUSH_TIMEOUT_MS / 1000)}s`);
421
415
  const scrcpyOptions = new AdbScrcpyOptions3_3_3({
422
416
  audio: false,
423
417
  control: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midscene/android-playground",
3
- "version": "1.12.1-beta-20260827032340.0",
3
+ "version": "1.12.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/midscene.git",
@@ -39,10 +39,10 @@
39
39
  "express": "^4.21.2",
40
40
  "open": "10.1.0",
41
41
  "socket.io": "^4.8.1",
42
- "@midscene/android": "1.12.1-beta-20260827032340.0",
43
- "@midscene/core": "1.12.1-beta-20260827032340.0",
44
- "@midscene/shared": "1.12.1-beta-20260827032340.0",
45
- "@midscene/playground": "1.12.1-beta-20260827032340.0"
42
+ "@midscene/android": "1.12.1",
43
+ "@midscene/core": "1.12.1",
44
+ "@midscene/playground": "1.12.1",
45
+ "@midscene/shared": "1.12.1"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@rslib/core": "^0.18.3",
package/static/index.html CHANGED
@@ -1 +1 @@
1
- <!doctype html><html><head><title>Midscene Android Playground</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><script defer src="/static/js/lib-react.574e3de9.js"></script><script defer src="/static/js/226.8c99280b.js"></script><script defer src="/static/js/index.a14900b2.js"></script><link href="/static/css/index.67caac18.css" rel="stylesheet"></head><body><div id="root"></div></body></html>
1
+ <!doctype html><html><head><title>Midscene Android Playground</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><script defer src="/static/js/lib-react.574e3de9.js"></script><script defer src="/static/js/226.8c99280b.js"></script><script defer src="/static/js/index.48ef103c.js"></script><link href="/static/css/index.67caac18.css" rel="stylesheet"></head><body><div id="root"></div></body></html>