@tarojs/taro 3.7.0-alpha.1 → 3.7.0-alpha.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.
Files changed (42) hide show
  1. package/package.json +9 -3
  2. package/types/api/ad/index.d.ts +6 -18
  3. package/types/api/ai/inference.d.ts +129 -0
  4. package/types/api/alipay/index.d.ts +43 -0
  5. package/types/api/base/crypto.d.ts +18 -4
  6. package/types/api/base/index.d.ts +2 -2
  7. package/types/api/base/performance.d.ts +63 -0
  8. package/types/api/base/system.d.ts +65 -0
  9. package/types/api/base/weapp/app-event.d.ts +18 -18
  10. package/types/api/device/calendar.d.ts +2 -2
  11. package/types/api/device/screen.d.ts +61 -0
  12. package/types/api/device/sms.d.ts +26 -0
  13. package/types/api/media/audio.d.ts +50 -30
  14. package/types/api/media/image.d.ts +40 -17
  15. package/types/api/media/live.d.ts +52 -0
  16. package/types/api/media/video.d.ts +64 -23
  17. package/types/api/media/voip.d.ts +103 -0
  18. package/types/api/network/download.d.ts +2 -10
  19. package/types/api/network/request.d.ts +84 -24
  20. package/types/api/network/upload.d.ts +2 -10
  21. package/types/api/open-api/address.d.ts +12 -10
  22. package/types/api/open-api/channels.d.ts +31 -0
  23. package/types/api/open-api/device-voip.d.ts +63 -0
  24. package/types/api/route/index.d.ts +2 -0
  25. package/types/api/share/index.d.ts +1 -1
  26. package/types/api/storage/cache-manager.d.ts +198 -0
  27. package/types/api/taro.extend.d.ts +223 -0
  28. package/types/{taro.hooks.d.ts → api/taro.hooks.d.ts} +4 -4
  29. package/types/api/ui/navigation-bar.d.ts +1 -1
  30. package/types/compile/compiler.d.ts +1 -1
  31. package/types/compile/config/h5.d.ts +63 -2
  32. package/types/compile/config/mini.d.ts +67 -5
  33. package/types/compile/config/project.d.ts +239 -17
  34. package/types/compile/config/rn.d.ts +64 -0
  35. package/types/compile/config/util.d.ts +62 -4
  36. package/types/compile/hooks.d.ts +1 -1
  37. package/types/global.d.ts +8 -8
  38. package/types/index.d.ts +7 -7
  39. package/types/taro.api.d.ts +8 -1
  40. package/types/taro.component.d.ts +2 -1
  41. package/types/taro.config.d.ts +91 -2
  42. package/types/taro.extend.d.ts +0 -112
@@ -53,6 +53,41 @@ declare module '../../index' {
53
53
  ) => void
54
54
  }
55
55
 
56
+ namespace onScreenRecordingStateChanged {
57
+ interface ScreenRecordingState {
58
+ /** 开始录屏 */
59
+ start
60
+ /** 结束录屏 */
61
+ stop
62
+ }
63
+ /** 用户录屏事件的监听函数 */
64
+ type Callback = (
65
+ /** 录屏状态 */
66
+ state: keyof ScreenRecordingState,
67
+ ) => void
68
+ }
69
+
70
+ namespace getScreenRecordingState {
71
+ interface Option {
72
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
73
+ complete?: (res: TaroGeneral.CallbackResult) => void
74
+ /** 接口调用失败的回调函数 */
75
+ fail?: (res: TaroGeneral.CallbackResult) => void
76
+ /** 接口调用成功的回调函数 */
77
+ success?: (option: SuccessCallbackResult) => void
78
+ }
79
+ interface ScreenRecordingState {
80
+ /** 开始录屏 */
81
+ start
82
+ /** 结束录屏 */
83
+ stop
84
+ }
85
+ interface SuccessCallbackResult {
86
+ /** 录屏状态 */
87
+ state: keyof ScreenRecordingState
88
+ }
89
+ }
90
+
56
91
  namespace getScreenBrightness {
57
92
  interface Option {
58
93
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
@@ -116,6 +151,15 @@ declare module '../../index' {
116
151
  callback: onUserCaptureScreen.Callback,
117
152
  ): void
118
153
 
154
+ /** 监听用户录屏事件
155
+ * @supported weapp
156
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.onScreenRecordingStateChanged.html
157
+ */
158
+ onScreenRecordingStateChanged(
159
+ /** 用户录屏事件的监听函数 */
160
+ callback: onScreenRecordingStateChanged.Callback
161
+ ): void
162
+
119
163
  /** 用户主动截屏事件。取消事件监听。
120
164
  * @supported weapp, tt
121
165
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.offUserCaptureScreen.html
@@ -125,6 +169,23 @@ declare module '../../index' {
125
169
  callback: onUserCaptureScreen.Callback,
126
170
  ): void
127
171
 
172
+ /** 取消用户录屏事件的监听函数
173
+ * @supported weapp
174
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.offScreenRecordingStateChanged.html
175
+ */
176
+ offScreenRecordingStateChanged(
177
+ /** 用户录屏事件的监听函数 */
178
+ callback: onScreenRecordingStateChanged.Callback
179
+ ): void
180
+
181
+ /** 查询用户是否在录屏
182
+ * @supported weapp
183
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.getScreenRecordingState.html
184
+ */
185
+ getScreenRecordingState(
186
+ option?: getScreenRecordingState.Option
187
+ ): Promise<getScreenRecordingState.SuccessCallbackResult>
188
+
128
189
  /**
129
190
  * 获取屏幕亮度。
130
191
  *
@@ -0,0 +1,26 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace sendSms {
5
+ interface Option {
6
+ /** 预填到发送短信面板的手机号 */
7
+ phoneNumber?: string
8
+ /** 预填到发送短信面板的内容 */
9
+ content?: string
10
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
11
+ complete?: (res: TaroGeneral.CallbackResult) => void
12
+ /** 接口调用失败的回调函数 */
13
+ fail?: (res: TaroGeneral.CallbackResult) => void
14
+ /** 接口调用成功的回调函数 */
15
+ success?: (res: TaroGeneral.CallbackResult) => void
16
+ }
17
+ }
18
+
19
+ interface TaroStatic {
20
+ /** 拉起手机发送短信界面
21
+ * @supported weap
22
+ * @see declare module '../../index'
23
+ */
24
+ sendSms(option: sendSms.Option): Promise<TaroGeneral.CallbackResul>
25
+ }
26
+ }
@@ -292,83 +292,83 @@ declare module '../../index' {
292
292
  /** 音频进入可以播放状态,但不保证后面可以流畅播放
293
293
  * @supported weapp, h5, rn
294
294
  */
295
- onCanplay(callback?: () => void): void
295
+ onCanplay(callback?: InnerAudioContext.OnCanplayCallback): void
296
296
  /** 音频播放事件
297
297
  * @supported weapp, h5, rn
298
298
  */
299
- onPlay(callback?: () => void): void
299
+ onPlay(callback?: InnerAudioContext.OnPlayCallback): void
300
300
  /** 音频暂停事件
301
301
  * @supported weapp, h5, rn
302
302
  */
303
- onPause(callback?: () => void): void
303
+ onPause(callback?: InnerAudioContext.OnPauseCallback): void
304
304
  /** 音频停止事件
305
305
  * @supported weapp, h5, rn
306
306
  */
307
- onStop(callback?: () => void): void
307
+ onStop(callback?: InnerAudioContext.OnStopCallback): void
308
308
  /** 音频自然播放结束事件
309
309
  * @supported weapp, h5, rn
310
310
  */
311
- onEnded(callback?: () => void): void
311
+ onEnded(callback?: InnerAudioContext.OnEndedCallback): void
312
312
  /** 音频播放进度更新事件
313
313
  * @supported weapp, h5, rn
314
314
  */
315
- onTimeUpdate(callback?: () => void): void
315
+ onTimeUpdate(callback?: InnerAudioContext.OnTimeUpdateCallback): void
316
316
  /** 音频播放错误事件
317
317
  * @supported weapp, h5, rn
318
318
  */
319
- onError(callback?: (res: InnerAudioContext.onErrorDetail) => void): void
319
+ onError(callback?: InnerAudioContext.OnErrorCallback): void
320
320
  /** 音频加载中事件,当音频因为数据不足,需要停下来加载时会触发
321
321
  * @supported weapp, h5, rn
322
322
  */
323
- onWaiting(callback?: () => void): void
323
+ onWaiting(callback?: InnerAudioContext.OnWaitingCallback): void
324
324
  /** 音频进行 seek 操作事件
325
325
  * @supported weapp, h5, rn
326
326
  */
327
- onSeeking(callback?: () => void): void
327
+ onSeeking(callback?: InnerAudioContext.OnSeekingCallback): void
328
328
  /** 音频完成 seek 操作事件
329
329
  * @supported weapp, h5, rn
330
330
  */
331
- onSeeked(callback?: () => void): void
332
- /** 取消监听 onCanplay 事件
331
+ onSeeked(callback?: InnerAudioContext.OnSeekedCallback): void
332
+ /** 取消监听 canplay 事件
333
333
  * @supported weapp, h5, rn
334
334
  */
335
- offCanplay(callback?: () => void): void
336
- /** 取消监听 onPlay 事件
335
+ offCanplay(callback?: InnerAudioContext.OnCanplayCallback): void
336
+ /** 取消监听 play 事件
337
337
  * @supported weapp, h5, rn
338
338
  */
339
- offPlay(callback?: () => void): void
340
- /** 取消监听 onPause 事件
339
+ offPlay(callback?: InnerAudioContext.OnPlayCallback): void
340
+ /** 取消监听 pause 事件
341
341
  * @supported weapp, h5, rn
342
342
  */
343
- offPause(callback?: () => void): void
344
- /** 取消监听 onStop 事件
343
+ offPause(callback?: InnerAudioContext.OnPauseCallback): void
344
+ /** 取消监听 stop 事件
345
345
  * @supported weapp, h5, rn
346
346
  */
347
- offStop(callback?: () => void): void
348
- /** 取消监听 onEnded 事件
347
+ offStop(callback?: InnerAudioContext.OnStopCallback): void
348
+ /** 取消监听 ended 事件
349
349
  * @supported weapp, h5, rn
350
350
  */
351
- offEnded(callback?: () => void): void
352
- /** 取消监听 onTimeUpdate 事件
351
+ offEnded(callback?: InnerAudioContext.OnEndedCallback): void
352
+ /** 取消监听 timeUpdate 事件
353
353
  * @supported weapp, h5, rn
354
354
  */
355
- offTimeUpdate(callback?: () => void): void
356
- /** 取消监听 onError 事件
355
+ offTimeUpdate(callback?: InnerAudioContext.OnTimeUpdateCallback): void
356
+ /** 取消监听 error 事件
357
357
  * @supported weapp, h5, rn
358
358
  */
359
- offError(callback?: () => void): void
360
- /** 取消监听 onWaiting 事件
359
+ offError(callback?: InnerAudioContext.OnErrorCallback): void
360
+ /** 取消监听 waiting 事件
361
361
  * @supported weapp, h5, rn
362
362
  */
363
- offWaiting(callback?: () => void): void
364
- /** 取消监听 onSeeking 事件
363
+ offWaiting(callback?: InnerAudioContext.OnWaitingCallback): void
364
+ /** 取消监听 seeking 事件
365
365
  * @supported weapp, h5, rn
366
366
  */
367
- offSeeking(callback?: () => void): void
368
- /** 取消监听 onSeeked 事件
367
+ offSeeking(callback?: InnerAudioContext.OnSeekingCallback): void
368
+ /** 取消监听 seeked 事件
369
369
  * @supported weapp, h5, rn
370
370
  */
371
- offSeeked(callback?: () => void): void
371
+ offSeeked(callback?: InnerAudioContext.OnSeekedCallback): void
372
372
  }
373
373
 
374
374
  namespace InnerAudioContext {
@@ -391,6 +391,26 @@ declare module '../../index' {
391
391
  /** 未知错误 */
392
392
  '-1'
393
393
  }
394
+ /** 音频进入可以播放状态事件的回调函数 */
395
+ type OnCanplayCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
396
+ /** 音频播放事件的回调函数 */
397
+ type OnPlayCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
398
+ /** 音频暂停事件的回调函数 */
399
+ type OnPauseCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
400
+ /** 音频停止事件的回调函数 */
401
+ type OnStopCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
402
+ /** 音频自然播放结束事件的回调函数 */
403
+ type OnEndedCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
404
+ /** 音频播放进度更新事件的回调函数 */
405
+ type OnTimeUpdateCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
406
+ /** 音频播放错误事件的回调函数 */
407
+ type OnErrorCallback = (res: onErrorDetail) => void
408
+ /** 音频加载中事件的回调函数 */
409
+ type OnWaitingCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
410
+ /** 音频进行 seek 操作事件的回调函数 */
411
+ type OnSeekingCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
412
+ /** 音频完成 seek 操作事件的回调函数 */
413
+ type OnSeekedCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
394
414
  }
395
415
 
396
416
  /** MediaAudioPlayer 实例,可通过 [Taro.createMediaAudioPlayer](./createMediaAudioPlayer) 接口获取实例。
@@ -18,11 +18,23 @@ declare module '../../index' {
18
18
  interface Option {
19
19
  /** 需要预览的图片链接列表。 */
20
20
  urls: string[]
21
- /** 当前显示图片的链接 */
22
- current?: string
23
- /** @support weapp 最低版本:2.13.0。是否显示长按菜单,默认值:true */
21
+ /**
22
+ * 微信端为当前显示图片的链接,支付宝端为当前显示图片的索引值
23
+ */
24
+ current?: string | number
25
+ /**
26
+ * 是否支持长按下载图片
27
+ * @supported alipay 基础库: 1.13.0
28
+ */
29
+ enablesavephoto?: boolean
30
+ /**
31
+ * 是否在右下角显示下载入口
32
+ * @supported alipay 基础库: 1.13.0
33
+ */
34
+ enableShowPhotoDownload?: boolean
35
+ /** @supported weapp 最低版本:2.13.0。是否显示长按菜单,默认值:true */
24
36
  showmenu?: boolean
25
- /** @support weapp 最低版本:2.13.0。origin: 发送完整的referrer; no-referrer: 不发送。格式固定为 https://servicewechat.com/{appid}/{version}/page-frame.html,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本;默认值:no-referrer */
37
+ /** @supported weapp 最低版本:2.13.0。origin: 发送完整的referrer; no-referrer: 不发送。格式固定为 https://servicewechat.com/{appid}/{version}/page-frame.html,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本;默认值:no-referrer */
26
38
  referrerPolicy?: string
27
39
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
28
40
  complete?: (res: TaroGeneral.CallbackResult) => void
@@ -46,7 +58,7 @@ declare module '../../index' {
46
58
  /** 需要预览的资源列表 */
47
59
  sources: Sources[]
48
60
  /** 当前显示的资源序号,默认值:0 */
49
- current?: number
61
+ current?: number
50
62
  /** 是否显示长按菜单 2.13.0,默认值:true */
51
63
  showmenu?: boolean
52
64
  /** origin: 发送完整的referrer; no-referrer: 不发送。格式固定为 https://servicewechat.com/{appid}/{version}/page-frame.html,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本;默认值:no-referrer */
@@ -127,19 +139,30 @@ declare module '../../index' {
127
139
 
128
140
  namespace chooseImage {
129
141
  interface Option {
142
+ /** 最多可以选择的图片张数
143
+ * @default 9
144
+ * @supported weapp, alipay, swan, tt, h5, rn
145
+ */
146
+ count?: number
147
+ /** 所选的图片的尺寸
148
+ * @default ['original', 'compressed']
149
+ * @supported weapp, alipay, swan, tt, rn
150
+ */
151
+ sizeType?: Array<keyof sizeType>
152
+ /** 选择图片的来源
153
+ * @default ['album', 'camera']
154
+ * @supported weapp, alipay, swan, tt, h5, rn
155
+ */
156
+ sourceType?: Array<keyof sourceType>
130
157
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
131
158
  complete?: (res: TaroGeneral.CallbackResult) => void
132
- /** 最多可以选择的图片张数 */
133
- count?: number
134
159
  /** 接口调用失败的回调函数 */
135
160
  fail?: (res: TaroGeneral.CallbackResult) => void
136
- /** 所选的图片的尺寸 */
137
- sizeType?: Array<keyof sizeType>
138
- /** 选择图片的来源 */
139
- sourceType?: Array<keyof sourceType>
140
161
  /** 接口调用成功的回调函数 */
141
162
  success?: (result: SuccessCallbackResult) => void
142
- /** 用来上传的input元素ID(仅h5端)@supported h5 */
163
+ /** 用来上传的input元素ID(仅h5
164
+ * @supported h5
165
+ */
143
166
  imageId?: string
144
167
  }
145
168
  /** 图片的尺寸 */
@@ -301,7 +324,7 @@ declare module '../../index' {
301
324
 
302
325
  interface TaroStatic {
303
326
  /** 保存图片到系统相册。需要[用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) scope.writePhotosAlbum
304
- * @supported weapp, rn, alipay, swan, tt
327
+ * @supported weapp, alipay, swan, tt, h5, rn
305
328
  * @example
306
329
  * ```tsx
307
330
  * Taro.saveImageToPhotosAlbum({
@@ -325,7 +348,7 @@ declare module '../../index' {
325
348
  previewMedia(option: previewMedia.Option): Promise<TaroGeneral.CallbackResult>
326
349
 
327
350
  /** 在新页面中全屏预览图片。预览的过程中用户可以进行保存图片、发送给朋友等操作。
328
- * @supported weapp, h5, rn, alipay, swan, tt
351
+ * @supported weapp, alipay, swan, tt, h5, rn
329
352
  * @example
330
353
  * ```tsx
331
354
  * Taro.previewImage({
@@ -338,7 +361,7 @@ declare module '../../index' {
338
361
  previewImage(option: previewImage.Option): Promise<TaroGeneral.CallbackResult>
339
362
 
340
363
  /** 获取图片信息。网络图片需先配置download域名才能生效。
341
- * @supported weapp, h5, rn, alipay, swan, tt
364
+ * @supported weapp, alipay, swan, tt, h5, rn
342
365
  * @example
343
366
  * ```tsx
344
367
  * Taro.getImageInfo({
@@ -377,7 +400,7 @@ declare module '../../index' {
377
400
  editImage(option: editImage.Option): Promise<editImage.SuccessCallbackResult>
378
401
 
379
402
  /** 压缩图片接口,可选压缩质量
380
- * @supported weapp, rn, tt
403
+ * @supported weapp, tt, rn
381
404
  * @example
382
405
  * ```tsx
383
406
  * Taro.compressImage({
@@ -408,7 +431,7 @@ declare module '../../index' {
408
431
 
409
432
  /**
410
433
  * 从本地相册选择图片或使用相机拍照。
411
- * @supported weapp, h5, rn, alipay, swan, tt
434
+ * @supported weapp, alipay, swan, tt, h5, rn
412
435
  * @example
413
436
  * ```tsx
414
437
  * Taro.chooseImage({
@@ -227,6 +227,14 @@ declare module '../../index' {
227
227
  toggleTorch(option?: LivePusherContext.ToggleTorchOption): void
228
228
  }
229
229
  namespace LivePlayerContext {
230
+ interface ExitCastingOption {
231
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
232
+ complete?: (res: TaroGeneral.CallbackResult) => void
233
+ /** 接口调用失败的回调函数 */
234
+ fail?: (res: TaroGeneral.CallbackResult) => void
235
+ /** 接口调用成功的回调函数 */
236
+ success?: (res: TaroGeneral.CallbackResult) => void
237
+ }
230
238
  interface ExitFullScreenOption {
231
239
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
232
240
  complete?: (res: TaroGeneral.CallbackResult) => void
@@ -267,6 +275,14 @@ declare module '../../index' {
267
275
  /** 接口调用成功的回调函数 */
268
276
  success?: (res: TaroGeneral.CallbackResult) => void
269
277
  }
278
+ interface ReconnectCastingOption {
279
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
280
+ complete?: (res: TaroGeneral.CallbackResult) => void
281
+ /** 接口调用失败的回调函数 */
282
+ fail?: (res: TaroGeneral.CallbackResult) => void
283
+ /** 接口调用成功的回调函数 */
284
+ success?: (res: TaroGeneral.CallbackResult) => void
285
+ }
270
286
  interface RequestFullScreenOption {
271
287
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
272
288
  complete?: (res: TaroGeneral.CallbackResult) => void
@@ -316,6 +332,14 @@ declare module '../../index' {
316
332
  /** 调用结果 */
317
333
  errMsg: string
318
334
  }
335
+ interface StartCastingOption {
336
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
337
+ complete?: (res: TaroGeneral.CallbackResult) => void
338
+ /** 接口调用失败的回调函数 */
339
+ fail?: (res: TaroGeneral.CallbackResult) => void
340
+ /** 接口调用成功的回调函数 */
341
+ success?: (res: TaroGeneral.CallbackResult) => void
342
+ }
319
343
  interface StopOption {
320
344
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
321
345
  complete?: (res: TaroGeneral.CallbackResult) => void
@@ -324,6 +348,14 @@ declare module '../../index' {
324
348
  /** 接口调用成功的回调函数 */
325
349
  success?: (res: TaroGeneral.CallbackResult) => void
326
350
  }
351
+ interface SwitchCastingOption {
352
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
353
+ complete?: (res: TaroGeneral.CallbackResult) => void
354
+ /** 接口调用失败的回调函数 */
355
+ fail?: (res: TaroGeneral.CallbackResult) => void
356
+ /** 接口调用成功的回调函数 */
357
+ success?: (res: TaroGeneral.CallbackResult) => void
358
+ }
327
359
  }
328
360
 
329
361
  /** `LivePlayerContext` 实例,可通过 `Taro.createLivePlayerContext` 获取。
@@ -332,6 +364,11 @@ declare module '../../index' {
332
364
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.html
333
365
  */
334
366
  interface LivePlayerContext {
367
+ /** 退出投屏。仅支持在 tap 事件回调内调用。
368
+ * @supported weapp
369
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.exitCasting.html
370
+ */
371
+ exitCasting(option?: LivePlayerContext.ExitCastingOption): void
335
372
  /** 退出全屏
336
373
  * @supported weapp
337
374
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.exitFullScreen.html
@@ -357,6 +394,11 @@ declare module '../../index' {
357
394
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.play.html
358
395
  */
359
396
  play(option?: LivePlayerContext.PlayOption): void
397
+ /** 重连投屏设备。仅支持在 tap 事件回调内调用。
398
+ * @supported weapp
399
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.reconnectCasting.html
400
+ */
401
+ reconnectCasting(option?: LivePlayerContext.ReconnectCastingOption): void
360
402
  /** 进入全屏
361
403
  * @supported weapp
362
404
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.requestFullScreen.html
@@ -381,11 +423,21 @@ declare module '../../index' {
381
423
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.snapshot.html
382
424
  */
383
425
  snapshot(option?: LivePlayerContext.SnapshotOption): void
426
+ /** 开始投屏, 拉起半屏搜索设备。仅支持在 tap 事件回调内调用
427
+ * @supported weapp
428
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.startCasting.html
429
+ */
430
+ startCasting(option?: LivePlayerContext.StartCastingOption): void
384
431
  /** 停止
385
432
  * @supported weapp
386
433
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.stop.html
387
434
  */
388
435
  stop(option?: LivePlayerContext.StopOption): void
436
+ /** 切换投屏设备。仅支持在 tap 事件回调内调用。
437
+ * @supported weapp
438
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.switchCasting.html
439
+ */
440
+ switchCasting(option?: LivePlayerContext.SwitchCastingOption): void
389
441
  }
390
442
 
391
443
  interface TaroStatic {
@@ -233,30 +233,42 @@ declare module '../../index' {
233
233
 
234
234
  namespace chooseVideo {
235
235
  interface Option {
236
- /** 默认拉起的是前置或者后置摄像头。部分 Android 手机下由于系统 ROM 不支持无法生效 */
236
+ /** 默认拉起的是前置或者后置摄像头。部分 Android 手机下由于系统 ROM 不支持无法生效
237
+ * @default "back"
238
+ * @supported weapp, h5
239
+ */
237
240
  camera?: keyof Camera
241
+ /** 是否压缩所选择的视频文件
242
+ * @default true
243
+ * @supported weapp
244
+ */
245
+ compressed?: boolean
246
+ /** 拍摄视频最长拍摄时间,单位秒
247
+ * @default 60
248
+ * @supported weapp
249
+ */
250
+ maxDuration?: number
251
+ /** 视频选择的来源
252
+ * @default ['album', 'camera']
253
+ * @supported weapp, h5
254
+ */
255
+ sourceType?: Array<keyof sourceType>
238
256
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
239
257
  complete?: (res: TaroGeneral.CallbackResult) => void
240
- /** 是否压缩所选择的视频文件 */
241
- compressed?: boolean
242
258
  /** 接口调用失败的回调函数 */
243
259
  fail?: (res: TaroGeneral.CallbackResult) => void
244
- /** 拍摄视频最长拍摄时间,单位秒 */
245
- maxDuration?: number
246
- /** 视频选择的来源 */
247
- sourceType?: Array<keyof sourceType>
248
260
  /** 接口调用成功的回调函数 */
249
261
  success?: (result: SuccessCallbackResult) => void
250
262
  }
251
263
  interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
264
+ /** 选定视频的临时文件路径 */
265
+ tempFilePath: string
252
266
  /** 选定视频的时间长度 */
253
267
  duration: number
254
- /** 返回选定视频的高度 */
255
- height: number
256
268
  /** 选定视频的数据量大小 */
257
269
  size: number
258
- /** 选定视频的临时文件路径 */
259
- tempFilePath: string
270
+ /** 返回选定视频的高度 */
271
+ height: number
260
272
  /** 返回选定视频的宽度 */
261
273
  width: number
262
274
  /** 调用结果 */
@@ -276,30 +288,53 @@ declare module '../../index' {
276
288
  }
277
289
  }
278
290
 
279
-
280
291
  namespace chooseMedia {
281
292
  interface Option {
282
- /** 最多可以选择的文件个数 */
293
+ /** 最多可以选择的文件个数
294
+ * @default 9
295
+ * @supported weapp, h5
296
+ */
283
297
  count?: number
284
- /** 文件类型 */
298
+ /** 文件类型
299
+ * @default ['image', 'video']
300
+ * @supported weapp, h5
301
+ */
285
302
  mediaType?: Array<keyof mediaType>
286
- /** 图片和视频选择的来源 */
303
+ /** 图片和视频选择的来源
304
+ * @default ['album', 'camera']
305
+ * @supported weapp, h5
306
+ */
287
307
  sourceType?: Array<keyof sourceType>
288
- /** 拍摄视频最长拍摄时间,单位秒。时间范围为 3s 至 30s 之间 */
308
+ /** 拍摄视频最长拍摄时间,单位秒。时间范围为 3s 至 60s 之间
309
+ * @default 10
310
+ * @supported weapp
311
+ */
289
312
  maxDuration?: number
290
- /** 仅对 mediaType 为 image 时有效,是否压缩所选文件 */
313
+ /** 是否压缩所选文件
314
+ * @default ['original', 'compressed']
315
+ * @supported weapp
316
+ */
291
317
  sizeType?: Array<'original' | 'compressed'>
292
- /** 仅在 sourceType 为 camera 时生效,使用前置或后置摄像头 */
318
+ /** 仅在 sourceType 为 camera 时生效,使用前置或后置摄像头
319
+ * @default "back"
320
+ * @supported weapp, h5
321
+ */
293
322
  camera?: string
323
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
324
+ complete?: (res: TaroGeneral.CallbackResult) => void
294
325
  /** 接口调用失败的回调函数 */
295
326
  fail?: (res: TaroGeneral.CallbackResult) => void
296
327
  /** 接口调用成功的回调函数 */
297
328
  success?: (result: SuccessCallbackResult) => void
329
+ /** 用来上传的input元素ID
330
+ * @supported h5
331
+ */
332
+ mediaId?: string
298
333
  }
299
334
  interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
300
335
  /** 本地临时文件列表 */
301
336
  tempFiles: ChooseMedia[]
302
- /** 文件类型,有效值有 image 、video */
337
+ /** 文件类型,有效值有 image 、video、mix */
303
338
  type: string
304
339
  }
305
340
  /** 本地临时文件列表 */
@@ -316,6 +351,12 @@ declare module '../../index' {
316
351
  width: number
317
352
  /** 视频缩略图临时文件路径 */
318
353
  thumbTempFilePath: string
354
+ /** 选择的文件的类型 */
355
+ fileType: string
356
+ /** 原始的浏览器 File 对象
357
+ * @supported h5
358
+ */
359
+ originalFileObj?: File
319
360
  }
320
361
  interface mediaType {
321
362
  /** 只能拍摄视频或从相册选择视频 */
@@ -346,11 +387,11 @@ declare module '../../index' {
346
387
  * **Bug & Tip:**
347
388
  *
348
389
  * 1. `tip`: camera 参数在部分 Android 手机下由于系统 ROM 不支持无法生效
349
- * @supported weapp, rn
390
+ * @supported weapp, h5, rn
350
391
  * @example
351
392
  ```tsx
352
393
  * Taro.saveVideoToPhotosAlbum({
353
- * filePath: 'wxfile://xxx',
394
+ * filePath: 'file://xxx',
354
395
  * success: function (res) {
355
396
  * console.log(res.errMsg)
356
397
  * }
@@ -447,7 +488,7 @@ declare module '../../index' {
447
488
  compressVideo(option: compressVideo.Option): Promise<compressVideo.SuccessCallbackResult>
448
489
 
449
490
  /** 拍摄视频或从手机相册中选视频。
450
- * @supported weapp, rn
491
+ * @supported weapp, h5, rn
451
492
  * @example
452
493
  * ```tsx
453
494
  * Taro.chooseVideo({
@@ -464,7 +505,7 @@ declare module '../../index' {
464
505
  chooseVideo(option: chooseVideo.Option): Promise<chooseVideo.SuccessCallbackResult>
465
506
 
466
507
  /** 拍摄或从手机相册中选择图片或视频。
467
- * @supported weapp
508
+ * @supported weapp, h5
468
509
  * @example
469
510
  * ```tsx
470
511
  * Taro.chooseMedia({