ms-vite-plugin 1.4.30 → 1.4.32
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/build.js +2 -0
- package/docs/api/cloud.md +15 -0
- package/docs/api/global.md +15 -8
- package/docs/apicn/cloud.md +15 -0
- package/docs/apicn/global.md +15 -8
- package/docs/apipython/cloud.md +15 -0
- package/docs/apipython/g.md +64 -0
- package/docs/httpapi/api.md +179 -10
- package/package.json +1 -1
package/dist/build.js
CHANGED
package/docs/api/cloud.md
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
`event` 是脚本和服务器约定的自定义事件名。`data` 在 JS 中是普通 Object,必须能被 JSON 序列化。
|
|
33
|
+
设备总览自定义字段读取最新一次 `cloud:status` 上报数据;上报时事件名固定为 `cloud:status`,`data` 是 key-value 对象。
|
|
33
34
|
|
|
34
35
|
## API 参考
|
|
35
36
|
|
|
@@ -128,6 +129,20 @@ const ok = cloud.report("taskFinished", {
|
|
|
128
129
|
logi("上报结果:", ok);
|
|
129
130
|
```
|
|
130
131
|
|
|
132
|
+
**上报云控状态**
|
|
133
|
+
|
|
134
|
+
设备总览自定义字段读取设备最新 `cloud:status` 上报数据。服务端按设备只保存最新一份状态;同一设备再次上报会覆盖前一次状态。
|
|
135
|
+
|
|
136
|
+
`data` 的 key 必须使用云控端已经配置好的设备总览自定义字段名。上报了云控端未配置的多余字段时,协议仍可发送,但云控端设备总览不会显示这些字段。
|
|
137
|
+
|
|
138
|
+
```javascript
|
|
139
|
+
cloud.report("cloud:status", {
|
|
140
|
+
taskName: "巡检任务",
|
|
141
|
+
progress: 80,
|
|
142
|
+
online: true,
|
|
143
|
+
});
|
|
144
|
+
```
|
|
145
|
+
|
|
131
146
|
### onEvent - 监听服务器事件
|
|
132
147
|
|
|
133
148
|
```typescript
|
package/docs/api/global.md
CHANGED
|
@@ -459,25 +459,32 @@ logi(`CPU 限流延迟: ${delay.minMs}~${delay.maxMs}ms`);
|
|
|
459
459
|
设置停止回调函数。此回调注册接口只能在主线程调用,不能在线程脚本中调用。
|
|
460
460
|
|
|
461
461
|
```typescript
|
|
462
|
-
function setStopCallback(
|
|
462
|
+
function setStopCallback(
|
|
463
|
+
callback: (status: "success" | "error" | "stopped") => void,
|
|
464
|
+
): void;
|
|
463
465
|
```
|
|
464
466
|
|
|
465
467
|
**参数:**
|
|
466
468
|
|
|
467
|
-
| 参数名 | 类型
|
|
468
|
-
| ---------- |
|
|
469
|
-
| `callback` | () => void | 是 | - | 停止回调函数 |
|
|
469
|
+
| 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
|
|
470
|
+
| ---------- | ------------------------------------------------------ | -------- | ------ | ------------ |
|
|
471
|
+
| `callback` | (status: "success" \| "error" \| "stopped") => void | 是 | - | 停止回调函数 |
|
|
470
472
|
|
|
471
473
|
**说明:**
|
|
472
474
|
|
|
473
|
-
|
|
475
|
+
脚本执行停止时调用,`status` 表示停止状态:`success` 为正常完成,`error` 为异常停止,`stopped` 为手动停止。
|
|
474
476
|
|
|
475
477
|
**示例:**
|
|
476
478
|
|
|
477
479
|
```javascript
|
|
478
|
-
setStopCallback(() => {
|
|
479
|
-
|
|
480
|
-
|
|
480
|
+
setStopCallback((status) => {
|
|
481
|
+
if (status === "success") {
|
|
482
|
+
logi("脚本执行完成");
|
|
483
|
+
} else if (status === "error") {
|
|
484
|
+
loge("脚本执行异常");
|
|
485
|
+
} else if (status === "stopped") {
|
|
486
|
+
logi("脚本手动停止");
|
|
487
|
+
}
|
|
481
488
|
});
|
|
482
489
|
```
|
|
483
490
|
|
package/docs/apicn/cloud.md
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
`event` 是脚本和服务器约定的自定义事件名。`data` 在 JS 中是普通 Object,必须能被 JSON 序列化。
|
|
33
|
+
设备总览自定义字段读取最新一次 `cloud:status` 上报数据;上报时事件名固定为 `cloud:status`,`data` 是 key-value 对象。
|
|
33
34
|
|
|
34
35
|
## API 参考
|
|
35
36
|
|
|
@@ -128,6 +129,20 @@ const 成功 = $云控.上报数据("taskFinished", {
|
|
|
128
129
|
$打印信息日志("上报结果:", 成功);
|
|
129
130
|
```
|
|
130
131
|
|
|
132
|
+
**上报云控状态**
|
|
133
|
+
|
|
134
|
+
设备总览自定义字段读取设备最新 `cloud:status` 上报数据。服务端按设备只保存最新一份状态;同一设备再次上报会覆盖前一次状态。
|
|
135
|
+
|
|
136
|
+
`数据` 的 key 必须使用云控端已经配置好的设备总览自定义字段名。上报了云控端未配置的多余字段时,协议仍可发送,但云控端设备总览不会显示这些字段。
|
|
137
|
+
|
|
138
|
+
```javascript
|
|
139
|
+
$云控.上报数据("cloud:status", {
|
|
140
|
+
taskName: "巡检任务",
|
|
141
|
+
progress: 80,
|
|
142
|
+
online: true,
|
|
143
|
+
});
|
|
144
|
+
```
|
|
145
|
+
|
|
131
146
|
### 监听事件回调
|
|
132
147
|
|
|
133
148
|
```typescript
|
package/docs/apicn/global.md
CHANGED
|
@@ -460,25 +460,32 @@ $打印信息日志(`CPU 限流延迟: ${延迟.minMs}~${延迟.maxMs}ms`);
|
|
|
460
460
|
设置停止回调函数。该回调注册接口只能在主线程调用,不能在线程脚本中调用。
|
|
461
461
|
|
|
462
462
|
```typescript
|
|
463
|
-
declare const $设置停止回调: (
|
|
463
|
+
declare const $设置停止回调: (
|
|
464
|
+
回调: (状态: "success" | "error" | "stopped") => 无返回值,
|
|
465
|
+
) => 无返回值;
|
|
464
466
|
```
|
|
465
467
|
|
|
466
468
|
**参数:**
|
|
467
469
|
|
|
468
|
-
| 参数名 | 类型
|
|
469
|
-
| ------ |
|
|
470
|
-
| `回调` | () => 无返回值 | 是 | - | 停止回调函数 |
|
|
470
|
+
| 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
|
|
471
|
+
| ------ | ---------------------------------------------------------- | -------- | ------ | ------------ |
|
|
472
|
+
| `回调` | (状态: "success" \| "error" \| "stopped") => 无返回值 | 是 | - | 停止回调函数 |
|
|
471
473
|
|
|
472
474
|
**说明:**
|
|
473
475
|
|
|
474
|
-
|
|
476
|
+
脚本执行停止时调用,`状态` 表示停止状态:`success` 为正常完成,`error` 为异常停止,`stopped` 为手动停止。
|
|
475
477
|
|
|
476
478
|
**示例:**
|
|
477
479
|
|
|
478
480
|
```javascript
|
|
479
|
-
$设置停止回调(() => {
|
|
480
|
-
|
|
481
|
-
|
|
481
|
+
$设置停止回调((状态) => {
|
|
482
|
+
if (状态 === "success") {
|
|
483
|
+
$打印信息日志("脚本执行完成");
|
|
484
|
+
} else if (状态 === "error") {
|
|
485
|
+
$打印错误日志("脚本执行异常");
|
|
486
|
+
} else if (状态 === "stopped") {
|
|
487
|
+
$打印信息日志("脚本手动停止");
|
|
488
|
+
}
|
|
482
489
|
});
|
|
483
490
|
```
|
|
484
491
|
|
package/docs/apipython/cloud.md
CHANGED
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
`event` 是脚本和服务器约定的自定义事件名。`data` 在 Python 中是普通 `dict`,必须能被 JSON 序列化。
|
|
34
|
+
设备总览自定义字段读取最新一次 `cloud:status` 上报数据;上报时事件名固定为 `cloud:status`,`data` 是 key-value 字典。
|
|
34
35
|
|
|
35
36
|
## API 参考
|
|
36
37
|
|
|
@@ -138,6 +139,20 @@ ok = cloud.report("taskFinished", {
|
|
|
138
139
|
logger.info(f"上报结果: {ok}")
|
|
139
140
|
```
|
|
140
141
|
|
|
142
|
+
**上报云控状态**
|
|
143
|
+
|
|
144
|
+
设备总览自定义字段读取设备最新 `cloud:status` 上报数据。服务端按设备只保存最新一份状态;同一设备再次上报会覆盖前一次状态。
|
|
145
|
+
|
|
146
|
+
`data` 的 key 必须使用云控端已经配置好的设备总览自定义字段名。上报了云控端未配置的多余字段时,协议仍可发送,但云控端设备总览不会显示这些字段。
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
cloud.report("cloud:status", {
|
|
150
|
+
"taskName": "巡检任务",
|
|
151
|
+
"progress": 80,
|
|
152
|
+
"online": True,
|
|
153
|
+
})
|
|
154
|
+
```
|
|
155
|
+
|
|
141
156
|
### onEvent - 监听服务器事件
|
|
142
157
|
|
|
143
158
|
```python
|
package/docs/apipython/g.md
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
- 应用信息常量:版本号/构建号/名称/包名
|
|
8
8
|
- 前台切换:将宿主应用切到前台
|
|
9
9
|
- Agent 设置:读取和设置 Agent 快速模式
|
|
10
|
+
- 脚本生命周期:设置停止回调和异常停止回调
|
|
10
11
|
|
|
11
12
|
## 常量
|
|
12
13
|
|
|
@@ -226,6 +227,69 @@ from kuaijs import g
|
|
|
226
227
|
g.restartScript()
|
|
227
228
|
```
|
|
228
229
|
|
|
230
|
+
#### `setStopCallback` - 设置停止回调
|
|
231
|
+
|
|
232
|
+
设置脚本停止回调函数。回调只在主脚本结束时调用,不能在线程脚本中分别注册。
|
|
233
|
+
|
|
234
|
+
```python
|
|
235
|
+
def setStopCallback(callback: Callable[[Literal["success", "error", "stopped"]], None] | None) -> None
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**参数:**
|
|
239
|
+
|
|
240
|
+
| 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
|
|
241
|
+
| ---------- | --------------------------------------------------------- | -------- | ------ | ---- |
|
|
242
|
+
| `callback` | `Callable[[Literal["success", "error", "stopped"]], None]` 或 `None` | 是 | - | 停止回调函数,传 `None` 取消回调 |
|
|
243
|
+
|
|
244
|
+
**状态值:**
|
|
245
|
+
|
|
246
|
+
| 状态 | 描述 |
|
|
247
|
+
| ---- | ---- |
|
|
248
|
+
| `success` | 脚本正常执行完成 |
|
|
249
|
+
| `error` | 脚本发生未捕获异常 |
|
|
250
|
+
| `stopped` | 脚本被手动停止或主动退出 |
|
|
251
|
+
|
|
252
|
+
**示例:**
|
|
253
|
+
|
|
254
|
+
```python
|
|
255
|
+
from kuaijs import g
|
|
256
|
+
|
|
257
|
+
def on_stop(status: str) -> None:
|
|
258
|
+
if status == "success":
|
|
259
|
+
print("脚本执行完成")
|
|
260
|
+
elif status == "error":
|
|
261
|
+
print("脚本执行异常")
|
|
262
|
+
elif status == "stopped":
|
|
263
|
+
print("脚本手动停止")
|
|
264
|
+
|
|
265
|
+
g.setStopCallback(on_stop)
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
#### `setExceptionCallback` - 设置异常停止回调
|
|
269
|
+
|
|
270
|
+
设置脚本异常停止回调函数。该回调只在主脚本发生未捕获异常时调用,并且会早于 `setStopCallback` 注册的停止回调执行。
|
|
271
|
+
|
|
272
|
+
```python
|
|
273
|
+
def setExceptionCallback(callback: Callable[[], None] | None) -> None
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
**参数:**
|
|
277
|
+
|
|
278
|
+
| 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
|
|
279
|
+
| ---------- | ---------------------------- | -------- | ------ | ---- |
|
|
280
|
+
| `callback` | `Callable[[], None]` 或 `None` | 是 | - | 异常停止回调函数,传 `None` 取消回调 |
|
|
281
|
+
|
|
282
|
+
**示例:**
|
|
283
|
+
|
|
284
|
+
```python
|
|
285
|
+
from kuaijs import g
|
|
286
|
+
|
|
287
|
+
def on_exception() -> None:
|
|
288
|
+
print("脚本异常停止")
|
|
289
|
+
|
|
290
|
+
g.setExceptionCallback(on_exception)
|
|
291
|
+
```
|
|
292
|
+
|
|
229
293
|
#### `loadDex` - 加载指定的 dex、apk 文件
|
|
230
294
|
|
|
231
295
|
**注意:**
|
package/docs/httpapi/api.md
CHANGED
|
@@ -299,6 +299,92 @@ GET /api/activeAppInfo
|
|
|
299
299
|
| »» bundleId | string | true | none | 应用包名 | none |
|
|
300
300
|
| »» pid | integer | true | none | | none |
|
|
301
301
|
|
|
302
|
+
## GET 获取锁屏状态
|
|
303
|
+
|
|
304
|
+
GET /api/isLocked
|
|
305
|
+
|
|
306
|
+
> 返回示例
|
|
307
|
+
|
|
308
|
+
> 200 Response
|
|
309
|
+
|
|
310
|
+
```json
|
|
311
|
+
{
|
|
312
|
+
"success": true,
|
|
313
|
+
"data": false
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### 返回结果
|
|
318
|
+
|
|
319
|
+
| 状态码 | 状态码含义 | 说明 | 数据模型 |
|
|
320
|
+
| ------ | ------------------------------------------------------- | ---- | -------- |
|
|
321
|
+
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none | Inline |
|
|
322
|
+
|
|
323
|
+
### 返回数据结构
|
|
324
|
+
|
|
325
|
+
状态码 **200**
|
|
326
|
+
|
|
327
|
+
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|
|
328
|
+
| --------- | ------- | ---- | ---- | -------- | ---- |
|
|
329
|
+
| » success | boolean | true | none | 是否成功 | none |
|
|
330
|
+
| » data | boolean | true | none | 是否锁屏 | `true` 表示已锁屏,`false` 表示未锁屏 |
|
|
331
|
+
|
|
332
|
+
## GET 锁屏
|
|
333
|
+
|
|
334
|
+
GET /api/lock
|
|
335
|
+
|
|
336
|
+
> 返回示例
|
|
337
|
+
|
|
338
|
+
> 200 Response
|
|
339
|
+
|
|
340
|
+
```json
|
|
341
|
+
{
|
|
342
|
+
"success": true
|
|
343
|
+
}
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### 返回结果
|
|
347
|
+
|
|
348
|
+
| 状态码 | 状态码含义 | 说明 | 数据模型 |
|
|
349
|
+
| ------ | ------------------------------------------------------- | ---- | -------- |
|
|
350
|
+
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none | Inline |
|
|
351
|
+
|
|
352
|
+
### 返回数据结构
|
|
353
|
+
|
|
354
|
+
状态码 **200**
|
|
355
|
+
|
|
356
|
+
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|
|
357
|
+
| --------- | ------- | ---- | ---- | -------- | ---- |
|
|
358
|
+
| » success | boolean | true | none | 是否成功 | none |
|
|
359
|
+
|
|
360
|
+
## GET 解锁
|
|
361
|
+
|
|
362
|
+
GET /api/unlock
|
|
363
|
+
|
|
364
|
+
> 返回示例
|
|
365
|
+
|
|
366
|
+
> 200 Response
|
|
367
|
+
|
|
368
|
+
```json
|
|
369
|
+
{
|
|
370
|
+
"success": true
|
|
371
|
+
}
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### 返回结果
|
|
375
|
+
|
|
376
|
+
| 状态码 | 状态码含义 | 说明 | 数据模型 |
|
|
377
|
+
| ------ | ------------------------------------------------------- | ---- | -------- |
|
|
378
|
+
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none | Inline |
|
|
379
|
+
|
|
380
|
+
### 返回数据结构
|
|
381
|
+
|
|
382
|
+
状态码 **200**
|
|
383
|
+
|
|
384
|
+
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|
|
385
|
+
| --------- | ------- | ---- | ---- | -------- | ---- |
|
|
386
|
+
| » success | boolean | true | none | 是否成功 | none |
|
|
387
|
+
|
|
302
388
|
## GET 获取屏幕亮度
|
|
303
389
|
|
|
304
390
|
GET /api/getScreenBrightness
|
|
@@ -541,6 +627,7 @@ GET /api/status
|
|
|
541
627
|
"appName": "string",
|
|
542
628
|
"appBuildNumber": 0,
|
|
543
629
|
"appBundleId": "string",
|
|
630
|
+
"appNo": "string",
|
|
544
631
|
"deviceModel": "string",
|
|
545
632
|
"agentConnected": true,
|
|
546
633
|
"isRun": true,
|
|
@@ -550,6 +637,14 @@ GET /api/status
|
|
|
550
637
|
"udid": "string",
|
|
551
638
|
"serverDeviceId": "string",
|
|
552
639
|
"orientation": "PORTRAIT",
|
|
640
|
+
"memory": {
|
|
641
|
+
"used": 0,
|
|
642
|
+
"available": 0,
|
|
643
|
+
"total": 0,
|
|
644
|
+
"systemUsed": 0,
|
|
645
|
+
"usagePercentage": 0
|
|
646
|
+
},
|
|
647
|
+
"cpuUsage": 0,
|
|
553
648
|
"osVersion": "string",
|
|
554
649
|
"ecid": "string",
|
|
555
650
|
"isVolumeControlEnabled": true,
|
|
@@ -592,6 +687,7 @@ GET /api/status
|
|
|
592
687
|
| »» appName | string | true | none | app名称 | none |
|
|
593
688
|
| »» appBuildNumber | integer | true | none | app构建号 | none |
|
|
594
689
|
| »» appBundleId | string | true | none | app 包名 | none |
|
|
690
|
+
| »» appNo | string | true | none | 当前软件编号 | 未加载软件时为空字符串 |
|
|
595
691
|
| »» deviceModel | string | true | none | 设备型号 | none |
|
|
596
692
|
| »» agentConnected | boolean | true | none | agent是否连接 | none |
|
|
597
693
|
| »» isRun | boolean | true | none | 脚本是否启动 | none |
|
|
@@ -601,6 +697,13 @@ GET /api/status
|
|
|
601
697
|
| »» udid | string | true | none | 设备唯一 UDID | none |
|
|
602
698
|
| »» serverDeviceId | string | true | none | 服务器设备ID | none |
|
|
603
699
|
| »» orientation | string | true | none | 屏幕方向 | none |
|
|
700
|
+
| »» memory | object | true | none | 内存状态 | 单位为 MB,字段与系统模块内存信息一致 |
|
|
701
|
+
| »»» used | number | true | none | 应用已用内存 | 当前应用内存占用,单位 MB |
|
|
702
|
+
| »»» available | number | true | none | 系统可用内存 | 系统可用内存,单位 MB |
|
|
703
|
+
| »»» total | number | true | none | 系统总内存 | 物理内存总量,单位 MB |
|
|
704
|
+
| »»» systemUsed | number | true | none | 系统已用内存 | 系统已用内存,单位 MB |
|
|
705
|
+
| »»» usagePercentage | integer | true | none | 系统内存使用率 | 系统已用内存占总内存百分比 |
|
|
706
|
+
| »» cpuUsage | number | true | none | CPU 使用率 | 当前应用 CPU 使用率百分比 |
|
|
604
707
|
| »» osVersion | string | true | none | 系统版本 | none |
|
|
605
708
|
| »» ecid | string | true | none | 设备唯一 ECID | none |
|
|
606
709
|
| »» isVolumeControlEnabled | boolean | true | none | 是否开启了音量键启停 | none |
|
|
@@ -764,28 +867,55 @@ POST /api/setConfig
|
|
|
764
867
|
| --------- | ------- | ---- | ---- | -------- | ---- |
|
|
765
868
|
| » success | boolean | true | none | 是否成功 | none |
|
|
766
869
|
|
|
767
|
-
##
|
|
870
|
+
## WebSocket 实时屏幕画面流
|
|
768
871
|
|
|
769
|
-
|
|
872
|
+
WebSocket Upgrade /mirror/ws
|
|
770
873
|
|
|
771
874
|
### 请求参数
|
|
772
875
|
|
|
773
876
|
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|
|
774
877
|
| ------------- | ----- | ------- | ---- | ------ | ---------------------------- |
|
|
775
|
-
| fps | query | integer | 否 | | 帧率,默认 10,范围 1-
|
|
878
|
+
| fps | query | integer | 否 | | 帧率,默认 10,范围 1-60 |
|
|
776
879
|
| quality | query | number | 否 | | 质量,默认 0.25,范围 0.1-1.0 |
|
|
880
|
+
| scalingFactor | query | number | 否 | | 缩放比例,默认 1.0,范围 0.1-1.0 |
|
|
777
881
|
|
|
778
|
-
|
|
882
|
+
### 返回数据
|
|
779
883
|
|
|
780
|
-
|
|
884
|
+
连接成功后服务端持续发送 JPEG 二进制 WebSocket frame;客户端不需要发送业务消息。
|
|
781
885
|
|
|
782
|
-
|
|
886
|
+
## HTTP-FLV 实时屏幕画面流
|
|
783
887
|
|
|
784
|
-
|
|
785
|
-
| ------ | ------------------------------------------------------- | ---- | -------- |
|
|
786
|
-
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none | Inline |
|
|
888
|
+
GET /mirror/flv
|
|
787
889
|
|
|
788
|
-
###
|
|
890
|
+
### 请求参数
|
|
891
|
+
|
|
892
|
+
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|
|
893
|
+
| ------------- | ----- | ------- | ---- | ------ | ----------------------------------- |
|
|
894
|
+
| fps | query | integer | 否 | | 帧率,默认 10,范围 1-60 |
|
|
895
|
+
| quality | query | number | 否 | | JPEG 源质量,默认 0.25,范围 0.1-1.0 |
|
|
896
|
+
| scalingFactor | query | number | 否 | | 缩放比例,默认 1.0,范围 0.1-1.0 |
|
|
897
|
+
| bitrate | query | number | 否 | | H.264 目标码率,单位 Mbps,默认 4 |
|
|
898
|
+
|
|
899
|
+
### 返回数据
|
|
900
|
+
|
|
901
|
+
响应类型为 `video/x-flv`,服务端持续输出 FLV 容器内的 H.264 视频 tag。
|
|
902
|
+
|
|
903
|
+
## WHEP 实时屏幕画面流
|
|
904
|
+
|
|
905
|
+
POST /mirror/whep
|
|
906
|
+
|
|
907
|
+
### 请求参数
|
|
908
|
+
|
|
909
|
+
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|
|
910
|
+
| ------------- | ----- | ------- | ---- | ------ | ----------------------------------- |
|
|
911
|
+
| fps | query | integer | 否 | | 帧率,默认 10,范围 1-60 |
|
|
912
|
+
| quality | query | number | 否 | | JPEG 源质量,默认 0.25,范围 0.1-1.0 |
|
|
913
|
+
| scalingFactor | query | number | 否 | | 缩放比例,默认 1.0,范围 0.1-1.0 |
|
|
914
|
+
| bitrate | query | number | 否 | | WebRTC 发送码率,单位 Mbps,默认 4 |
|
|
915
|
+
|
|
916
|
+
### 返回数据
|
|
917
|
+
|
|
918
|
+
请求 body 为 `application/sdp` 的 WebRTC offer;响应类型为 `application/sdp`,内容为 WebRTC answer。
|
|
789
919
|
|
|
790
920
|
## POST 执行脚本(仅支持JS脚本)
|
|
791
921
|
|
|
@@ -2927,6 +3057,28 @@ GET /api/file/download
|
|
|
2927
3057
|
| 401 | [Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1) | 设备未授权 | Inline |
|
|
2928
3058
|
| 404 | [Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4) | 文件不存在 | Inline |
|
|
2929
3059
|
|
|
3060
|
+
## GET MJPEG 镜像流
|
|
3061
|
+
|
|
3062
|
+
GET /mirror/image
|
|
3063
|
+
|
|
3064
|
+
返回 `multipart/x-mixed-replace` MJPEG 长连接,每个 part 都是一帧 JPEG。浏览器可直接用 `<img src="/mirror/image">` 预览。
|
|
3065
|
+
|
|
3066
|
+
### 请求参数
|
|
3067
|
+
|
|
3068
|
+
| 名称 | 位置 | 类型 | 必选 | 说明 |
|
|
3069
|
+
| ------------- | ----- | ------- | ---- | ---- |
|
|
3070
|
+
| fps | query | integer | 否 | 目标帧率,范围 1-60,默认 10 |
|
|
3071
|
+
| quality | query | number | 否 | JPEG 质量,范围 0.1-1.0,默认 0.25 |
|
|
3072
|
+
| scalingFactor | query | number | 否 | 截图缩放因子,范围 0.1-1.0,默认 1.0 |
|
|
3073
|
+
|
|
3074
|
+
### 返回结果
|
|
3075
|
+
|
|
3076
|
+
| 状态码 | 状态码含义 | 说明 | 数据模型 |
|
|
3077
|
+
| ------ | ---------------------------------------------------------------- | ---- | -------- |
|
|
3078
|
+
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | `multipart/x-mixed-replace; boundary=kuaijs-mjpeg-boundary` 流 | file |
|
|
3079
|
+
| 429 | [Too Many Requests](https://tools.ietf.org/html/rfc6585#section-4) | 镜像流客户端数量已满 | Inline |
|
|
3080
|
+
| 503 | [Service Unavailable](https://tools.ietf.org/html/rfc7231#section-6.6.4) | HID 录屏链路未就绪 | Inline |
|
|
3081
|
+
|
|
2930
3082
|
# 数据模型
|
|
2931
3083
|
|
|
2932
3084
|
<h2 id="tocS_软件状态">软件状态</h2>
|
|
@@ -2954,6 +3106,7 @@ GET /api/file/download
|
|
|
2954
3106
|
"appName": "string",
|
|
2955
3107
|
"appBuildNumber": 0,
|
|
2956
3108
|
"appBundleId": "string",
|
|
3109
|
+
"appNo": "string",
|
|
2957
3110
|
"deviceModel": "string",
|
|
2958
3111
|
"agentConnected": true,
|
|
2959
3112
|
"isRun": true,
|
|
@@ -2963,6 +3116,14 @@ GET /api/file/download
|
|
|
2963
3116
|
"udid": "string",
|
|
2964
3117
|
"serverDeviceId": "string",
|
|
2965
3118
|
"orientation": "PORTRAIT",
|
|
3119
|
+
"memory": {
|
|
3120
|
+
"used": 0,
|
|
3121
|
+
"available": 0,
|
|
3122
|
+
"total": 0,
|
|
3123
|
+
"systemUsed": 0,
|
|
3124
|
+
"usagePercentage": 0
|
|
3125
|
+
},
|
|
3126
|
+
"cpuUsage": 0,
|
|
2966
3127
|
"osVersion": "string",
|
|
2967
3128
|
"ecid": "string",
|
|
2968
3129
|
"isVolumeControlEnabled": true,
|
|
@@ -2994,6 +3155,7 @@ GET /api/file/download
|
|
|
2994
3155
|
| appName | string | true | none | app名称 | none |
|
|
2995
3156
|
| appBuildNumber | integer | true | none | app构建号 | none |
|
|
2996
3157
|
| appBundleId | string | true | none | app 包名 | none |
|
|
3158
|
+
| appNo | string | true | none | 当前软件编号 | 未加载软件时为空字符串 |
|
|
2997
3159
|
| deviceModel | string | true | none | 设备型号 | none |
|
|
2998
3160
|
| agentConnected | boolean | true | none | agent是否连接 | none |
|
|
2999
3161
|
| isRun | boolean | true | none | 脚本是否启动 | none |
|
|
@@ -3003,6 +3165,13 @@ GET /api/file/download
|
|
|
3003
3165
|
| udid | string | true | none | 设备唯一 UDID | none |
|
|
3004
3166
|
| serverDeviceId | string | true | none | 服务器设备ID | none |
|
|
3005
3167
|
| orientation | string | true | none | 屏幕方向 | none |
|
|
3168
|
+
| memory | object | true | none | 内存状态 | 单位为 MB,字段与系统模块内存信息一致 |
|
|
3169
|
+
| » used | number | true | none | 应用已用内存 | 当前应用内存占用,单位 MB |
|
|
3170
|
+
| » available | number | true | none | 系统可用内存 | 系统可用内存,单位 MB |
|
|
3171
|
+
| » total | number | true | none | 系统总内存 | 物理内存总量,单位 MB |
|
|
3172
|
+
| » systemUsed | number | true | none | 系统已用内存 | 系统已用内存,单位 MB |
|
|
3173
|
+
| » usagePercentage | integer | true | none | 系统内存使用率 | 系统已用内存占总内存百分比 |
|
|
3174
|
+
| cpuUsage | number | true | none | CPU 使用率 | 当前应用 CPU 使用率百分比 |
|
|
3006
3175
|
| osVersion | string | true | none | 系统版本 | none |
|
|
3007
3176
|
| ecid | string | true | none | 设备唯一 ECID | none |
|
|
3008
3177
|
| isVolumeControlEnabled | boolean | true | none | 是否开启了音量键启停 | none |
|