ms-vite-plugin 1.4.17 → 1.4.19

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/docs/AGENTS.md CHANGED
@@ -164,7 +164,7 @@ OCR 识别使用 `ocr_recognize`,不要手写未确认的 OCR 调用链路。
164
164
  - `ocr_recognize` 支持 `appleocr` 和 `paddleocr`。
165
165
  - 默认使用 `appleocr`。
166
166
  - 数字识别优先使用 `appleocr`。
167
- - PaddleOCR 识别和查找方法会自动加载所需模型,不需要先手动调用 `loadV5`。
167
+ - PaddleOCR 同一时间只保留一个 active 模型;识别和查找方法默认自动加载 PP-OCRv6 small,如需 PP-OCRv6 tiny 调用 `loadModel("ppocr-v6-tiny")`,如需 PP-OCRv5 调用 `loadModel("ppocr-v5")`,加载成功后会替换当前模型。
168
168
 
169
169
  ## 验证要求
170
170
 
@@ -59,12 +59,13 @@ interface OCRResult {
59
59
 
60
60
  ### 文字识别
61
61
 
62
- #### recognize
62
+ #### recognizeAbs - 执行 OCR 识别,并将结果坐标映射为原图/全屏绝对坐标。
63
63
 
64
- 执行通用 OCR 文字识别,支持多种输入源和指定识别区域。
64
+ 执行 OCR 识别,并将结果坐标映射为原图/全屏绝对坐标。
65
+ 传入裁剪区域时,返回坐标会映射回原图或全屏坐标,可直接用于点击。
65
66
 
66
67
  ```typescript
67
- function recognize(
68
+ function recognizeAbs(
68
69
  input: string,
69
70
  x?: number,
70
71
  y?: number,
@@ -76,77 +77,20 @@ function recognize(
76
77
 
77
78
  **参数:**
78
79
 
79
- | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
80
- | ----------- | -------- | -------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
81
- | `input` | string | 是 | - | 输入源,支持以下类型:<br>- `"screen"` - 当前屏幕截图<br>- `string` - 图片文件路径或 URL<br>- `imageId` - 图片 ID(通过 image 模块获取) |
82
- | `x` | number | 否 | - | 识别区域左上角 x 坐标 |
83
- | `y` | number | 否 | - | 识别区域左上角 y 坐标 |
84
- | `ex` | number | 否 | - | 识别区域右下角 x 坐标 |
85
- | `ey` | number | 否 | - | 识别区域右下角 y 坐标 |
86
- | `languages` | string[] | 否 | ["zh-Hans", "en-US"] | 可选,指定识别语言列表,如 ["zh-Hans", "en-US"] |
80
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
81
+ | ----------- | -------- | -------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
82
+ | `input` | string | 是 | | 输入源,支持 `"screen"`、图片文件路径、URL 字符串或 imageId |
83
+ | `x` | number | 否 | 0 | 裁剪区域左上角 x 坐标;全屏识别传 0 |
84
+ | `y` | number | 否 | 0 | 裁剪区域左上角 y 坐标;全屏识别传 0 |
85
+ | `ex` | number | 否 | 0 | 裁剪区域右下角 x 坐标;全屏识别传 0 |
86
+ | `ey` | number | 否 | 0 | 裁剪区域右下角 y 坐标;全屏识别传 0 |
87
+ | `languages` | string[] | 否 | `["zh-Hans", "en-US"]` | 识别语言数组,支持 `["en-US", "fr-FR", "it-IT", "de-DE", "es-ES", "pt-BR", "zh-Hans", "zh-Hant"]` |
87
88
 
88
89
  **返回值:**
89
90
 
90
- | 类型 | 描述 |
91
- | ----------- | ---------------------- |
92
- | OCRResult[] | 匹配的文本识别结果数组 |
93
-
94
- **使用示例:**
95
-
96
- ```javascript
97
- // 识别整个屏幕
98
- const fullScreenResults = appleOcr.recognize("screen", 0, 0, 0, 0);
99
- logi(`识别到 ${fullScreenResults.length} 个文本区域`);
100
- fullScreenResults.forEach((result, index) => {
101
- logi(`文本 ${index + 1}: ${result.text} (置信度: ${result.confidence})`);
102
- logi(`位置: (${result.x}, ${result.y}) - (${result.ex}, ${result.ey})`);
103
- logi(`中心点: (${result.centerX}, ${result.centerY})`);
104
- });
105
-
106
- // 识别屏幕指定区域
107
- const regionResults = appleOcr.recognize("screen", 100, 100, 500, 300);
108
- logi(`指定区域识别结果: ${JSON.stringify(regionResults)}`);
109
-
110
- // 识别图片文件
111
- const imageResults = appleOcr.recognize("/path/to/image.png", 0, 0, 800, 600);
112
- if (imageResults.length > 0) {
113
- logi("图片文字识别成功");
114
- imageResults.forEach((result) => {
115
- logi(`识别文字: ${result.text}`);
116
- logi(`区域: ${result.width}x${result.height}`);
117
- });
118
- } else {
119
- logi("图片中未识别到文字");
120
- }
121
-
122
- // 指定识别语言
123
- const chineseResults = appleOcr.recognize("screen", 0, 0, 1920, 1080, [
124
- "zh-Hans",
125
- "en-US",
126
- ]);
127
- logi(`中英文识别结果: ${JSON.stringify(chineseResults)}`);
128
-
129
- // 识别当前屏幕
130
- const screenResults = appleOcr.recognize("screen", 0, 0, 1920, 1080);
131
- logi(`屏幕识别结果: ${JSON.stringify(screenResults)}`);
132
- ```
133
-
134
- #### recognizeAbs
135
-
136
- 执行 OCR 识别,并将结果坐标映射为原图/全屏绝对坐标。
137
-
138
- 参数与 `recognize` 相同。传入裁剪区域时,返回坐标可直接用于全屏点击。
139
-
140
- ```typescript
141
- function recognizeAbs(
142
- input: string,
143
- x?: number,
144
- y?: number,
145
- ex?: number,
146
- ey?: number,
147
- languages?: string[],
148
- ): OCRResult[];
149
- ```
91
+ | 类型 | 描述 |
92
+ | ----------- | ------------------------------------------------ |
93
+ | OCRResult[] | 识别结果数组,坐标为原图或全屏绝对坐标 |
150
94
 
151
95
  **示例:**
152
96
 
@@ -159,14 +103,15 @@ if (absResults.length > 0) {
159
103
 
160
104
  ### 数字识别
161
105
 
162
- #### recognizeNumbers
106
+ #### recognizeNumbersAbs - 执行数字 OCR 识别,并将结果坐标映射为原图/全屏绝对坐标。
163
107
 
164
- 执行专门的数字 OCR 识别,针对数字识别进行了优化,提高数字识别的准确性。
108
+ 执行数字 OCR 识别,并将结果坐标映射为原图/全屏绝对坐标。
109
+ 传入裁剪区域时,返回坐标会映射回原图或全屏坐标,可直接用于点击。
165
110
 
166
111
  **支持字符**: 0-9 数字、逗号(,)、小数点(.)、加号(+)、减号(-)
167
112
 
168
113
  ```typescript
169
- function recognizeNumbers(
114
+ function recognizeNumbersAbs(
170
115
  input: string,
171
116
  x?: number,
172
117
  y?: number,
@@ -177,49 +122,19 @@ function recognizeNumbers(
177
122
 
178
123
  **参数:**
179
124
 
180
- | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
181
- | ------- | ------ | -------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------ |
182
- | `input` | string | 是 | - | 输入源,支持以下类型: <br>-`"screen"` 当前屏幕截图 <br>- `string` 图片文件路径或 URL <br>- `imageId` 图片 ID(通过 image 模块获取) |
183
- | `x` | number | 否 | - | 识别区域左上角 x 坐标 |
184
- | `y` | number | 否 | - | 识别区域左上角 y 坐标 |
185
- | `ex` | number | 否 | - | 识别区域右下角 x 坐标 |
186
- | `ey` | number | 否 | - | 识别区域右下角 y 坐标 |
125
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
126
+ | ------- | ------ | -------- | ------ | ------------------------------------------- |
127
+ | `input` | string | 是 | | 输入源,支持 `"screen"`、图片文件路径、URL 字符串或 imageId |
128
+ | `x` | number | 否 | 0 | 裁剪区域左上角 x 坐标;全屏识别传 0 |
129
+ | `y` | number | 否 | 0 | 裁剪区域左上角 y 坐标;全屏识别传 0 |
130
+ | `ex` | number | 否 | 0 | 裁剪区域右下角 x 坐标;全屏识别传 0 |
131
+ | `ey` | number | 否 | 0 | 裁剪区域右下角 y 坐标;全屏识别传 0 |
187
132
 
188
133
  **返回值:**
189
134
 
190
- | 类型 | 描述 |
191
- | ------------- | ---------------------- |
192
- | `OCRResult[]` | 匹配的数字识别结果数组 |
193
-
194
- **使用示例:**
195
-
196
- ```javascript
197
- // 识别屏幕中的数字
198
- const numberResults = appleOcr.recognizeNumbers("screen", 100, 100, 500, 300);
199
- logi(`识别到 ${numberResults.length} 个数字区域`);
200
-
201
- numberResults.forEach((result, index) => {
202
- logi(`数字 ${index + 1}: ${result.text}`);
203
- logi(`置信度: ${result.confidence}`);
204
- logi(`位置: (${result.centerX}, ${result.centerY})`);
205
- });
206
- ```
207
-
208
- #### recognizeNumbersAbs
209
-
210
- 执行数字 OCR 识别,并将结果坐标映射为原图/全屏绝对坐标。
211
-
212
- 参数与 `recognizeNumbers` 相同。传入裁剪区域时,返回坐标可直接用于全屏点击。
213
-
214
- ```typescript
215
- function recognizeNumbersAbs(
216
- input: string,
217
- x?: number,
218
- y?: number,
219
- ex?: number,
220
- ey?: number,
221
- ): OCRResult[];
222
- ```
135
+ | 类型 | 描述 |
136
+ | ----------- | ---------------------------------------------------------- |
137
+ | OCRResult[] | 数字识别结果数组,坐标为原图或全屏绝对坐标 |
223
138
 
224
139
  **示例:**
225
140
 
@@ -232,12 +147,13 @@ if (absNumberResults.length > 0) {
232
147
 
233
148
  ### 文本查找
234
149
 
235
- #### findText
150
+ #### findTextAbs - 查找目标子串,并将子串结果坐标映射为原图/全屏绝对坐标。
236
151
 
237
- 执行指定文本查找,在识别结果中查找目标子串,并返回目标子串的坐标。
152
+ 查找目标子串,并将子串结果坐标映射为原图/全屏绝对坐标。
153
+ 传入裁剪区域时,返回坐标会映射回原图或全屏坐标,可直接用于点击。
238
154
 
239
155
  ```typescript
240
- function findText(
156
+ function findTextAbs(
241
157
  input: string,
242
158
  texts: string[],
243
159
  x?: number,
@@ -251,56 +167,22 @@ function findText(
251
167
 
252
168
  **参数:**
253
169
 
254
- | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
255
- | ----------- | -------- | -------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
256
- | `input` | string | 是 | - | 输入源,支持以下类型: <br>-`"screen"` 当前屏幕截图 <br>- `string` 图片文件路径或 URL <br>- `imageId` 图片 ID(通过 image 模块获取) |
257
- | `texts` | string[] | 是 | - | 要查找的目标文本数组,支持匹配识别结果中的子串 |
258
- | `x` | number | 否 | - | 识别区域左上角 x 坐标 |
259
- | `y` | number | 否 | - | 识别区域左上角 y 坐标 |
260
- | `ex` | number | 否 | - | 识别区域右下角 x 坐标 |
261
- | `ey` | number | 否 | - | 识别区域右下角 y 坐标 |
262
- | `languages` | string[] | 否 | ["zh-Hans", "en-US"] | 可选,指定识别语言列表,如 ["zh-Hans", "en-US"] |
263
- | `exactMatch` | boolean | 否 | false | 是否完整匹配;`false` 表示包含匹配,`true` 表示整条 OCR 识别结果文本必须等于目标文本 |
170
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
171
+ | ------------ | -------- | -------- | ----------------------- | ----------------------------------------------------------------------------------------------------- |
172
+ | `input` | string | 是 | | 输入源,支持 `"screen"`、图片文件路径、URL 字符串或 imageId |
173
+ | `texts` | string[] | 是 | | 要查找的目标文本数组,可匹配识别结果中的子串 |
174
+ | `x` | number | 否 | 0 | 裁剪区域左上角 x 坐标;全屏识别传 0 |
175
+ | `y` | number | 否 | 0 | 裁剪区域左上角 y 坐标;全屏识别传 0 |
176
+ | `ex` | number | 否 | 0 | 裁剪区域右下角 x 坐标;全屏识别传 0 |
177
+ | `ey` | number | 否 | 0 | 裁剪区域右下角 y 坐标;全屏识别传 0 |
178
+ | `languages` | string[] | 否 | `["zh-Hans", "en-US"]` | 识别语言数组 |
179
+ | `exactMatch` | boolean | 否 | false | 是否完整匹配;`false` 表示包含匹配,`true` 要求整条 OCR 识别结果文本等于目标文本 |
264
180
 
265
181
  **返回值:**
266
182
 
267
- | 类型 | 描述 |
268
- | ------------- | ---------------------- |
269
- | `OCRResult[]` | 命中子串的文本识别结果数组 |
270
-
271
- **使用示例:**
272
-
273
- ```javascript
274
- // 在“开始执行”中查找“开始”,返回“开始”子串区域
275
- const textResults = appleOcr.findText("screen", ["开始"], 0, 0, 100, 100);
276
- // 不指定 languages 但启用完整匹配时,用 null 占位 languages
277
- const exactResults = appleOcr.findText("screen", ["开始"], 0, 0, 100, 100, null, true);
278
- logi(`识别到 ${textResults.length} 个文本区域`);
279
- textResults.forEach((result, index) => {
280
- logi(`文本 ${index + 1}: ${result.text} (置信度: ${result.confidence})`);
281
- logi(`位置: (${result.x}, ${result.y}) - (${result.ex}, ${result.ey})`);
282
- logi(`中心点: (${result.centerX}, ${result.centerY})`);
283
- });
284
- ```
285
-
286
- #### findTextAbs
287
-
288
- 查找目标子串,并将子串结果坐标映射为原图/全屏绝对坐标。
289
-
290
- 参数与 `findText` 相同。传入裁剪区域时,返回坐标可直接用于全屏点击。
291
-
292
- ```typescript
293
- function findTextAbs(
294
- input: string,
295
- texts: string[],
296
- x?: number,
297
- y?: number,
298
- ex?: number,
299
- ey?: number,
300
- languages?: string[],
301
- exactMatch?: boolean,
302
- ): OCRResult[];
303
- ```
183
+ | 类型 | 描述 |
184
+ | ----------- | ---------------------------------------------------------- |
185
+ | OCRResult[] | 命中子串的识别结果数组,坐标为原图或全屏绝对坐标 |
304
186
 
305
187
  **示例:**
306
188
 
package/docs/api/image.md CHANGED
@@ -45,7 +45,7 @@ function captureScreen(
45
45
  **示例:**
46
46
 
47
47
  ```javascript
48
- // 截取全屏
48
+ // 全屏截图
49
49
  const imageId = image.captureScreen();
50
50
  // 获取手机文档目录
51
51
  const dir = file.getInternalDir("documents");
@@ -70,74 +70,6 @@ if (imageId) {
70
70
  }
71
71
  ```
72
72
 
73
- ### captureFullScreen - 截取设备全屏。
74
-
75
- ```typescript
76
- function captureFullScreen(): string | null;
77
- ```
78
-
79
- **返回值:**
80
-
81
- | 类型 | 描述 |
82
- | -------- | -------------------------------- |
83
- | `string` | 截图的图片 ID,失败时返回 `null` |
84
-
85
- **示例:**
86
-
87
- ```javascript
88
- const imageId = image.captureFullScreen();
89
- // 获取手机文档目录
90
- const dir = file.getInternalDir("documents");
91
- if (imageId) {
92
- logi("截图成功");
93
- image.saveTo(imageId, `${dir}/screenshot.jpg`);
94
- image.release(imageId); // 记得释放内存
95
- } else {
96
- logi("截图失败");
97
- }
98
- ```
99
-
100
- ### captureRect - 截取设备指定区域。
101
-
102
- ```typescript
103
- function captureRect(
104
- x: number,
105
- y: number,
106
- ex: number,
107
- ey: number,
108
- ): string | null;
109
- ```
110
-
111
- **参数:**
112
-
113
- | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
114
- | ------ | ------ | -------- | ------ | ----------------- |
115
- | `x` | number | 是 | - | 区域左上角 X 坐标 |
116
- | `y` | number | 是 | - | 区域左上角 Y 坐标 |
117
- | `ex` | number | 是 | - | 区域右下角 X 坐标 |
118
- | `ey` | number | 是 | - | 区域右下角 Y 坐标 |
119
-
120
- **返回值:**
121
-
122
- | 类型 | 描述 |
123
- | -------- | -------------------------------- |
124
- | `string` | 截图的图片 ID,失败时返回 `null` |
125
-
126
- **示例:**
127
-
128
- ```javascript
129
- const imageId = image.captureRect(100, 100, 200, 200);
130
- // 获取手机文档目录
131
- const dir = file.getInternalDir("documents");
132
- if (imageId) {
133
- logi("截图成功");
134
- image.saveTo(imageId, `${dir}/screenshot.jpg`);
135
- image.release(imageId); // 记得释放内存
136
- } else {
137
- logi("截图失败");
138
- }
139
- ```
140
-
141
73
  ### readImage - 从文件路径或imageId读取图片。
142
74
 
143
75
  ```typescript
@@ -191,7 +123,7 @@ function saveTo(imageId: string, filePath: string): boolean;
191
123
  **示例:**
192
124
 
193
125
  ```javascript
194
- const imageId = image.captureFullScreen();
126
+ const imageId = image.captureScreen();
195
127
  // 获取手机文档目录
196
128
  const dir = file.getInternalDir("documents");
197
129
  if (imageId) {
@@ -241,7 +173,7 @@ function isRelease(imageId: string): boolean;
241
173
  **示例:**
242
174
 
243
175
  ```javascript
244
- const imageId = image.captureFullScreen();
176
+ const imageId = image.captureScreen();
245
177
  if (imageId) {
246
178
  logi(`释放前: ${image.isRelease(imageId)}`); // false
247
179
  image.release(imageId);
@@ -272,7 +204,7 @@ function getSize(imageId: string): { width: number; height: number } | null;
272
204
  **示例:**
273
205
 
274
206
  ```javascript
275
- const imageId = image.captureFullScreen();
207
+ const imageId = image.captureScreen();
276
208
  if (imageId) {
277
209
  const size = image.getSize(imageId);
278
210
  if (size) {
@@ -305,7 +237,7 @@ function pixel(imageId: string, x: number, y: number): number;
305
237
  **示例:**
306
238
 
307
239
  ```javascript
308
- const imageId = image.captureFullScreen();
240
+ const imageId = image.captureScreen();
309
241
  if (imageId) {
310
242
  const color = image.pixel(imageId, 100, 100);
311
243
  const colorHex = image.argb(color);
@@ -371,7 +303,7 @@ function findColor(
371
303
  **示例:**
372
304
 
373
305
  ```javascript
374
- const imageId = image.captureFullScreen();
306
+ const imageId = image.captureScreen();
375
307
  if (imageId) {
376
308
  // 查找蓝色按钮
377
309
  const points = image.findColor(
@@ -435,7 +367,7 @@ function findMultiColor(
435
367
  **示例:**
436
368
 
437
369
  ```javascript
438
- const imageId = image.captureFullScreen();
370
+ const imageId = image.captureScreen();
439
371
  if (imageId) {
440
372
  // 查找特定的颜色组合(如按钮的特征颜色)
441
373
  const points = image.findMultiColor(
@@ -495,7 +427,7 @@ function countColor(
495
427
  **示例:**
496
428
 
497
429
  ```javascript
498
- const imageId = image.captureFullScreen();
430
+ const imageId = image.captureScreen();
499
431
  if (imageId) {
500
432
  const count = image.countColor(
501
433
  imageId,
@@ -535,7 +467,7 @@ function cmpColor(imageId: string, points: string, threshold: number): boolean;
535
467
  **示例:**
536
468
 
537
469
  ```javascript
538
- const imageId = image.captureFullScreen();
470
+ const imageId = image.captureScreen();
539
471
  if (imageId) {
540
472
  // 检查特定区域是否为预期颜色
541
473
  const isMatch = image.cmpColor(
@@ -664,7 +596,7 @@ function clip(
664
596
  **示例:**
665
597
 
666
598
  ```javascript
667
- const imageId = image.captureFullScreen();
599
+ const imageId = image.captureScreen();
668
600
  // 获取手机文档目录
669
601
  const dir = file.getInternalDir("documents");
670
602
  if (imageId) {
@@ -737,7 +669,7 @@ function gray(imageId: string): string;
737
669
  **示例:**
738
670
 
739
671
  ```javascript
740
- const imageId = image.captureFullScreen();
672
+ const imageId = image.captureScreen();
741
673
  // 获取手机文档目录
742
674
  const dir = file.getInternalDir("documents");
743
675
  if (imageId) {
@@ -770,7 +702,7 @@ function binaryzation(imageId: string, threshold: number): string;
770
702
  **示例:**
771
703
 
772
704
  ```javascript
773
- const imageId = image.captureFullScreen();
705
+ const imageId = image.captureScreen();
774
706
  // 获取手机文档目录
775
707
  const dir = file.getInternalDir("documents");
776
708
  if (imageId) {
@@ -811,7 +743,7 @@ function drawRect(
811
743
  // 获取手机文档目录
812
744
  const dir = file.getInternalDir("documents");
813
745
 
814
- const imageId = image.captureFullScreen();
746
+ const imageId = image.captureScreen();
815
747
  if (imageId) {
816
748
  image.drawRect(imageId, 100, 100, 200, 100, "#FF0000", 2);
817
749
  image.saveTo(imageId, `${dir}/test.jpg`);
@@ -840,7 +772,7 @@ function scanCode(imageId: string): string | null;
840
772
  **示例:**
841
773
 
842
774
  ```javascript
843
- const imageId = image.captureFullScreen();
775
+ const imageId = image.captureScreen();
844
776
  if (imageId) {
845
777
  const result = image.scanCode(imageId);
846
778
  if (result) {
@@ -910,7 +842,7 @@ function toBase64Format(imageId: string, format: string, q: number): string;
910
842
  **示例:**
911
843
 
912
844
  ```javascript
913
- const imageId = image.captureFullScreen();
845
+ const imageId = image.captureScreen();
914
846
  if (imageId) {
915
847
  const base64 = image.toBase64Format(imageId, "jpg", 90);
916
848
  logi(`Base64 数据: ${base64.substring(0, 100)}...`);
@@ -943,7 +875,7 @@ function getBitmap(imageId: string): any;
943
875
  **示例:**
944
876
 
945
877
  ```javascript
946
- const imageId = image.captureFullScreen();
878
+ const imageId = image.captureScreen();
947
879
  if (imageId) {
948
880
  const bitmap = image.getBitmap(imageId);
949
881
  logi(`Bitmap 对象: ${bitmap}`);
package/docs/api/media.md CHANGED
@@ -215,18 +215,17 @@ if (stopped) {
215
215
  }
216
216
  ```
217
217
 
218
- #### playMp3WaitEnd - 同步播放 MP3 音频文件(等待播放结束)。
218
+ #### playMp3WaitEnd - 同步播放 MP3 音频文件(播放一次并等待结束)。
219
219
 
220
220
  ```typescript
221
- function playMp3WaitEnd(path: string, loop: boolean): boolean;
221
+ function playMp3WaitEnd(path: string): boolean;
222
222
  ```
223
223
 
224
224
  **参数:**
225
225
 
226
- | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
227
- | ------ | ------- | -------- | ------ | -------------------------------------------------------------------- |
228
- | `path` | string | 是 | | MP3 文件路径 |
229
- | `loop` | boolean | 是 | | 是否循环播放 注意:循环播放会阻塞线程,慎用,不要在主线程设置为 true |
226
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
227
+ | ------ | ------ | -------- | ------ | ------------ |
228
+ | `path` | string | 是 | | MP3 文件路径 |
230
229
 
231
230
  **返回值:**
232
231
 
@@ -239,7 +238,7 @@ function playMp3WaitEnd(path: string, loop: boolean): boolean;
239
238
  ```javascript
240
239
  // 同步播放音频,等待播放完成
241
240
  logi("开始播放音频...");
242
- const played = media.playMp3WaitEnd("/path/to/notification.mp3", false);
241
+ const played = media.playMp3WaitEnd("/path/to/notification.mp3");
243
242
  if (played) {
244
243
  logi("音频播放完成");
245
244
  } else {