@tarojs/taro 3.5.0-canary.1 → 3.5.0
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/html.css +50 -14
- package/html5.css +167 -64
- package/index.js +3 -4
- package/package.json +21 -11
- package/types/api/ad/index.d.ts +2 -2
- package/types/api/ai/face.d.ts +133 -0
- package/types/api/ai/visionkit.d.ts +303 -0
- package/types/api/base/crypto.d.ts +90 -0
- package/types/api/base/debug.d.ts +152 -13
- package/types/api/base/env.d.ts +2 -1
- package/types/api/base/index.d.ts +11 -3
- package/types/api/base/performance.d.ts +195 -0
- package/types/api/base/system.d.ts +541 -103
- package/types/api/base/update.d.ts +60 -8
- package/types/api/base/weapp/app-event.d.ts +99 -37
- package/types/api/base/weapp/life-cycle.d.ts +142 -2
- package/types/api/canvas/index.d.ts +151 -137
- package/types/api/cloud/index.d.ts +17 -2
- package/types/api/data-analysis/index.d.ts +1 -1
- package/types/api/device/accelerometer.d.ts +6 -6
- package/types/api/device/accessibility.d.ts +26 -0
- package/types/api/device/battery.d.ts +2 -2
- package/types/api/device/{ble.d.ts → bluetooth-ble.d.ts} +228 -62
- package/types/api/device/bluetooth-peripheral.d.ts +430 -0
- package/types/api/device/bluetooth.d.ts +67 -2
- package/types/api/device/calendar.d.ts +88 -0
- package/types/api/device/clipboard.d.ts +2 -2
- package/types/api/device/compass.d.ts +3 -3
- package/types/api/device/contact.d.ts +74 -50
- package/types/api/device/gyroscope.d.ts +6 -6
- package/types/api/device/iBeacon.d.ts +33 -19
- package/types/api/{ui → device}/keyboard.d.ts +1 -1
- package/types/api/device/{performance.d.ts → memory.d.ts} +5 -5
- package/types/api/device/motion.d.ts +3 -3
- package/types/api/device/network.d.ts +56 -15
- package/types/api/device/nfc.d.ts +1089 -13
- package/types/api/device/phone.d.ts +1 -1
- package/types/api/device/scan.d.ts +1 -1
- package/types/api/device/screen.d.ts +42 -14
- package/types/api/device/vibrate.d.ts +6 -2
- package/types/api/device/wifi.d.ts +44 -9
- package/types/api/ext/index.d.ts +2 -2
- package/types/api/files/index.d.ts +392 -205
- package/types/api/framework/index.d.ts +5 -4
- package/types/api/location/index.d.ts +156 -53
- package/types/api/media/audio.d.ts +629 -38
- package/types/api/media/background-audio.d.ts +9 -9
- package/types/api/media/camera.d.ts +41 -22
- package/types/api/media/editor.d.ts +22 -2
- package/types/api/media/image.d.ts +64 -35
- package/types/api/media/live.d.ts +66 -6
- package/types/api/media/map.d.ts +474 -54
- package/types/api/media/media-recorder.d.ts +92 -0
- package/types/api/media/recorder.d.ts +21 -21
- package/types/api/media/video-decoder.d.ts +117 -0
- package/types/api/media/video-processing.d.ts +11 -7
- package/types/api/media/video.d.ts +47 -18
- package/types/api/media/voip.d.ts +290 -0
- package/types/api/{open-api/navigate.d.ts → navigate/index.d.ts} +65 -27
- package/types/api/network/download.d.ts +61 -19
- package/types/api/network/request.d.ts +129 -41
- package/types/api/network/tcp.d.ts +181 -0
- package/types/api/network/udp.d.ts +154 -83
- package/types/api/network/upload.d.ts +55 -28
- package/types/api/network/websocket.d.ts +20 -19
- package/types/api/open-api/address.d.ts +1 -1
- package/types/api/open-api/authorize.d.ts +42 -3
- package/types/api/open-api/channels.d.ts +178 -0
- package/types/api/open-api/facial.d.ts +3 -0
- package/types/api/open-api/favorites.d.ts +100 -0
- package/types/api/open-api/group.d.ts +59 -0
- package/types/api/open-api/invoice.d.ts +2 -2
- package/types/api/open-api/license-plate.d.ts +27 -0
- package/types/api/open-api/login.d.ts +21 -0
- package/types/api/open-api/redpackage.d.ts +24 -0
- package/types/api/open-api/settings.d.ts +82 -17
- package/types/api/open-api/soter.d.ts +2 -2
- package/types/api/open-api/subscribe-message.d.ts +89 -4
- package/types/api/open-api/user-info.d.ts +56 -19
- package/types/api/open-api/werun.d.ts +33 -6
- package/types/api/payment/index.d.ts +119 -0
- package/types/api/route/index.d.ts +18 -14
- package/types/api/share/index.d.ts +192 -9
- package/types/api/storage/index.d.ts +38 -92
- package/types/api/swan/index.d.ts +1 -1
- package/types/api/ui/animation.d.ts +105 -155
- package/types/api/ui/background.d.ts +4 -2
- package/types/api/ui/custom-component.d.ts +1 -1
- package/types/api/ui/fonts.d.ts +27 -31
- package/types/api/ui/interaction.d.ts +6 -6
- package/types/api/ui/menu.d.ts +1 -1
- package/types/api/ui/navigation-bar.d.ts +6 -5
- package/types/api/ui/pull-down-refresh.d.ts +2 -2
- package/types/api/ui/scroll.d.ts +75 -7
- package/types/api/ui/sticky.d.ts +4 -4
- package/types/api/ui/tab-bar.d.ts +8 -8
- package/types/api/ui/window.d.ts +22 -2
- package/types/api/worker/index.d.ts +9 -1
- package/types/api/wxml/index.d.ts +116 -112
- package/types/compile.d.ts +57 -6
- package/types/global.d.ts +142 -111
- package/types/taro.api.d.ts +79 -62
- package/types/taro.component.d.ts +21 -65
- package/types/taro.config.d.ts +31 -0
- package/types/taro.extend.d.ts +31 -18
- package/types/taro.hooks.d.ts +55 -3
- package/types/taro.lifecycle.d.ts +21 -14
- package/LICENSE +0 -21
- package/types/api/open-api/payment.d.ts +0 -61
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
interface MediaRecorder {
|
|
5
|
+
/** 销毁录制器
|
|
6
|
+
* @supported weapp
|
|
7
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/MediaRecorder.destroy.html
|
|
8
|
+
*/
|
|
9
|
+
destroy(): Promise<void>
|
|
10
|
+
/** 取消监听录制事件
|
|
11
|
+
* @supported weapp
|
|
12
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/MediaRecorder.off.html
|
|
13
|
+
*/
|
|
14
|
+
off(
|
|
15
|
+
/** 事件名 */
|
|
16
|
+
eventName: keyof MediaRecorder.on.EventName,
|
|
17
|
+
/** 事件触发时执行的回调函数 */
|
|
18
|
+
callback: MediaRecorder.on.Callback
|
|
19
|
+
): Promise<void>
|
|
20
|
+
/** 注册监听录制事件的回调函数
|
|
21
|
+
* @supported weapp
|
|
22
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/MediaRecorder.on.html
|
|
23
|
+
*/
|
|
24
|
+
on(
|
|
25
|
+
/** 事件名 */
|
|
26
|
+
eventName: keyof MediaRecorder.on.EventName,
|
|
27
|
+
/** 事件触发时执行的回调函数 */
|
|
28
|
+
callback: MediaRecorder.on.Callback
|
|
29
|
+
): Promise<void>
|
|
30
|
+
/** 暂停录制
|
|
31
|
+
* @supported weapp
|
|
32
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/MediaRecorder.pause.html
|
|
33
|
+
*/
|
|
34
|
+
pause(): Promise<void>
|
|
35
|
+
/** 请求下一帧录制,在 callback 里完成一帧渲染后开始录制当前帧
|
|
36
|
+
* @supported weapp
|
|
37
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/MediaRecorder.requestFrame.html
|
|
38
|
+
*/
|
|
39
|
+
requestFrame(callback: MediaRecorder.requestFrame.Callback): Promise<void>
|
|
40
|
+
/** 恢复录制
|
|
41
|
+
* @supported weapp
|
|
42
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/MediaRecorder.resume.html
|
|
43
|
+
*/
|
|
44
|
+
resume(): Promise<void>
|
|
45
|
+
/** 开始录制
|
|
46
|
+
* @supported weapp
|
|
47
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/MediaRecorder.start.html
|
|
48
|
+
*/
|
|
49
|
+
start(): Promise<void>
|
|
50
|
+
/** 结束录制
|
|
51
|
+
* @supported weapp
|
|
52
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/MediaRecorder.stop.html
|
|
53
|
+
*/
|
|
54
|
+
stop(): Promise<void>
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
namespace MediaRecorder {
|
|
58
|
+
namespace on {
|
|
59
|
+
/** eventName 的合法值 */
|
|
60
|
+
interface EventName {
|
|
61
|
+
/** 录制开始事件。 */
|
|
62
|
+
start
|
|
63
|
+
/** 录制结束事件。返回 {tempFilePath, duration, fileSize} */
|
|
64
|
+
stop
|
|
65
|
+
/** 录制暂停事件。 */
|
|
66
|
+
pause
|
|
67
|
+
/** 录制继续事件。 */
|
|
68
|
+
resume
|
|
69
|
+
/** 录制时间更新事件。 */
|
|
70
|
+
timeupdate
|
|
71
|
+
}
|
|
72
|
+
/** 事件触发时执行的回调函数 */
|
|
73
|
+
type Callback = (res?: {
|
|
74
|
+
tempFilePath: string
|
|
75
|
+
duration: number
|
|
76
|
+
fileSize: number
|
|
77
|
+
}) => void
|
|
78
|
+
}
|
|
79
|
+
namespace requestFrame {
|
|
80
|
+
/** 事件触发时执行的回调函数 */
|
|
81
|
+
type Callback = () => void
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
interface TaroStatic {
|
|
86
|
+
/** 创建 WebGL 画面录制器,可逐帧录制在 WebGL 上渲染的画面并导出视频文件
|
|
87
|
+
* @supported weapp
|
|
88
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/wx.createMediaRecorder.html
|
|
89
|
+
*/
|
|
90
|
+
createMediaRecorder(): MediaRecorder
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -59,23 +59,23 @@ declare module '../../index' {
|
|
|
59
59
|
tempFilePath: string
|
|
60
60
|
}
|
|
61
61
|
interface StartOption {
|
|
62
|
-
/** 指定录音的音频输入源,可通过 [
|
|
63
|
-
audioSource?: keyof
|
|
62
|
+
/** 指定录音的音频输入源,可通过 [Taro.getAvailableAudioSources()](/docs/apis/media/audio/getAvailableAudioSources) 获取当前可用的音频源 */
|
|
63
|
+
audioSource?: keyof AudioSource
|
|
64
64
|
/** 录音的时长,单位 ms,最大值 600000(10 分钟) */
|
|
65
65
|
duration?: number
|
|
66
66
|
/** 编码码率,有效值见下表格 */
|
|
67
67
|
encodeBitRate?: number
|
|
68
68
|
/** 音频格式 */
|
|
69
|
-
format?: keyof
|
|
69
|
+
format?: keyof Format
|
|
70
70
|
/** 指定帧大小,单位 KB。传入 frameSize 后,每录制指定帧大小的内容后,会回调录制的文件内容,不指定则不会回调。暂仅支持 mp3 格式。 */
|
|
71
71
|
frameSize?: number
|
|
72
72
|
/** 录音通道数 */
|
|
73
|
-
numberOfChannels?: keyof
|
|
73
|
+
numberOfChannels?: keyof NumberOfChannels
|
|
74
74
|
/** 采样率 */
|
|
75
|
-
sampleRate?: keyof
|
|
75
|
+
sampleRate?: keyof SampleRate
|
|
76
76
|
}
|
|
77
77
|
/** 指定录音的音频输入源 */
|
|
78
|
-
interface
|
|
78
|
+
interface AudioSource {
|
|
79
79
|
/** 自动设置,默认使用手机麦克风,插上耳麦后自动切换使用耳机麦克风,所有平台适用 */
|
|
80
80
|
'auto'
|
|
81
81
|
/** 手机麦克风,仅限 iOS */
|
|
@@ -92,7 +92,7 @@ declare module '../../index' {
|
|
|
92
92
|
'voice_recognition'
|
|
93
93
|
}
|
|
94
94
|
/** 音频格式 */
|
|
95
|
-
interface
|
|
95
|
+
interface Format {
|
|
96
96
|
/** mp3 格式 */
|
|
97
97
|
mp3
|
|
98
98
|
/** aac 格式 */
|
|
@@ -103,14 +103,14 @@ declare module '../../index' {
|
|
|
103
103
|
PCM
|
|
104
104
|
}
|
|
105
105
|
/** 录音通道数 */
|
|
106
|
-
interface
|
|
106
|
+
interface NumberOfChannels {
|
|
107
107
|
/** 1 个通道 */
|
|
108
108
|
1
|
|
109
109
|
/** 2 个通道 */
|
|
110
110
|
2
|
|
111
111
|
}
|
|
112
112
|
/** 采样率 */
|
|
113
|
-
interface
|
|
113
|
+
interface SampleRate {
|
|
114
114
|
/** 8000 采样率
|
|
115
115
|
* @codeRate 16000 ~ 48000
|
|
116
116
|
*/
|
|
@@ -155,7 +155,7 @@ declare module '../../index' {
|
|
|
155
155
|
*/
|
|
156
156
|
interface RecorderManager {
|
|
157
157
|
/** 监听录音错误事件
|
|
158
|
-
* @supported weapp
|
|
158
|
+
* @supported weapp, rn, tt
|
|
159
159
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onError.html
|
|
160
160
|
*/
|
|
161
161
|
onError(
|
|
@@ -163,7 +163,7 @@ declare module '../../index' {
|
|
|
163
163
|
callback: RecorderManager.OnErrorCallback,
|
|
164
164
|
): void
|
|
165
165
|
/** 监听已录制完指定帧大小的文件事件。如果设置了 frameSize,则会回调此事件。
|
|
166
|
-
* @supported weapp
|
|
166
|
+
* @supported weapp, tt
|
|
167
167
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onFrameRecorded.html
|
|
168
168
|
*/
|
|
169
169
|
onFrameRecorded(
|
|
@@ -187,7 +187,7 @@ declare module '../../index' {
|
|
|
187
187
|
callback: (res: TaroGeneral.CallbackResult) => void,
|
|
188
188
|
): void
|
|
189
189
|
/** 监听录音暂停事件
|
|
190
|
-
* @supported weapp
|
|
190
|
+
* @supported weapp, rn, tt
|
|
191
191
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onPause.html
|
|
192
192
|
*/
|
|
193
193
|
onPause(
|
|
@@ -195,7 +195,7 @@ declare module '../../index' {
|
|
|
195
195
|
callback: (res: TaroGeneral.CallbackResult) => void,
|
|
196
196
|
): void
|
|
197
197
|
/** 监听录音继续事件
|
|
198
|
-
* @supported weapp
|
|
198
|
+
* @supported weapp, rn, tt
|
|
199
199
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onResume.html
|
|
200
200
|
*/
|
|
201
201
|
onResume(
|
|
@@ -203,7 +203,7 @@ declare module '../../index' {
|
|
|
203
203
|
callback: (res: TaroGeneral.CallbackResult) => void,
|
|
204
204
|
): void
|
|
205
205
|
/** 监听录音开始事件
|
|
206
|
-
* @supported weapp
|
|
206
|
+
* @supported weapp, rn, tt
|
|
207
207
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onStart.html
|
|
208
208
|
*/
|
|
209
209
|
onStart(
|
|
@@ -211,7 +211,7 @@ declare module '../../index' {
|
|
|
211
211
|
callback: (res: TaroGeneral.CallbackResult) => void,
|
|
212
212
|
): void
|
|
213
213
|
/** 监听录音结束事件
|
|
214
|
-
* @supported weapp
|
|
214
|
+
* @supported weapp, rn, tt
|
|
215
215
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onStop.html
|
|
216
216
|
*/
|
|
217
217
|
onStop(
|
|
@@ -219,22 +219,22 @@ declare module '../../index' {
|
|
|
219
219
|
callback: RecorderManager.OnStopCallback,
|
|
220
220
|
): void
|
|
221
221
|
/** 暂停录音
|
|
222
|
-
* @supported weapp
|
|
222
|
+
* @supported weapp, rn
|
|
223
223
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.pause.html
|
|
224
224
|
*/
|
|
225
225
|
pause(): void
|
|
226
226
|
/** 继续录音
|
|
227
|
-
* @supported weapp
|
|
227
|
+
* @supported weapp, rn, tt
|
|
228
228
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.resume.html
|
|
229
229
|
*/
|
|
230
230
|
resume(): void
|
|
231
231
|
/** 开始录音
|
|
232
|
-
* @supported weapp
|
|
232
|
+
* @supported weapp, rn, tt
|
|
233
233
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.start.html
|
|
234
234
|
*/
|
|
235
235
|
start(option: RecorderManager.StartOption): void
|
|
236
236
|
/** 停止录音
|
|
237
|
-
* @supported weapp
|
|
237
|
+
* @supported weapp, rn, tt
|
|
238
238
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.stop.html
|
|
239
239
|
*/
|
|
240
240
|
stop(): void
|
|
@@ -263,7 +263,7 @@ declare module '../../index' {
|
|
|
263
263
|
stopRecord(option?: stopRecord.Option): void
|
|
264
264
|
|
|
265
265
|
/** 开始录音。当主动调用`Taro.stopRecord`,或者录音超过1分钟时自动结束录音,返回录音文件的临时文件路径。当用户离开小程序时,此接口无法调用。
|
|
266
|
-
* **注意:1.6.0 版本开始,本接口不再维护。建议使用能力更强的 [Taro.getRecorderManager](
|
|
266
|
+
* **注意:1.6.0 版本开始,本接口不再维护。建议使用能力更强的 [Taro.getRecorderManager](/docs/apis/media/recorder/getRecorderManager) 接口**
|
|
267
267
|
* 需要[用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) scope.record
|
|
268
268
|
* @supported weapp
|
|
269
269
|
* @example
|
|
@@ -282,7 +282,7 @@ declare module '../../index' {
|
|
|
282
282
|
startRecord(option: startRecord.Option): Promise<startRecord.SuccessCallbackResult>
|
|
283
283
|
|
|
284
284
|
/** 获取**全局唯一**的录音管理器 RecorderManager
|
|
285
|
-
* @supported weapp
|
|
285
|
+
* @supported weapp, rn
|
|
286
286
|
* @example
|
|
287
287
|
* ```tsx
|
|
288
288
|
* const recorderManager = Taro.getRecorderManager()
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
interface VideoDecoder {
|
|
5
|
+
/** 获取下一帧的解码数据
|
|
6
|
+
* @supported weapp
|
|
7
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.getFrameData.html
|
|
8
|
+
*/
|
|
9
|
+
getFrameData(): Promise<VideoDecoder.getFrameData.Result>
|
|
10
|
+
/** 取消监听录制事件
|
|
11
|
+
* @supported weapp
|
|
12
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.off.html
|
|
13
|
+
*/
|
|
14
|
+
off(
|
|
15
|
+
/** 事件名 */
|
|
16
|
+
eventName: keyof VideoDecoder.on.EventName,
|
|
17
|
+
/** 事件触发时执行的回调函数 */
|
|
18
|
+
callback: VideoDecoder.on.Callback
|
|
19
|
+
): void
|
|
20
|
+
/** 注册监听录制事件的回调函数
|
|
21
|
+
* @supported weapp
|
|
22
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.on.html
|
|
23
|
+
*/
|
|
24
|
+
on(
|
|
25
|
+
/** 事件名 */
|
|
26
|
+
eventName: keyof VideoDecoder.on.EventName,
|
|
27
|
+
/** 事件触发时执行的回调函数 */
|
|
28
|
+
callback: VideoDecoder.on.Callback
|
|
29
|
+
): void
|
|
30
|
+
/** 移除解码器
|
|
31
|
+
* @supported weapp
|
|
32
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.remove.html
|
|
33
|
+
*/
|
|
34
|
+
remove(): Promise<void>
|
|
35
|
+
/** 跳到某个时间点解码
|
|
36
|
+
* @supported weapp
|
|
37
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.seek.html
|
|
38
|
+
*/
|
|
39
|
+
seek(
|
|
40
|
+
/** 跳转的解码位置,单位 ms */
|
|
41
|
+
position: number
|
|
42
|
+
): Promise<void>
|
|
43
|
+
/** 开始解码
|
|
44
|
+
* @supported weapp
|
|
45
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.start.html
|
|
46
|
+
*/
|
|
47
|
+
start(option: VideoDecoder.start.Option): Promise<void>
|
|
48
|
+
/** 停止解码
|
|
49
|
+
* @supported weapp
|
|
50
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.stop.html
|
|
51
|
+
*/
|
|
52
|
+
stop(): Promise<void>
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
namespace VideoDecoder {
|
|
56
|
+
namespace getFrameData {
|
|
57
|
+
interface Result {
|
|
58
|
+
/** 帧数据宽度 */
|
|
59
|
+
width: number
|
|
60
|
+
/** 帧数据高度 */
|
|
61
|
+
height: number
|
|
62
|
+
/** 帧数据 */
|
|
63
|
+
data: ArrayBuffer
|
|
64
|
+
/** 帧原始 pts */
|
|
65
|
+
pkPts: number
|
|
66
|
+
/** 帧原始 dts */
|
|
67
|
+
pkDts: number
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
namespace on {
|
|
71
|
+
/** eventName 的合法值 */
|
|
72
|
+
interface EventName {
|
|
73
|
+
/** 开始事件。返回 {width, height} */
|
|
74
|
+
start
|
|
75
|
+
/** 结束事件。 */
|
|
76
|
+
stop
|
|
77
|
+
/** seek 完成事件。 */
|
|
78
|
+
seek
|
|
79
|
+
/** 缓冲区变化事件。 */
|
|
80
|
+
bufferchange
|
|
81
|
+
/** 解码结束事件。 */
|
|
82
|
+
ended
|
|
83
|
+
}
|
|
84
|
+
/** 事件触发时执行的回调函数 */
|
|
85
|
+
type Callback = (res?: {
|
|
86
|
+
width: number
|
|
87
|
+
height: number
|
|
88
|
+
}) => void
|
|
89
|
+
}
|
|
90
|
+
namespace start {
|
|
91
|
+
interface Option {
|
|
92
|
+
/** 需要解码的视频源文件。 */
|
|
93
|
+
source: string
|
|
94
|
+
/** 解码模式。0:按 pts 解码;1:以最快速度解码
|
|
95
|
+
* @default 1
|
|
96
|
+
*/
|
|
97
|
+
mode?: number
|
|
98
|
+
/** 是否不需要音频轨道
|
|
99
|
+
* @default false
|
|
100
|
+
*/
|
|
101
|
+
abortAudio?: boolean
|
|
102
|
+
/** 是否不需要视频轨道
|
|
103
|
+
* @default false
|
|
104
|
+
*/
|
|
105
|
+
abortVideo?: boolean
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
interface TaroStatic {
|
|
111
|
+
/** 创建视频解码器,可逐帧获取解码后的数据
|
|
112
|
+
* @supported weapp
|
|
113
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/wx.createVideoDecoder.html
|
|
114
|
+
*/
|
|
115
|
+
createVideoDecoder(): VideoDecoder
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -2,6 +2,9 @@ import Taro from '../../index'
|
|
|
2
2
|
|
|
3
3
|
declare module '../../index' {
|
|
4
4
|
/** 创建音视频处理容器,最终可将容器中的轨道合成一个视频
|
|
5
|
+
*
|
|
6
|
+
* > 可通过 [Taro.createMediaContainer](./createMediaContainer) 创建
|
|
7
|
+
* @supported weapp
|
|
5
8
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.html
|
|
6
9
|
*/
|
|
7
10
|
interface MediaContainer {
|
|
@@ -45,24 +48,25 @@ declare module '../../index' {
|
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
|
|
48
|
-
/** 可通过 [MediaContainer.extractDataSource](
|
|
49
|
-
* [MediaTrack](
|
|
51
|
+
/** 可通过 [MediaContainer.extractDataSource](/docs/apis/media/video-processing/MediaContainer#extractdatasource) 返回。
|
|
52
|
+
* [MediaTrack](/docs/apis/media/video-processing/MediaTrack) 音频或视频轨道,可以对轨道进行一些操作
|
|
53
|
+
* @supported weapp
|
|
50
54
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html
|
|
51
55
|
*/
|
|
52
56
|
interface MediaTrack {
|
|
53
|
-
/**
|
|
57
|
+
/** 轨道类型
|
|
54
58
|
* @readonly
|
|
55
59
|
*/
|
|
56
|
-
|
|
57
|
-
/**
|
|
60
|
+
kind: keyof MediaTrack.Kind
|
|
61
|
+
/** 轨道长度
|
|
58
62
|
* @readonly
|
|
59
63
|
*/
|
|
60
|
-
|
|
64
|
+
duration: number
|
|
61
65
|
/** 音量,音频轨道下有效,可写 */
|
|
62
66
|
volume: number
|
|
63
67
|
}
|
|
64
68
|
namespace MediaTrack {
|
|
65
|
-
interface
|
|
69
|
+
interface Kind {
|
|
66
70
|
/** 音频轨道 */
|
|
67
71
|
audio
|
|
68
72
|
/** 视频轨道 */
|
|
@@ -50,7 +50,7 @@ declare module '../../index' {
|
|
|
50
50
|
}
|
|
51
51
|
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
52
52
|
/** 画面方向 */
|
|
53
|
-
orientation: keyof
|
|
53
|
+
orientation: keyof Orientation
|
|
54
54
|
/** 视频格式 */
|
|
55
55
|
type: string
|
|
56
56
|
/** 视频长度 */
|
|
@@ -66,7 +66,7 @@ declare module '../../index' {
|
|
|
66
66
|
/** 视频码率,单位 kbps */
|
|
67
67
|
bitrate: number
|
|
68
68
|
}
|
|
69
|
-
interface
|
|
69
|
+
interface Orientation {
|
|
70
70
|
/** 默认 */
|
|
71
71
|
up
|
|
72
72
|
/** 180 度旋转 */
|
|
@@ -86,42 +86,63 @@ declare module '../../index' {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
/** VideoContext 实例,可通过 [Taro.createVideoContext](./createVideoContext) 获取。
|
|
90
|
+
*
|
|
91
|
+
* VideoContext 通过 id 跟一个 video 组件绑定,操作对应的 video 组件。
|
|
92
|
+
* @supported weapp, h5, rn
|
|
93
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.html
|
|
94
|
+
*/
|
|
89
95
|
interface VideoContext {
|
|
96
|
+
/** 退出后台音频播放模式。
|
|
97
|
+
* @supported weapp
|
|
98
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.exitBackgroundPlayback.html
|
|
99
|
+
*/
|
|
100
|
+
exitBackgroundPlayback(): void
|
|
90
101
|
/** 退出全屏
|
|
91
|
-
* @supported weapp, h5
|
|
102
|
+
* @supported weapp, h5, rn
|
|
92
103
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.exitFullScreen.html
|
|
93
104
|
*/
|
|
94
105
|
exitFullScreen(): void
|
|
106
|
+
/** 退出小窗,该方法可在任意页面调用
|
|
107
|
+
* @supported weapp
|
|
108
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.exitPictureInPicture.html
|
|
109
|
+
*/
|
|
110
|
+
exitPictureInPicture(option: VideoContext.ExitPictureInPictureOption): void
|
|
95
111
|
/** 隐藏状态栏,仅在iOS全屏下有效
|
|
96
112
|
* @supported weapp
|
|
97
113
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.hideStatusBar.html
|
|
98
114
|
*/
|
|
99
115
|
hideStatusBar(): void
|
|
100
116
|
/** 暂停视频
|
|
101
|
-
* @supported weapp, h5
|
|
117
|
+
* @supported weapp, h5, rn
|
|
102
118
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.pause.html
|
|
103
119
|
*/
|
|
104
120
|
pause(): void
|
|
105
121
|
/** 播放视频
|
|
106
|
-
* @supported weapp, h5
|
|
122
|
+
* @supported weapp, h5, rn
|
|
107
123
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.play.html
|
|
108
124
|
*/
|
|
109
125
|
play(): void
|
|
110
126
|
/** 设置倍速播放
|
|
111
|
-
* @supported weapp
|
|
127
|
+
* @supported weapp, h5, rn
|
|
112
128
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.playbackRate.html
|
|
113
129
|
*/
|
|
114
130
|
playbackRate(
|
|
115
131
|
/** 倍率,支持 0.5/0.8/1.0/1.25/1.5,2.6.3 起支持 2.0 倍速 */
|
|
116
132
|
rate: number,
|
|
117
133
|
): void
|
|
134
|
+
/** 进入后台音频播放模式。
|
|
135
|
+
* @supported weapp
|
|
136
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.requestBackgroundPlayback.html
|
|
137
|
+
*/
|
|
138
|
+
requestBackgroundPlayback(): void
|
|
118
139
|
/** 进入全屏
|
|
119
|
-
* @supported weapp, h5
|
|
140
|
+
* @supported weapp, h5, rn
|
|
120
141
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.requestFullScreen.html
|
|
121
142
|
*/
|
|
122
143
|
requestFullScreen(option: VideoContext.RequestFullScreenOption): void
|
|
123
144
|
/** 跳转到指定位置
|
|
124
|
-
* @supported weapp, h5
|
|
145
|
+
* @supported weapp, h5, rn
|
|
125
146
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.seek.html
|
|
126
147
|
*/
|
|
127
148
|
seek(
|
|
@@ -142,13 +163,21 @@ declare module '../../index' {
|
|
|
142
163
|
*/
|
|
143
164
|
showStatusBar(): void
|
|
144
165
|
/** 停止视频
|
|
145
|
-
* @supported weapp, h5
|
|
166
|
+
* @supported weapp, h5, rn
|
|
146
167
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.stop.html
|
|
147
168
|
*/
|
|
148
169
|
stop(): void
|
|
149
170
|
}
|
|
150
171
|
|
|
151
172
|
namespace VideoContext {
|
|
173
|
+
interface ExitPictureInPictureOption {
|
|
174
|
+
/** 接口调用成功的回调函数 */
|
|
175
|
+
success?: (result: TaroGeneral.CallbackResult) => void
|
|
176
|
+
/** 接口调用失败的回调函数 */
|
|
177
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
178
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
179
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
180
|
+
}
|
|
152
181
|
interface RequestFullScreenOption {
|
|
153
182
|
/** 设置全屏时视频的方向,不指定则根据宽高比自动判断。
|
|
154
183
|
*
|
|
@@ -172,7 +201,7 @@ declare module '../../index' {
|
|
|
172
201
|
/** 视频文件路径,可以是临时文件路径也可以是永久文件路径 */
|
|
173
202
|
src: string
|
|
174
203
|
/** 压缩质量 */
|
|
175
|
-
quality: keyof
|
|
204
|
+
quality: keyof Quality
|
|
176
205
|
/** 码率,单位 kbps */
|
|
177
206
|
bitrate: number
|
|
178
207
|
/** 帧率 */
|
|
@@ -192,7 +221,7 @@ declare module '../../index' {
|
|
|
192
221
|
/** 压缩后的大小,单位 kB */
|
|
193
222
|
size: number
|
|
194
223
|
}
|
|
195
|
-
interface
|
|
224
|
+
interface Quality {
|
|
196
225
|
/** 低 */
|
|
197
226
|
low
|
|
198
227
|
/** 中 */
|
|
@@ -205,7 +234,7 @@ declare module '../../index' {
|
|
|
205
234
|
namespace chooseVideo {
|
|
206
235
|
interface Option {
|
|
207
236
|
/** 默认拉起的是前置或者后置摄像头。部分 Android 手机下由于系统 ROM 不支持无法生效 */
|
|
208
|
-
camera?: keyof
|
|
237
|
+
camera?: keyof Camera
|
|
209
238
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
210
239
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
211
240
|
/** 是否压缩所选择的视频文件 */
|
|
@@ -233,7 +262,7 @@ declare module '../../index' {
|
|
|
233
262
|
/** 调用结果 */
|
|
234
263
|
errMsg: string
|
|
235
264
|
}
|
|
236
|
-
interface
|
|
265
|
+
interface Camera {
|
|
237
266
|
/** 默认拉起后置摄像头 */
|
|
238
267
|
back
|
|
239
268
|
/** 默认拉起前置摄像头 */
|
|
@@ -319,7 +348,7 @@ declare module '../../index' {
|
|
|
319
348
|
* @example
|
|
320
349
|
```tsx
|
|
321
350
|
* Taro.saveVideoToPhotosAlbum({
|
|
322
|
-
* filePath: 'wxfile://xxx'
|
|
351
|
+
* filePath: 'wxfile://xxx',
|
|
323
352
|
* success: function (res) {
|
|
324
353
|
* console.log(res.errMsg)
|
|
325
354
|
* }
|
|
@@ -370,7 +399,7 @@ declare module '../../index' {
|
|
|
370
399
|
getVideoInfo(option: getVideoInfo.Option): Promise<getVideoInfo.SuccessCallbackResult>
|
|
371
400
|
|
|
372
401
|
/** 创建 video 上下文 VideoContext 对象。
|
|
373
|
-
* @supported weapp, h5
|
|
402
|
+
* @supported weapp, h5, rn
|
|
374
403
|
* @example
|
|
375
404
|
* ```tsx
|
|
376
405
|
* videoContext = Taro.createVideoContext('myVideo')
|
|
@@ -385,7 +414,7 @@ declare module '../../index' {
|
|
|
385
414
|
): VideoContext
|
|
386
415
|
|
|
387
416
|
/** 压缩视频接口。
|
|
388
|
-
* 开发者可指定压缩质量 `quality` 进行压缩。当需要更精细的控制时,可指定 `bitrate`、`fps`、和 `resolution`,当 `quality` 传入时,这三个参数将被忽略。原视频的相关信息可通过 [getVideoInfo](
|
|
417
|
+
* 开发者可指定压缩质量 `quality` 进行压缩。当需要更精细的控制时,可指定 `bitrate`、`fps`、和 `resolution`,当 `quality` 传入时,这三个参数将被忽略。原视频的相关信息可通过 [getVideoInfo](/docs/apis/media/video/getVideoInfo) 获取。
|
|
389
418
|
* @supported weapp
|
|
390
419
|
* @example
|
|
391
420
|
* ```tsx
|
|
@@ -413,7 +442,7 @@ declare module '../../index' {
|
|
|
413
442
|
* ```
|
|
414
443
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.compressVideo.html
|
|
415
444
|
*/
|
|
416
|
-
|
|
445
|
+
compressVideo(option: compressVideo.Option): Promise<compressVideo.SuccessCallbackResult>
|
|
417
446
|
|
|
418
447
|
/** 拍摄视频或从手机相册中选视频。
|
|
419
448
|
* @supported weapp, rn
|
|
@@ -433,7 +462,7 @@ declare module '../../index' {
|
|
|
433
462
|
chooseVideo(option: chooseVideo.Option): Promise<chooseVideo.SuccessCallbackResult>
|
|
434
463
|
|
|
435
464
|
/** 拍摄或从手机相册中选择图片或视频。
|
|
436
|
-
* @supported weapp
|
|
465
|
+
* @supported weapp
|
|
437
466
|
* @example
|
|
438
467
|
* ```tsx
|
|
439
468
|
* Taro.chooseMedia({
|