@spcsn/taro 0.1.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/README.md +12 -0
- package/dist/index.js +147 -0
- package/dist/index.js.map +1 -0
- package/index.js +9 -0
- package/package.json +86 -0
- package/types/api/ad/index.d.ts +197 -0
- package/types/api/ai/face.d.ts +133 -0
- package/types/api/ai/inference.d.ts +129 -0
- package/types/api/ai/visionkit.d.ts +874 -0
- package/types/api/alipay/index.d.ts +69 -0
- package/types/api/base/crypto.d.ts +104 -0
- package/types/api/base/debug.d.ts +329 -0
- package/types/api/base/env.d.ts +19 -0
- package/types/api/base/index.d.ts +102 -0
- package/types/api/base/performance.d.ts +258 -0
- package/types/api/base/system.d.ts +742 -0
- package/types/api/base/update.d.ts +130 -0
- package/types/api/base/weapp/app-event.d.ts +265 -0
- package/types/api/base/weapp/life-cycle.d.ts +155 -0
- package/types/api/canvas/index.d.ts +2162 -0
- package/types/api/cloud/index.d.ts +2622 -0
- package/types/api/data-analysis/index.d.ts +122 -0
- package/types/api/device/accelerometer.d.ts +102 -0
- package/types/api/device/accessibility.d.ts +26 -0
- package/types/api/device/battery.d.ts +46 -0
- package/types/api/device/bluetooth-ble.d.ts +601 -0
- package/types/api/device/bluetooth-peripheral.d.ts +430 -0
- package/types/api/device/bluetooth.d.ts +463 -0
- package/types/api/device/calendar.d.ts +98 -0
- package/types/api/device/clipboard.d.ts +81 -0
- package/types/api/device/compass.d.ts +105 -0
- package/types/api/device/contact.d.ts +110 -0
- package/types/api/device/gyroscope.d.ts +85 -0
- package/types/api/device/iBeacon.d.ts +168 -0
- package/types/api/device/keyboard.d.ts +97 -0
- package/types/api/device/memory.d.ts +52 -0
- package/types/api/device/motion.d.ts +88 -0
- package/types/api/device/network.d.ts +172 -0
- package/types/api/device/nfc.d.ts +1238 -0
- package/types/api/device/phone.d.ts +30 -0
- package/types/api/device/scan.d.ts +111 -0
- package/types/api/device/screen.d.ts +217 -0
- package/types/api/device/sms.d.ts +26 -0
- package/types/api/device/vibrate.d.ts +51 -0
- package/types/api/device/wifi.d.ts +301 -0
- package/types/api/ext/index.d.ts +64 -0
- package/types/api/files/index.d.ts +1472 -0
- package/types/api/framework/index.d.ts +51 -0
- package/types/api/location/index.d.ts +517 -0
- package/types/api/media/audio.d.ts +1013 -0
- package/types/api/media/background-audio.d.ts +291 -0
- package/types/api/media/camera.d.ts +207 -0
- package/types/api/media/editor.d.ts +239 -0
- package/types/api/media/image.d.ts +469 -0
- package/types/api/media/live.d.ts +461 -0
- package/types/api/media/map.d.ts +638 -0
- package/types/api/media/media-recorder.d.ts +117 -0
- package/types/api/media/recorder.d.ts +317 -0
- package/types/api/media/video-decoder.d.ts +117 -0
- package/types/api/media/video-processing.d.ts +84 -0
- package/types/api/media/video.d.ts +527 -0
- package/types/api/media/voip.d.ts +393 -0
- package/types/api/navigate/index.d.ts +327 -0
- package/types/api/network/download.d.ts +173 -0
- package/types/api/network/mdns.d.ts +191 -0
- package/types/api/network/request.d.ts +480 -0
- package/types/api/network/tcp.d.ts +181 -0
- package/types/api/network/udp.d.ts +218 -0
- package/types/api/network/upload.d.ts +201 -0
- package/types/api/network/websocket.d.ts +383 -0
- package/types/api/open-api/account.d.ts +51 -0
- package/types/api/open-api/address.d.ts +68 -0
- package/types/api/open-api/authorize.d.ts +80 -0
- package/types/api/open-api/card.d.ts +110 -0
- package/types/api/open-api/channels.d.ts +225 -0
- package/types/api/open-api/customer-service.d.ts +45 -0
- package/types/api/open-api/device-voip.d.ts +103 -0
- package/types/api/open-api/facial.d.ts +98 -0
- package/types/api/open-api/favorites.d.ts +101 -0
- package/types/api/open-api/group.d.ts +59 -0
- package/types/api/open-api/invoice.d.ts +87 -0
- package/types/api/open-api/license-plate.d.ts +27 -0
- package/types/api/open-api/login.d.ts +115 -0
- package/types/api/open-api/my-miniprogram.d.ts +28 -0
- package/types/api/open-api/privacy.d.ts +107 -0
- package/types/api/open-api/redpackage.d.ts +24 -0
- package/types/api/open-api/settings.d.ts +174 -0
- package/types/api/open-api/soter.d.ts +184 -0
- package/types/api/open-api/sticker.d.ts +83 -0
- package/types/api/open-api/subscribe-message.d.ts +305 -0
- package/types/api/open-api/user-info.d.ts +182 -0
- package/types/api/open-api/werun.d.ts +101 -0
- package/types/api/payment/index.d.ts +119 -0
- package/types/api/qq/index.d.ts +354 -0
- package/types/api/route/index.d.ts +324 -0
- package/types/api/share/index.d.ts +354 -0
- package/types/api/skyline/index.d.ts +345 -0
- package/types/api/storage/background-fetch.d.ts +131 -0
- package/types/api/storage/cache-manager.d.ts +249 -0
- package/types/api/storage/index.d.ts +405 -0
- package/types/api/swan/bookshelf.d.ts +307 -0
- package/types/api/swan/download-package.d.ts +80 -0
- package/types/api/swan/index.d.ts +251 -0
- package/types/api/swan/pay.d.ts +139 -0
- package/types/api/taro.extend.d.ts +233 -0
- package/types/api/taro.hooks.d.ts +148 -0
- package/types/api/ui/animation.d.ts +427 -0
- package/types/api/ui/background.d.ts +69 -0
- package/types/api/ui/custom-component.d.ts +23 -0
- package/types/api/ui/fonts.d.ts +77 -0
- package/types/api/ui/interaction.d.ts +281 -0
- package/types/api/ui/menu.d.ts +29 -0
- package/types/api/ui/navigation-bar.d.ts +130 -0
- package/types/api/ui/pull-down-refresh.d.ts +50 -0
- package/types/api/ui/scroll.d.ts +114 -0
- package/types/api/ui/sticky.d.ts +32 -0
- package/types/api/ui/tab-bar.d.ts +196 -0
- package/types/api/ui/window.d.ts +71 -0
- package/types/api/worker/index.d.ts +83 -0
- package/types/api/wxml/index.d.ts +540 -0
- package/types/compile/compiler.d.ts +32 -0
- package/types/compile/config/h5.d.ts +134 -0
- package/types/compile/config/harmony.d.ts +118 -0
- package/types/compile/config/index.d.ts +8 -0
- package/types/compile/config/manifest.d.ts +155 -0
- package/types/compile/config/mini.d.ts +118 -0
- package/types/compile/config/plugin.d.ts +34 -0
- package/types/compile/config/project.d.ts +338 -0
- package/types/compile/config/rn.d.ts +85 -0
- package/types/compile/config/util.d.ts +179 -0
- package/types/compile/hooks.d.ts +13 -0
- package/types/compile/index.d.ts +11 -0
- package/types/compile/viteCompilerContext.d.ts +167 -0
- package/types/global.d.ts +428 -0
- package/types/index.d.ts +190 -0
- package/types/taro.api.d.ts +130 -0
- package/types/taro.component.d.ts +168 -0
- package/types/taro.config.d.ts +712 -0
- package/types/taro.lifecycle.d.ts +220 -0
- package/types/taro.runtime.d.ts +9 -0
|
@@ -0,0 +1,527 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace saveVideoToPhotosAlbum {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 视频文件路径,可以是临时文件路径也可以是永久文件路径 */
|
|
7
|
+
filePath: string
|
|
8
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
9
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
10
|
+
/** 接口调用失败的回调函数 */
|
|
11
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
12
|
+
/** 接口调用成功的回调函数 */
|
|
13
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
namespace openVideoEditor {
|
|
18
|
+
interface Option {
|
|
19
|
+
/** 视频源的路径,只支持本地路径 */
|
|
20
|
+
filePath: string
|
|
21
|
+
/** 接口调用成功的回调函数 */
|
|
22
|
+
success?: (result: SuccessCallbackResult) => void
|
|
23
|
+
/** 接口调用失败的回调函数 */
|
|
24
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
25
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
26
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
27
|
+
}
|
|
28
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
29
|
+
/** 剪辑后生成的视频文件的时长,单位毫秒(ms) */
|
|
30
|
+
duration: number
|
|
31
|
+
/** 剪辑后生成的视频文件大小,单位字节数(byte) */
|
|
32
|
+
size: number
|
|
33
|
+
/** 编辑后生成的视频文件的临时路径 */
|
|
34
|
+
tempFilePath: string
|
|
35
|
+
/** 编辑后生成的缩略图文件的临时路径 */
|
|
36
|
+
tempThumbPath: string
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
namespace getVideoInfo {
|
|
41
|
+
interface Option {
|
|
42
|
+
/** 视频文件路径,可以是临时文件路径也可以是永久文件路径 */
|
|
43
|
+
src: string
|
|
44
|
+
/** 接口调用成功的回调函数 */
|
|
45
|
+
success?: (result: SuccessCallbackResult) => void
|
|
46
|
+
/** 接口调用失败的回调函数 */
|
|
47
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
48
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
49
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
50
|
+
}
|
|
51
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
52
|
+
/** 画面方向 */
|
|
53
|
+
orientation: keyof Orientation
|
|
54
|
+
/** 视频格式 */
|
|
55
|
+
type: string
|
|
56
|
+
/** 视频长度 */
|
|
57
|
+
duration: number
|
|
58
|
+
/** 视频大小,单位 kB */
|
|
59
|
+
size: number
|
|
60
|
+
/** 视频的长,单位 px */
|
|
61
|
+
height: number
|
|
62
|
+
/** 视频的宽,单位 px */
|
|
63
|
+
width: number
|
|
64
|
+
/** 视频帧率 */
|
|
65
|
+
fps: number
|
|
66
|
+
/** 视频码率,单位 kbps */
|
|
67
|
+
bitrate: number
|
|
68
|
+
}
|
|
69
|
+
interface Orientation {
|
|
70
|
+
/** 默认 */
|
|
71
|
+
up
|
|
72
|
+
/** 180 度旋转 */
|
|
73
|
+
down
|
|
74
|
+
/** 逆时针旋转 90 度 */
|
|
75
|
+
left
|
|
76
|
+
/** 顺时针旋转 90 度 */
|
|
77
|
+
right
|
|
78
|
+
/** 同 up,但水平翻转 */
|
|
79
|
+
'up-mirrored'
|
|
80
|
+
/** 同 down,但水平翻转 */
|
|
81
|
+
'down-mirrored'
|
|
82
|
+
/** 同 left,但垂直翻转 */
|
|
83
|
+
'left-mirrored'
|
|
84
|
+
/** 同 right,但垂直翻转 */
|
|
85
|
+
'right-mirrored'
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** VideoContext 实例,可通过 [Taro.createVideoContext](./createVideoContext) 获取。
|
|
90
|
+
*
|
|
91
|
+
* VideoContext 通过 id 跟一个 video 组件绑定,操作对应的 video 组件。
|
|
92
|
+
* @supported weapp, h5, rn, harmony_hybrid
|
|
93
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.html
|
|
94
|
+
*/
|
|
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
|
|
101
|
+
/** 退出全屏
|
|
102
|
+
* @supported weapp, h5, rn, harmony_hybrid
|
|
103
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.exitFullScreen.html
|
|
104
|
+
*/
|
|
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
|
|
111
|
+
/** 隐藏状态栏,仅在iOS全屏下有效
|
|
112
|
+
* @supported weapp
|
|
113
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.hideStatusBar.html
|
|
114
|
+
*/
|
|
115
|
+
hideStatusBar(): void
|
|
116
|
+
/** 暂停视频
|
|
117
|
+
* @supported weapp, h5, rn, harmony_hybrid
|
|
118
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.pause.html
|
|
119
|
+
*/
|
|
120
|
+
pause(): void
|
|
121
|
+
/** 播放视频
|
|
122
|
+
* @supported weapp, h5, rn, harmony_hybrid
|
|
123
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.play.html
|
|
124
|
+
*/
|
|
125
|
+
play(): void
|
|
126
|
+
/** 设置倍速播放
|
|
127
|
+
* @supported weapp, h5, rn, harmony_hybrid
|
|
128
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.playbackRate.html
|
|
129
|
+
*/
|
|
130
|
+
playbackRate(
|
|
131
|
+
/** 倍率,支持 0.5/0.8/1.0/1.25/1.5,2.6.3 起支持 2.0 倍速 */
|
|
132
|
+
rate: number,
|
|
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
|
|
139
|
+
/** 进入全屏
|
|
140
|
+
* @supported weapp, h5, rn, harmony_hybrid
|
|
141
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.requestFullScreen.html
|
|
142
|
+
*/
|
|
143
|
+
requestFullScreen(option: VideoContext.RequestFullScreenOption): void
|
|
144
|
+
/** 跳转到指定位置
|
|
145
|
+
* @supported weapp, h5, rn, harmony_hybrid
|
|
146
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.seek.html
|
|
147
|
+
*/
|
|
148
|
+
seek(
|
|
149
|
+
/** 跳转到的位置,单位 s */
|
|
150
|
+
position: number,
|
|
151
|
+
): void
|
|
152
|
+
/** 发送弹幕
|
|
153
|
+
* @supported weapp
|
|
154
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.sendDanmu.html
|
|
155
|
+
*/
|
|
156
|
+
sendDanmu(
|
|
157
|
+
/** 弹幕内容 */
|
|
158
|
+
data: VideoContext.Danmu,
|
|
159
|
+
): void
|
|
160
|
+
/** 显示状态栏,仅在iOS全屏下有效
|
|
161
|
+
* @supported weapp
|
|
162
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.showStatusBar.html
|
|
163
|
+
*/
|
|
164
|
+
showStatusBar(): void
|
|
165
|
+
/** 停止视频
|
|
166
|
+
* @supported weapp, h5, rn, harmony_hybrid
|
|
167
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.stop.html
|
|
168
|
+
*/
|
|
169
|
+
stop(): void
|
|
170
|
+
}
|
|
171
|
+
|
|
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
|
+
}
|
|
181
|
+
interface RequestFullScreenOption {
|
|
182
|
+
/** 设置全屏时视频的方向,不指定则根据宽高比自动判断。
|
|
183
|
+
*
|
|
184
|
+
* 可选值:
|
|
185
|
+
* - 0: 正常竖向;
|
|
186
|
+
* - 90: 屏幕逆时针90度;
|
|
187
|
+
* - -90: 屏幕顺时针90度; */
|
|
188
|
+
direction?: 0 | 90 | -90
|
|
189
|
+
}
|
|
190
|
+
/** 弹幕内容 */
|
|
191
|
+
interface Danmu {
|
|
192
|
+
/** 弹幕文字 */
|
|
193
|
+
text: string
|
|
194
|
+
/** 弹幕颜色 */
|
|
195
|
+
color?: string
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
namespace compressVideo {
|
|
200
|
+
interface Option {
|
|
201
|
+
/** 视频文件路径,可以是临时文件路径也可以是永久文件路径 */
|
|
202
|
+
src: string
|
|
203
|
+
/** 压缩质量 */
|
|
204
|
+
quality: keyof Quality
|
|
205
|
+
/** 码率,单位 kbps */
|
|
206
|
+
bitrate: number
|
|
207
|
+
/** 帧率 */
|
|
208
|
+
fps: number
|
|
209
|
+
/** 相对于原视频的分辨率比例,取值范围(0, 1] */
|
|
210
|
+
resolution: number
|
|
211
|
+
/** 接口调用成功的回调函数 */
|
|
212
|
+
success?: (result: SuccessCallbackResult) => void
|
|
213
|
+
/** 接口调用失败的回调函数 */
|
|
214
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
215
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
216
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
217
|
+
}
|
|
218
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
219
|
+
/** 压缩后的临时文件地址 */
|
|
220
|
+
tempFilePath: string
|
|
221
|
+
/** 压缩后的大小,单位 kB */
|
|
222
|
+
size: number
|
|
223
|
+
}
|
|
224
|
+
interface Quality {
|
|
225
|
+
/** 低 */
|
|
226
|
+
low
|
|
227
|
+
/** 中 */
|
|
228
|
+
medium
|
|
229
|
+
/** 高 */
|
|
230
|
+
high
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
namespace chooseVideo {
|
|
235
|
+
interface Option {
|
|
236
|
+
/** 默认拉起的是前置或者后置摄像头。部分 Android 手机下由于系统 ROM 不支持无法生效
|
|
237
|
+
* @default "back"
|
|
238
|
+
* @supported weapp, h5
|
|
239
|
+
*/
|
|
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>
|
|
256
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
257
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
258
|
+
/** 接口调用失败的回调函数 */
|
|
259
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
260
|
+
/** 接口调用成功的回调函数 */
|
|
261
|
+
success?: (result: SuccessCallbackResult) => void
|
|
262
|
+
}
|
|
263
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
264
|
+
/** 选定视频的临时文件路径 */
|
|
265
|
+
tempFilePath: string
|
|
266
|
+
/** 选定视频的时间长度 */
|
|
267
|
+
duration: number
|
|
268
|
+
/** 选定视频的数据量大小 */
|
|
269
|
+
size: number
|
|
270
|
+
/** 返回选定视频的高度 */
|
|
271
|
+
height: number
|
|
272
|
+
/** 返回选定视频的宽度 */
|
|
273
|
+
width: number
|
|
274
|
+
/** 调用结果 */
|
|
275
|
+
errMsg: string
|
|
276
|
+
}
|
|
277
|
+
interface Camera {
|
|
278
|
+
/** 默认拉起后置摄像头 */
|
|
279
|
+
back
|
|
280
|
+
/** 默认拉起前置摄像头 */
|
|
281
|
+
front
|
|
282
|
+
}
|
|
283
|
+
interface sourceType {
|
|
284
|
+
/** 从相册选择视频 */
|
|
285
|
+
album
|
|
286
|
+
/** 使用相机拍摄视频 */
|
|
287
|
+
camera
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
namespace chooseMedia {
|
|
292
|
+
interface Option {
|
|
293
|
+
/** 最多可以选择的文件个数
|
|
294
|
+
* @default 9
|
|
295
|
+
* @supported weapp, h5
|
|
296
|
+
*/
|
|
297
|
+
count?: number
|
|
298
|
+
/** 文件类型
|
|
299
|
+
* @default ['image', 'video']
|
|
300
|
+
* @supported weapp, h5
|
|
301
|
+
*/
|
|
302
|
+
mediaType?: Array<keyof mediaType>
|
|
303
|
+
/** 图片和视频选择的来源
|
|
304
|
+
* @default ['album', 'camera']
|
|
305
|
+
* @supported weapp, h5
|
|
306
|
+
*/
|
|
307
|
+
sourceType?: Array<keyof sourceType>
|
|
308
|
+
/** 拍摄视频最长拍摄时间,单位秒。时间范围为 3s 至 60s 之间
|
|
309
|
+
* @default 10
|
|
310
|
+
* @supported weapp
|
|
311
|
+
*/
|
|
312
|
+
maxDuration?: number
|
|
313
|
+
/** 是否压缩所选文件
|
|
314
|
+
* @default ['original', 'compressed']
|
|
315
|
+
* @supported weapp
|
|
316
|
+
*/
|
|
317
|
+
sizeType?: Array<'original' | 'compressed'>
|
|
318
|
+
/** 仅在 sourceType 为 camera 时生效,使用前置或后置摄像头
|
|
319
|
+
* @default "back"
|
|
320
|
+
* @supported weapp, h5
|
|
321
|
+
*/
|
|
322
|
+
camera?: string
|
|
323
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
324
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
325
|
+
/** 接口调用失败的回调函数 */
|
|
326
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
327
|
+
/** 接口调用成功的回调函数 */
|
|
328
|
+
success?: (result: SuccessCallbackResult) => void
|
|
329
|
+
/** 用来上传的input元素ID
|
|
330
|
+
* @supported h5
|
|
331
|
+
*/
|
|
332
|
+
mediaId?: string
|
|
333
|
+
}
|
|
334
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
335
|
+
/** 本地临时文件列表 */
|
|
336
|
+
tempFiles: ChooseMedia[]
|
|
337
|
+
/** 文件类型,有效值有 image 、video、mix */
|
|
338
|
+
type: string
|
|
339
|
+
}
|
|
340
|
+
/** 本地临时文件列表 */
|
|
341
|
+
interface ChooseMedia {
|
|
342
|
+
/** 本地临时文件路径 (本地路径) */
|
|
343
|
+
tempFilePath: string
|
|
344
|
+
/** 本地临时文件大小,单位 B */
|
|
345
|
+
size: number
|
|
346
|
+
/** 视频的时间长度 */
|
|
347
|
+
duration: number
|
|
348
|
+
/** 视频的高度 */
|
|
349
|
+
height: number
|
|
350
|
+
/** 视频的宽度 */
|
|
351
|
+
width: number
|
|
352
|
+
/** 视频缩略图临时文件路径 */
|
|
353
|
+
thumbTempFilePath: string
|
|
354
|
+
/** 选择的文件的类型 */
|
|
355
|
+
fileType: string
|
|
356
|
+
/** 原始的浏览器 File 对象
|
|
357
|
+
* @supported h5
|
|
358
|
+
*/
|
|
359
|
+
originalFileObj?: File
|
|
360
|
+
}
|
|
361
|
+
interface mediaType {
|
|
362
|
+
/** 只能拍摄视频或从相册选择视频 */
|
|
363
|
+
video
|
|
364
|
+
/** 只能拍摄图片或从相册选择图片 */
|
|
365
|
+
image
|
|
366
|
+
/** 可同时选择图片和视频 */
|
|
367
|
+
mix
|
|
368
|
+
}
|
|
369
|
+
interface sourceType {
|
|
370
|
+
/** 从相册选择 */
|
|
371
|
+
album
|
|
372
|
+
/** 使用相机拍摄 */
|
|
373
|
+
camera
|
|
374
|
+
}
|
|
375
|
+
interface camera {
|
|
376
|
+
/** 使用后置摄像头 */
|
|
377
|
+
back
|
|
378
|
+
/** 使用前置摄像头 */
|
|
379
|
+
front
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
interface TaroStatic {
|
|
384
|
+
/**
|
|
385
|
+
* 保存视频到系统相册。支持mp4视频格式。需要[用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) scope.writePhotosAlbum
|
|
386
|
+
*
|
|
387
|
+
* **Bug & Tip:**
|
|
388
|
+
*
|
|
389
|
+
* 1. `tip`: camera 参数在部分 Android 手机下由于系统 ROM 不支持无法生效
|
|
390
|
+
* @supported weapp, h5, rn
|
|
391
|
+
* @example
|
|
392
|
+
```tsx
|
|
393
|
+
* Taro.saveVideoToPhotosAlbum({
|
|
394
|
+
* filePath: 'file://xxx',
|
|
395
|
+
* success: function (res) {
|
|
396
|
+
* console.log(res.errMsg)
|
|
397
|
+
* }
|
|
398
|
+
* })
|
|
399
|
+
* ```
|
|
400
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.saveVideoToPhotosAlbum.html
|
|
401
|
+
*/
|
|
402
|
+
saveVideoToPhotosAlbum(option: saveVideoToPhotosAlbum.Option): Promise<TaroGeneral.CallbackResult>
|
|
403
|
+
|
|
404
|
+
/** 打开视频编辑器
|
|
405
|
+
* @supported weapp
|
|
406
|
+
* @example
|
|
407
|
+
* ```tsx
|
|
408
|
+
* Taro.openVideoEditor({
|
|
409
|
+
* filePath: ''
|
|
410
|
+
* })
|
|
411
|
+
* ```
|
|
412
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.openVideoEditor.html
|
|
413
|
+
*/
|
|
414
|
+
openVideoEditor(option: openVideoEditor.Option): Promise<openVideoEditor.SuccessCallbackResult>
|
|
415
|
+
|
|
416
|
+
/** 获取视频详细信息
|
|
417
|
+
* @supported weapp, harmony_hybrid
|
|
418
|
+
* @example
|
|
419
|
+
* ```tsx
|
|
420
|
+
* Taro.downloadFile({
|
|
421
|
+
* url: 'https://mock.taro.org/mock_video.mp4',
|
|
422
|
+
* success(res) {
|
|
423
|
+
* Taro.getVideoInfo({
|
|
424
|
+
* src: res.tempFilePath,
|
|
425
|
+
* success (res) {
|
|
426
|
+
* console.log('获取文件地址成功')
|
|
427
|
+
* console.log(res)
|
|
428
|
+
* },
|
|
429
|
+
* fail (res) {
|
|
430
|
+
* console.log('获取文件地址失败')
|
|
431
|
+
* console.log(res)
|
|
432
|
+
* },
|
|
433
|
+
* complete (res) {
|
|
434
|
+
* console.log('获取文件地址')
|
|
435
|
+
* }
|
|
436
|
+
* })
|
|
437
|
+
* }
|
|
438
|
+
* })
|
|
439
|
+
* ```
|
|
440
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.getVideoInfo.html
|
|
441
|
+
*/
|
|
442
|
+
getVideoInfo(option: getVideoInfo.Option): Promise<getVideoInfo.SuccessCallbackResult>
|
|
443
|
+
|
|
444
|
+
/** 创建 video 上下文 VideoContext 对象。
|
|
445
|
+
* @supported weapp, h5, rn, harmony_hybrid, harmony
|
|
446
|
+
* @example
|
|
447
|
+
* ```tsx
|
|
448
|
+
* videoContext = Taro.createVideoContext('myVideo')
|
|
449
|
+
* ```
|
|
450
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.createVideoContext.html
|
|
451
|
+
*/
|
|
452
|
+
createVideoContext(
|
|
453
|
+
/** video 组件的 id */
|
|
454
|
+
id: string,
|
|
455
|
+
/** 在自定义组件下,当前组件实例的this,以操作组件内 video 组件 */
|
|
456
|
+
component?: TaroGeneral.IAnyObject,
|
|
457
|
+
): VideoContext
|
|
458
|
+
|
|
459
|
+
/** 压缩视频接口。
|
|
460
|
+
* 开发者可指定压缩质量 `quality` 进行压缩。当需要更精细的控制时,可指定 `bitrate`、`fps`、和 `resolution`,当 `quality` 传入时,这三个参数将被忽略。原视频的相关信息可通过 [getVideoInfo](/docs/apis/media/video/getVideoInfo) 获取。
|
|
461
|
+
* @supported weapp
|
|
462
|
+
* @example
|
|
463
|
+
* ```tsx
|
|
464
|
+
* Taro.chooseVideo({
|
|
465
|
+
* sourceType: ['album', 'camera'],
|
|
466
|
+
* maxDuration: 60,
|
|
467
|
+
* camera: 'back',
|
|
468
|
+
* compressed: false,
|
|
469
|
+
* success (res) {
|
|
470
|
+
* Taro.compressVideo({
|
|
471
|
+
* src: res.tempFilePath,
|
|
472
|
+
* quality: quality,
|
|
473
|
+
* bitrate: 1032,
|
|
474
|
+
* fps: 24,
|
|
475
|
+
* resolution:0.5,
|
|
476
|
+
* success (res) {
|
|
477
|
+
* console.log("压缩成功")
|
|
478
|
+
* },
|
|
479
|
+
* fail (err) {
|
|
480
|
+
* console.log("压缩失败")
|
|
481
|
+
* }
|
|
482
|
+
* })
|
|
483
|
+
* }
|
|
484
|
+
* })
|
|
485
|
+
* ```
|
|
486
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.compressVideo.html
|
|
487
|
+
*/
|
|
488
|
+
compressVideo(option: compressVideo.Option): Promise<compressVideo.SuccessCallbackResult>
|
|
489
|
+
|
|
490
|
+
/** 拍摄视频或从手机相册中选视频。
|
|
491
|
+
* @supported weapp, h5, rn
|
|
492
|
+
* @example
|
|
493
|
+
* ```tsx
|
|
494
|
+
* Taro.chooseVideo({
|
|
495
|
+
* sourceType: ['album','camera'],
|
|
496
|
+
* maxDuration: 60,
|
|
497
|
+
* camera: 'back',
|
|
498
|
+
* success: function (res) {
|
|
499
|
+
* console.log(res.tempFilePath)
|
|
500
|
+
* }
|
|
501
|
+
* })
|
|
502
|
+
* ```
|
|
503
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseVideo.html
|
|
504
|
+
*/
|
|
505
|
+
chooseVideo(option: chooseVideo.Option): Promise<chooseVideo.SuccessCallbackResult>
|
|
506
|
+
|
|
507
|
+
/** 拍摄或从手机相册中选择图片或视频。
|
|
508
|
+
* @supported weapp, h5, harmony_hybrid, harmony
|
|
509
|
+
* @example
|
|
510
|
+
* ```tsx
|
|
511
|
+
* Taro.chooseMedia({
|
|
512
|
+
* count: 9,
|
|
513
|
+
* mediaType: ['image','video'],
|
|
514
|
+
* sourceType: ['album', 'camera'],
|
|
515
|
+
* maxDuration: 30,
|
|
516
|
+
* camera: 'back',
|
|
517
|
+
* success: (res) => {
|
|
518
|
+
* console.log(res.tempFiles)
|
|
519
|
+
* console.log(res.type)
|
|
520
|
+
* }
|
|
521
|
+
* })
|
|
522
|
+
* ```
|
|
523
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseMedia.html
|
|
524
|
+
*/
|
|
525
|
+
chooseMedia(option: chooseMedia.Option): Promise<chooseMedia.SuccessCallbackResult>
|
|
526
|
+
}
|
|
527
|
+
}
|