@dcloudio/uni-app-x 0.7.11 → 0.7.13

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 (238) hide show
  1. package/.prettierrc +5 -0
  2. package/README.md +1 -1
  3. package/index.d.ts +1 -1
  4. package/options.d.ts +9 -9
  5. package/package.json +27 -27
  6. package/types/app.d.ts +843 -843
  7. package/types/index.d.ts +7 -7
  8. package/types/native/AsyncApiResult.d.ts +7 -7
  9. package/types/native/CSSStyleDeclaration.d.ts +25 -25
  10. package/types/native/DOMRect.d.ts +56 -56
  11. package/types/native/DrawableContext.d.ts +162 -162
  12. package/types/native/INavigationBar.d.ts +22 -22
  13. package/types/native/IUniElement.d.ts +760 -777
  14. package/types/native/IUniError.d.ts +20 -20
  15. package/types/native/IUniForm.d.ts +9 -9
  16. package/types/native/NativeLoadFontFaceOptions.d.ts +11 -11
  17. package/types/native/NodeData.d.ts +22 -22
  18. package/types/native/PageNode.d.ts +6 -6
  19. package/types/native/SnapshotOptions.d.ts +63 -63
  20. package/types/native/SourceError.d.ts +46 -46
  21. package/types/native/UTSAndroidHookProxy.d.ts +14 -14
  22. package/types/native/UniAggregateError.d.ts +19 -19
  23. package/types/native/UniApp.d.ts +79 -66
  24. package/types/native/UniCallbackWrapper.d.ts +7 -7
  25. package/types/native/UniCustomEvent.d.ts +24 -24
  26. package/types/native/UniDocument.d.ts +83 -35
  27. package/types/native/UniElement.d.ts +74 -74
  28. package/types/native/UniError.d.ts +70 -70
  29. package/types/native/UniEvent.d.ts +62 -62
  30. package/types/native/UniFormControl.d.ts +8 -8
  31. package/types/native/UniFormControlElement.d.ts +14 -14
  32. package/types/native/UniImageErrorEvent.d.ts +33 -33
  33. package/types/native/UniImageLoadEvent.d.ts +37 -37
  34. package/types/native/UniInputBlurEvent.d.ts +36 -36
  35. package/types/native/UniInputConfirmEvent.d.ts +30 -30
  36. package/types/native/UniInputEvent.d.ts +38 -38
  37. package/types/native/UniInputFocusEvent.d.ts +53 -48
  38. package/types/native/UniNativePage.d.ts +219 -156
  39. package/types/native/UniNestedPreScrollEvent.d.ts +3 -4
  40. package/types/native/UniPageEvent.d.ts +10 -10
  41. package/types/native/UniPageManager.d.ts +17 -17
  42. package/types/native/UniPageScrollEvent.d.ts +13 -13
  43. package/types/native/UniPointerEvent.d.ts +74 -74
  44. package/types/native/UniRefresherEvent.d.ts +18 -18
  45. package/types/native/UniResizeEvent.d.ts +34 -34
  46. package/types/native/UniResizeObserver.d.ts +184 -0
  47. package/types/native/UniRichTextItemClickEvent.d.ts +41 -41
  48. package/types/native/UniScrollEvent.d.ts +42 -42
  49. package/types/native/UniScrollToLowerEvent.d.ts +23 -23
  50. package/types/native/UniScrollToUpperEvent.d.ts +23 -23
  51. package/types/native/UniStartNestedScrollEvent.d.ts +33 -33
  52. package/types/native/UniStopNestedScrollEvent.d.ts +28 -28
  53. package/types/native/UniSwiperAnimationFinishEvent.d.ts +22 -22
  54. package/types/native/UniSwiperChangeEvent.d.ts +22 -22
  55. package/types/native/UniSwiperTransitionEvent.d.ts +24 -24
  56. package/types/native/UniTabTapEvent.d.ts +18 -18
  57. package/types/native/UniTabsElement.d.ts +59 -29
  58. package/types/native/UniTextElement.d.ts +34 -17
  59. package/types/native/UniTextareaFocusEvent.d.ts +54 -49
  60. package/types/native/UniTouchEvent.d.ts +64 -64
  61. package/types/native/UniVideoElement.d.ts +70 -70
  62. package/types/native/UniWebViewDownloadEvent.d.ts +52 -52
  63. package/types/native/UniWebViewElement.d.ts +10 -10
  64. package/types/native/UniWebViewErrorEvent.d.ts +59 -47
  65. package/types/native/UniWebViewLoadEvent.d.ts +41 -36
  66. package/types/native/UniWebViewLoadingEvent.d.ts +41 -36
  67. package/types/native/UniWebViewMessageEvent.d.ts +36 -36
  68. package/types/native/UniWebViewServiceMessageEvent.d.ts +8 -8
  69. package/types/native/ViewToTempFilePathOptions.d.ts +47 -47
  70. package/types/native/WebViewStyles.d.ts +20 -20
  71. package/types/native/global.d.ts +530 -519
  72. package/types/native/index.d.ts +66 -65
  73. package/types/native-global/index.d.ts +1 -1
  74. package/types/page.d.ts +1593 -1593
  75. package/types/process.d.ts +5 -5
  76. package/types/uni/base/index.d.ts +3 -3
  77. package/types/uni/env/index.d.ts +64 -64
  78. package/types/uni/global.d.ts +5 -6
  79. package/types/uni/index.d.ts +2 -3
  80. package/types/uni/uts-plugin-api/global.d.ts +35 -23
  81. package/types/uni/uts-plugin-api/index.d.ts +35 -23
  82. package/types/uni/uts-plugin-api/lib/uni-createRequestPermissionListener/utssdk/global.d.ts +18 -18
  83. package/types/uni/uts-plugin-api/lib/uni-createRequestPermissionListener/utssdk/index.d.ts +8 -8
  84. package/types/uni/uts-plugin-api/lib/uni-createRequestPermissionListener/utssdk/interface.d.ts +43 -43
  85. package/types/uni/{core/lib/ui/create-selector-query → uts-plugin-api/lib/uni-createSelectorQuery/utssdk}/global.d.ts +20 -20
  86. package/types/uni/{core/lib/ui/create-selector-query → uts-plugin-api/lib/uni-createSelectorQuery/utssdk}/index.d.ts +9 -9
  87. package/types/uni/uts-plugin-api/lib/uni-createSelectorQuery/utssdk/interface.d.ts +412 -0
  88. package/types/uni/uts-plugin-api/lib/uni-createWebviewContext/utssdk/global.d.ts +12 -12
  89. package/types/uni/uts-plugin-api/lib/uni-createWebviewContext/utssdk/index.d.ts +5 -5
  90. package/types/uni/uts-plugin-api/lib/uni-createWebviewContext/utssdk/interface.d.ts +129 -99
  91. package/types/uni/{core/lib/base/event → uts-plugin-api/lib/uni-event/utssdk}/global.d.ts +16 -16
  92. package/types/uni/{core/lib/base/event → uts-plugin-api/lib/uni-event/utssdk}/index.d.ts +7 -7
  93. package/types/uni/uts-plugin-api/lib/uni-event/utssdk/interface.d.ts +277 -0
  94. package/types/uni/uts-plugin-api/lib/uni-exit/utssdk/global.d.ts +26 -26
  95. package/types/uni/uts-plugin-api/lib/uni-exit/utssdk/index.d.ts +12 -12
  96. package/types/uni/uts-plugin-api/lib/uni-exit/utssdk/interface.d.ts +82 -82
  97. package/types/uni/uts-plugin-api/lib/uni-fileSystemManager/utssdk/global.d.ts +136 -66
  98. package/types/uni/uts-plugin-api/lib/uni-fileSystemManager/utssdk/index.d.ts +67 -32
  99. package/types/uni/uts-plugin-api/lib/uni-fileSystemManager/utssdk/interface.d.ts +1784 -423
  100. package/types/uni/uts-plugin-api/lib/uni-getAccessibilityInfo/utssdk/global.d.ts +10 -10
  101. package/types/uni/uts-plugin-api/lib/uni-getAccessibilityInfo/utssdk/index.d.ts +4 -4
  102. package/types/uni/uts-plugin-api/lib/uni-getAppAuthorizeSetting/utssdk/global.d.ts +12 -12
  103. package/types/uni/uts-plugin-api/lib/uni-getAppAuthorizeSetting/utssdk/index.d.ts +5 -5
  104. package/types/uni/uts-plugin-api/lib/uni-getAppAuthorizeSetting/utssdk/interface.d.ts +116 -112
  105. package/types/uni/uts-plugin-api/lib/uni-getAppBaseInfo/utssdk/global.d.ts +14 -14
  106. package/types/uni/uts-plugin-api/lib/uni-getAppBaseInfo/utssdk/index.d.ts +6 -6
  107. package/types/uni/uts-plugin-api/lib/uni-getAppBaseInfo/utssdk/interface.d.ts +398 -350
  108. package/types/uni/uts-plugin-api/lib/uni-getDeviceInfo/utssdk/global.d.ts +14 -14
  109. package/types/uni/uts-plugin-api/lib/uni-getDeviceInfo/utssdk/index.d.ts +6 -6
  110. package/types/uni/uts-plugin-api/lib/uni-getDeviceInfo/utssdk/interface.d.ts +2 -2
  111. package/types/uni/{core/lib/ui/get-element-by-id → uts-plugin-api/lib/uni-getElementById/utssdk}/global.d.ts +10 -10
  112. package/types/uni/{core/lib/ui/get-element-by-id → uts-plugin-api/lib/uni-getElementById/utssdk}/index.d.ts +4 -4
  113. package/types/uni/uts-plugin-api/lib/uni-getElementById/utssdk/interface.d.ts +73 -0
  114. package/types/uni/{core/lib/lifecycle → uts-plugin-api/lib/uni-getLaunchOptionsSync/utssdk}/global.d.ts +12 -10
  115. package/types/uni/{core/lib/lifecycle → uts-plugin-api/lib/uni-getLaunchOptionsSync/utssdk}/index.d.ts +5 -4
  116. package/types/uni/uts-plugin-api/lib/uni-getLaunchOptionsSync/utssdk/interface.d.ts +39 -0
  117. package/types/uni/uts-plugin-api/lib/uni-getLocation-system/utssdk/global.d.ts +20 -20
  118. package/types/uni/uts-plugin-api/lib/uni-getLocation-system/utssdk/index.d.ts +9 -9
  119. package/types/uni/uts-plugin-api/lib/uni-getLocation-system/utssdk/interface.d.ts +151 -151
  120. package/types/uni/uts-plugin-api/lib/uni-getNetworkType/utssdk/global.d.ts +24 -24
  121. package/types/uni/uts-plugin-api/lib/uni-getNetworkType/utssdk/index.d.ts +11 -11
  122. package/types/uni/uts-plugin-api/lib/uni-getNetworkType/utssdk/interface.d.ts +1 -1
  123. package/types/uni/{core/lib/performance → uts-plugin-api/lib/uni-getPerformance/utssdk}/global.d.ts +22 -22
  124. package/types/uni/{core/lib/performance → uts-plugin-api/lib/uni-getPerformance/utssdk}/index.d.ts +10 -10
  125. package/types/uni/uts-plugin-api/lib/uni-getPerformance/utssdk/interface.d.ts +157 -0
  126. package/types/uni/uts-plugin-api/lib/uni-getProvider/utssdk/global.d.ts +24 -24
  127. package/types/uni/uts-plugin-api/lib/uni-getProvider/utssdk/index.d.ts +11 -11
  128. package/types/uni/uts-plugin-api/lib/uni-getProvider/utssdk/interface.d.ts +84 -88
  129. package/types/uni/uts-plugin-api/lib/uni-getSystemInfo/utssdk/global.d.ts +30 -30
  130. package/types/uni/uts-plugin-api/lib/uni-getSystemInfo/utssdk/index.d.ts +14 -14
  131. package/types/uni/uts-plugin-api/lib/uni-getSystemInfo/utssdk/interface.d.ts +35 -35
  132. package/types/uni/uts-plugin-api/lib/uni-getSystemSetting/utssdk/global.d.ts +12 -12
  133. package/types/uni/uts-plugin-api/lib/uni-getSystemSetting/utssdk/index.d.ts +5 -5
  134. package/types/uni/uts-plugin-api/lib/uni-getSystemSetting/utssdk/interface.d.ts +2 -2
  135. package/types/uni/uts-plugin-api/lib/uni-installApk/utssdk/global.d.ts +24 -24
  136. package/types/uni/uts-plugin-api/lib/uni-installApk/utssdk/index.d.ts +11 -11
  137. package/types/uni/{core/lib/base/interceptor → uts-plugin-api/lib/uni-interceptor/utssdk}/global.d.ts +16 -18
  138. package/types/uni/{core/lib/base/interceptor → uts-plugin-api/lib/uni-interceptor/utssdk}/index.d.ts +7 -8
  139. package/types/uni/uts-plugin-api/lib/uni-interceptor/utssdk/interface.d.ts +152 -0
  140. package/types/uni/{core/lib/ui/load-font-face → uts-plugin-api/lib/uni-loadFontFace/utssdk}/global.d.ts +26 -26
  141. package/types/uni/{core/lib/ui/load-font-face → uts-plugin-api/lib/uni-loadFontFace/utssdk}/index.d.ts +12 -12
  142. package/types/uni/uts-plugin-api/lib/uni-loadFontFace/utssdk/interface.d.ts +557 -0
  143. package/types/uni/uts-plugin-api/lib/uni-media/utssdk/global.d.ts +158 -158
  144. package/types/uni/uts-plugin-api/lib/uni-media/utssdk/index.d.ts +78 -78
  145. package/types/uni/uts-plugin-api/lib/uni-media/utssdk/interface.d.ts +926 -906
  146. package/types/uni/{core/lib/ui/set-navigation-bar-color → uts-plugin-api/lib/uni-navigationBar/utssdk}/global.d.ts +44 -28
  147. package/types/uni/{core/lib/ui/set-navigation-bar-color → uts-plugin-api/lib/uni-navigationBar/utssdk}/index.d.ts +21 -13
  148. package/types/uni/uts-plugin-api/lib/uni-navigationBar/utssdk/interface.d.ts +794 -0
  149. package/types/uni/uts-plugin-api/lib/uni-network/utssdk/app-ios/global.d.ts +78 -68
  150. package/types/uni/uts-plugin-api/lib/uni-network/utssdk/app-ios/index.d.ts +38 -33
  151. package/types/uni/uts-plugin-api/lib/uni-network/utssdk/app-ios/interface.d.ts +110 -41
  152. package/types/uni/uts-plugin-api/lib/uni-network/utssdk/global.d.ts +72 -72
  153. package/types/uni/uts-plugin-api/lib/uni-network/utssdk/index.d.ts +35 -35
  154. package/types/uni/uts-plugin-api/lib/uni-network/utssdk/interface.d.ts +48 -31
  155. package/types/uni/uts-plugin-api/lib/uni-openAppAuthorizeSetting/utssdk/global.d.ts +24 -24
  156. package/types/uni/uts-plugin-api/lib/uni-openAppAuthorizeSetting/utssdk/index.d.ts +11 -11
  157. package/types/uni/uts-plugin-api/lib/uni-openAppAuthorizeSetting/utssdk/interface.d.ts +2 -2
  158. package/types/uni/{core/lib/ui/page-scroll-to → uts-plugin-api/lib/uni-pageScrollTo/utssdk}/global.d.ts +24 -26
  159. package/types/uni/{core/lib/ui/page-scroll-to → uts-plugin-api/lib/uni-pageScrollTo/utssdk}/index.d.ts +11 -12
  160. package/types/uni/uts-plugin-api/lib/uni-pageScrollTo/utssdk/interface.d.ts +143 -0
  161. package/types/uni/uts-plugin-api/lib/uni-payment/utssdk/global.d.ts +32 -30
  162. package/types/uni/uts-plugin-api/lib/uni-payment/utssdk/index.d.ts +15 -14
  163. package/types/uni/uts-plugin-api/lib/uni-payment/utssdk/interface.d.ts +2 -1
  164. package/types/uni/uts-plugin-api/lib/uni-prompt/utssdk/global.d.ts +74 -74
  165. package/types/uni/uts-plugin-api/lib/uni-prompt/utssdk/index.d.ts +36 -36
  166. package/types/uni/uts-plugin-api/lib/uni-prompt/utssdk/interface.d.ts +45 -45
  167. package/types/uni/{core/lib/ui/pull-down-refresh → uts-plugin-api/lib/uni-pullDownRefresh/utssdk}/global.d.ts +26 -28
  168. package/types/uni/{core/lib/ui/pull-down-refresh → uts-plugin-api/lib/uni-pullDownRefresh/utssdk}/index.d.ts +12 -13
  169. package/types/uni/uts-plugin-api/lib/uni-pullDownRefresh/utssdk/interface.d.ts +174 -0
  170. package/types/uni/{core/lib/route → uts-plugin-api/lib/uni-route/utssdk}/global.d.ts +58 -68
  171. package/types/uni/{core/lib/route → uts-plugin-api/lib/uni-route/utssdk}/index.d.ts +28 -33
  172. package/types/uni/uts-plugin-api/lib/uni-route/utssdk/interface.d.ts +2020 -0
  173. package/types/uni/uts-plugin-api/lib/uni-rpx2px/utssdk/global.d.ts +10 -10
  174. package/types/uni/uts-plugin-api/lib/uni-rpx2px/utssdk/index.d.ts +4 -4
  175. package/types/uni/uts-plugin-api/lib/uni-rpx2px/utssdk/interface.d.ts +33 -33
  176. package/types/uni/uts-plugin-api/lib/uni-storage/utssdk/global.d.ts +78 -78
  177. package/types/uni/uts-plugin-api/lib/uni-storage/utssdk/index.d.ts +38 -38
  178. package/types/uni/uts-plugin-api/lib/uni-storage/utssdk/interface.d.ts +531 -531
  179. package/types/uni/{core/lib/ui/tab-bar → uts-plugin-api/lib/uni-tabBar/utssdk}/global.d.ts +132 -130
  180. package/types/uni/{core/lib/ui/tab-bar → uts-plugin-api/lib/uni-tabBar/utssdk}/index.d.ts +65 -64
  181. package/types/uni/uts-plugin-api/lib/uni-tabBar/utssdk/interface.d.ts +926 -0
  182. package/types/uni/uts-plugin-api/lib/uni-websocket/utssdk/global.d.ts +58 -58
  183. package/types/uni/uts-plugin-api/lib/uni-websocket/utssdk/index.d.ts +28 -28
  184. package/types/uni/uts-plugin-api/lib/uni-websocket/utssdk/interface.d.ts +78 -78
  185. package/types/uni/uts-plugin-biz/global.d.ts +4 -4
  186. package/types/uni/uts-plugin-biz/index.d.ts +4 -4
  187. package/types/uni/uts-plugin-biz/lib/uni-ad/utssdk/global.d.ts +36 -36
  188. package/types/uni/uts-plugin-biz/lib/uni-ad/utssdk/index.d.ts +17 -17
  189. package/types/uni/uts-plugin-biz/lib/uni-ad/utssdk/interface.d.ts +132 -132
  190. package/types/uni/uts-plugin-biz/lib/uni-facialRecognitionVerify/utssdk/global.d.ts +28 -28
  191. package/types/uni/uts-plugin-biz/lib/uni-facialRecognitionVerify/utssdk/index.d.ts +13 -13
  192. package/types/uni/uts-plugin-biz/lib/uni-facialRecognitionVerify/utssdk/interface.d.ts +141 -141
  193. package/types/uni/uts-plugin-biz/lib/uni-push/utssdk/global.d.ts +56 -56
  194. package/types/uni/uts-plugin-biz/lib/uni-push/utssdk/index.d.ts +27 -27
  195. package/types/uni/uts-plugin-biz/lib/uni-verify/utssdk/global.d.ts +46 -46
  196. package/types/uni/uts-plugin-biz/lib/uni-verify/utssdk/index.d.ts +22 -22
  197. package/types/uni/uts-plugin-biz/lib/uni-verify/utssdk/interface.d.ts +203 -203
  198. package/types/uni/uts-plugin-component/global.d.ts +1 -1
  199. package/types/uni/uts-plugin-component/index.d.ts +1 -1
  200. package/types/uni/uts-plugin-component/lib/uni-video/utssdk/global.d.ts +64 -64
  201. package/types/uni/uts-plugin-component/lib/uni-video/utssdk/index.d.ts +31 -31
  202. package/types/uni/uts-plugin-component/lib/uni-video/utssdk/interface.d.ts +404 -354
  203. package/types/uni-cloud/index.d.ts +59 -59
  204. package/types/uni-cloud/interface.d.ts +848 -801
  205. package/types/uni-cloud/unicloud-db/index.d.ts +81 -0
  206. package/types/uni-cloud/unicloud-db/index.ts +313 -313
  207. package/types/uni-global/index.d.ts +1 -1
  208. package/types/vue/CheckboxGroupChangeEvent.d.ts +36 -36
  209. package/types/vue/LifeCycle.d.ts +55 -55
  210. package/types/vue/PickerViewChangeEvent.d.ts +36 -36
  211. package/types/vue/ProgressActiveendEvent.d.ts +30 -30
  212. package/types/vue/RadioGroupChangeEvent.d.ts +36 -36
  213. package/types/vue/SliderChangeEvent.d.ts +32 -32
  214. package/types/vue/SwitchChangeEvent.d.ts +30 -30
  215. package/types/vue/UniCanvasElement.d.ts +270 -270
  216. package/types/vue/UniCloudDBElement.d.ts +215 -215
  217. package/types/vue/UniFormElement.d.ts +51 -51
  218. package/types/vue/UniNavigatorElement.d.ts +7 -7
  219. package/types/vue/index.d.ts +11 -11
  220. package/uts-plugin.d.ts +27 -26
  221. package/types/uni/core/global.d.ts +0 -13
  222. package/types/uni/core/index.d.ts +0 -13
  223. package/types/uni/core/lib/base/event/interface.d.ts +0 -277
  224. package/types/uni/core/lib/base/interceptor/interface.d.ts +0 -150
  225. package/types/uni/core/lib/interface.d.ts +0 -28
  226. package/types/uni/core/lib/lifecycle/interface.d.ts +0 -37
  227. package/types/uni/core/lib/performance/interface.d.ts +0 -157
  228. package/types/uni/core/lib/route/interface.d.ts +0 -2031
  229. package/types/uni/core/lib/ui/create-selector-query/interface.d.ts +0 -412
  230. package/types/uni/core/lib/ui/get-element-by-id/interface.d.ts +0 -73
  231. package/types/uni/core/lib/ui/load-font-face/interface.d.ts +0 -560
  232. package/types/uni/core/lib/ui/page-scroll-to/interface.d.ts +0 -145
  233. package/types/uni/core/lib/ui/pull-down-refresh/interface.d.ts +0 -176
  234. package/types/uni/core/lib/ui/set-navigation-bar-color/interface.d.ts +0 -431
  235. package/types/uni/core/lib/ui/set-navigation-bar-title/global.d.ts +0 -28
  236. package/types/uni/core/lib/ui/set-navigation-bar-title/index.d.ts +0 -13
  237. package/types/uni/core/lib/ui/set-navigation-bar-title/interface.d.ts +0 -368
  238. package/types/uni/core/lib/ui/tab-bar/interface.d.ts +0 -928
@@ -1,907 +1,927 @@
1
-
2
- /**
3
- * 错误码
4
- * - 1101001 用户取消
5
- * - 1101002 urls至少包含一张图片地址
6
- * - 1101003 文件不存在
7
- * - 1101004 图片加载失败
8
- * - 1101005 未获取权限
9
- * - 1101006 图片或视频保存失败
10
- * - 1101007 图片裁剪失败
11
- * - 1101008 拍照或录像失败
12
- * - 1101009 图片压缩失败
13
- * - 1101010 其他错误
14
- */
15
-
16
- export type MediaErrorCode = 1101001 | 1101002 | 1101003 | 1101004 | 1101005 | 1101006 | 1101007 | 1101008 | 1101009 | 1101010;
17
-
18
- /**
19
- * 图片或视频操作失败的错误回调
20
- */
21
- export interface IMediaError extends IUniError {
22
- errCode : MediaErrorCode
23
- };
24
-
25
-
26
- export type ChooseImageSuccess = {
27
- /**
28
- * 调用API的名称
29
- */
30
- errSubject : string,
31
- /**
32
- * 描述信息
33
- */
34
- errMsg : string,
35
- /**
36
- * 图片的本地文件路径列表
37
- * @type string | string []
38
- */
39
- tempFilePaths : Array<string>,
40
- /**
41
- * 图片的本地文件列表
42
- */
43
- tempFiles : any
44
- }
45
-
46
- export type ChooseImageFail = IMediaError;
47
- export type ChooseImageSuccessCallback = (callback : ChooseImageSuccess) => void
48
- export type ChooseImageFailCallback = (callback : ChooseImageFail) => void
49
- export type ChooseImageCompleteCallback = (callback : any) => void
50
-
51
- export type ChooseImageCropOptions = {
52
- /**
53
- * 裁剪的宽度,单位为px,用于计算裁剪宽高比。
54
- */
55
- width : number;
56
- /**
57
- * 裁剪的高度,单位为px,用于计算裁剪宽高比。
58
- */
59
- height : number;
60
- /**
61
- * 取值范围为1-100,数值越小,质量越低(仅对jpg格式有效)。默认值为80。
62
- * @defaultValue 80
63
- */
64
- quality : (number) | null;
65
- /**
66
- * 是否将width和height作为裁剪保存图片真实的像素值。默认值为true。注:设置为false时在裁剪编辑界面显示图片的像素值,设置为true时不显示。
67
- * @type boolean
68
- */
69
- resize : (boolean) | null;
70
- }
71
-
72
- export type ChooseImageOptions = {
73
- /**
74
- * 最多可以选择的图片张数,app端不限制,微信小程序最多可支持20个。
75
- * @defaultValue 9
76
- */
77
- count ?: (number) | null,
78
- /**
79
- * original 原图,compressed 压缩图,默认二者都有
80
- * @type string | string []
81
- * @defaultValue ['original','compressed']
82
- */
83
- sizeType ?: (string[]) | null,
84
- /**
85
- * album 从相册选图,camera 使用相机,默认二者都有
86
- * @defaultValue ['album','camera']
87
- */
88
- sourceType ?: (string[]) | null,
89
- /**
90
- * 根据文件拓展名过滤,每一项都不能是空字符串。默认不过滤。仅H5支持
91
- * @uniPlatform {
92
- * "app": {
93
- * "android": {
94
- * "osVer": "5.0",
95
- * "uniVer": "√",
96
- * "unixVer": "x"
97
- * }
98
- * }
99
- * }
100
- */
101
- extension ?: (string[]) | null,
102
- /**
103
- * 图像裁剪参数,设置后 sizeType 失效。
104
- */
105
- crop ?: (ChooseImageCropOptions) | null,
106
- /**
107
- * 成功则返回图片的本地文件路径列表 tempFilePaths
108
- */
109
- success ?: (ChooseImageSuccessCallback) | null,
110
- /**
111
- * 接口调用失败的回调函数
112
- */
113
- fail ?: (ChooseImageFailCallback) | null,
114
- /**
115
- * 接口调用结束的回调函数(调用成功、失败都会执行)
116
- */
117
- complete ?: (ChooseImageCompleteCallback) | null
118
- }
119
-
120
- export type ChooseImage = (options : ChooseImageOptions) => void
121
-
122
- export type PreviewImageSuccess = {
123
- /**
124
- * 调用API的名称
125
- */
126
- errSubject : string,
127
- /**
128
- * 描述信息
129
- */
130
- errMsg : string
131
- }
132
-
133
- export type LongPressActionsSuccessData = {
134
- /**
135
- * 接口调用失败的回调函数
136
- */
137
- tapIndex : number,
138
- /**
139
- * 接口调用结束的回调函数(调用成功、失败都会执行)
140
- */
141
- index : number
142
- };
143
- export type LongPressActionsOptions = {
144
- /**
145
- * 按钮的文字数组
146
- */
147
- itemList : string[],
148
- /**
149
- * 按钮的文字颜色,字符串格式,默认为"#000000"
150
- */
151
- itemColor : string | null,
152
- /**
153
- * 接口调用成功的回调函数
154
- */
155
- success : ((result : LongPressActionsSuccessData) => void) | null,
156
- /**
157
- * 接口调用失败的回调函数
158
- */
159
- fail : ((result : any) => void) | null,
160
- /**
161
- * 接口调用结束的回调函数(调用成功、失败都会执行)
162
- */
163
- complete : ((result : any) => void) | null
164
- };
165
-
166
-
167
- export type PreviewImageFail = IMediaError;
168
- export type PreviewImageSuccessCallback = (callback : PreviewImageSuccess) => void
169
- export type PreviewImageFailCallback = (callback : PreviewImageFail) => void
170
- export type PreviewImageCompleteCallback = ChooseImageCompleteCallback
171
-
172
- export type PreviewImageOptions = {
173
- /**
174
- * current 为当前显示图片的链接/索引值,不填或填写的值无效则为 urls 的第一张。
175
- * @type string | number
176
- */
177
- current ?: any | null,
178
- /**
179
- * 需要预览的图片链接列表
180
- */
181
- urls : Array<string.ImageURIString>,
182
- /**
183
- * 图片指示器样式
184
- * - default: 底部圆点指示器
185
- * - number: 顶部数字指示器
186
- * - none: 不显示指示器
187
- * @type 'default' | 'number' | 'none'
188
- */
189
- indicator ?: string | null,
190
- /**
191
- * 是否可循环预览
192
- * @type boolean
193
- */
194
- loop ?: boolean | null,
195
- /**
196
- * 长按图片显示操作菜单,如不填默认为保存相册。
197
- * @uniPlatform {
198
- * "app": {
199
- * "android": {
200
- * "osVer": "4.4",
201
- * "uniVer": "√",
202
- * "unixVer": "x"
203
- * }
204
- * }
205
- * }
206
- */
207
- longPressActions ?: LongPressActionsOptions | null,
208
- /**
209
- * 接口调用成功的回调函数
210
- */
211
- success ?: (PreviewImageSuccessCallback) | null,
212
- /**
213
- * 接口调用失败的回调函数
214
- */
215
- fail ?: (PreviewImageFailCallback) | null,
216
- /**
217
- * 接口调用结束的回调函数(调用成功、失败都会执行)
218
- */
219
- complete ?: (PreviewImageCompleteCallback) | null
220
- };
221
-
222
- export type PreviewImage = (options : PreviewImageOptions) => void;
223
-
224
- export type ClosePreviewImage = (options : ClosePreviewImageOptions) => void;
225
- export type ClosePreviewImageSuccess = {
226
- /**
227
- * 错误信息
228
- */
229
- errMsg : string
230
- };
231
-
232
- export type ClosePreviewImageFail = IMediaError;
233
- export type ClosePreviewImageSuccessCallback = (callback : ClosePreviewImageSuccess) => void
234
- export type ClosePreviewImageFailCallback = (callback : ClosePreviewImageFail) => void
235
- export type ClosePreviewImageCompleteCallback = ChooseImageCompleteCallback
236
-
237
- export type ClosePreviewImageOptions = {
238
- /**
239
- * 接口调用成功的回调函数
240
- */
241
- success ?: (ClosePreviewImageSuccessCallback) | null,
242
- /**
243
- * 接口调用失败的回调函数
244
- */
245
- fail ?: (ClosePreviewImageFailCallback) | null,
246
- /**
247
- * 接口调用结束的回调函数(调用成功、失败都会执行)
248
- */
249
- complete ?: (ClosePreviewImageCompleteCallback) | null
250
- };
251
-
252
- export type GetImageInfo = (options : GetImageInfoOptions) => void;
253
- export type GetImageInfoSuccess = {
254
- /**
255
- * 图片宽度,单位px
256
- */
257
- width : number,
258
- /**
259
- * 图片高度,单位px
260
- */
261
- height : number,
262
- /**
263
- * 返回图片的本地路径
264
- */
265
- path : string,
266
- /**
267
- * 返回图片的方向
268
- */
269
- orientation : string | null,
270
- /**
271
- * 返回图片的格式
272
- */
273
- type : string | null
274
- };
275
-
276
- export type GetImageInfoFail = IMediaError;
277
- export type GetImageInfoSuccessCallback = (callback : GetImageInfoSuccess) => void
278
- export type GetImageInfoFailCallback = (callback : GetImageInfoFail) => void
279
- export type GetImageInfoCompleteCallback = ChooseImageCompleteCallback
280
-
281
- export type GetImageInfoOptions = {
282
- /**
283
- * 图片的路径,可以是相对路径,临时文件路径,存储文件路径,网络图片路径
284
- */
285
- src : string.ImageURIString,
286
- /**
287
- * 接口调用成功的回调函数
288
- */
289
- success ?: (GetImageInfoSuccessCallback) | null,
290
- /**
291
- * 接口调用失败的回调函数
292
- */
293
- fail ?: (GetImageInfoFailCallback) | null,
294
- /**
295
- * 接口调用结束的回调函数(调用成功、失败都会执行)
296
- */
297
- complete ?: (GetImageInfoCompleteCallback) | null
298
- };
299
-
300
- export type SaveImageToPhotosAlbum = (options : SaveImageToPhotosAlbumOptions) => void;
301
-
302
- export type SaveImageToPhotosAlbumSuccess = {
303
- /**
304
- * 保存到相册的图片路径
305
- */
306
- path : string
307
- };
308
-
309
- export type SaveImageToPhotosAlbumFail = IMediaError;
310
- export type SaveImageToPhotosAlbumSuccessCallback = (callback : SaveImageToPhotosAlbumSuccess) => void
311
- export type SaveImageToPhotosAlbumFailCallback = (callback : SaveImageToPhotosAlbumFail) => void
312
- export type SaveImageToPhotosAlbumCompleteCallback = ChooseImageCompleteCallback
313
-
314
- export type SaveImageToPhotosAlbumOptions = {
315
- /**
316
- * 图片文件路径,可以是临时文件路径也可以是永久文件路径,不支持网络图片路径
317
- */
318
- filePath : string.ImageURIString,
319
- /**
320
- * 接口调用成功的回调函数
321
- */
322
- success ?: (SaveImageToPhotosAlbumSuccessCallback) | null,
323
- /**
324
- * 接口调用失败的回调函数
325
- */
326
- fail ?: (SaveImageToPhotosAlbumFailCallback) | null,
327
- /**
328
- * 接口调用结束的回调函数(调用成功、失败都会执行)
329
- */
330
- complete ?: (SaveImageToPhotosAlbumCompleteCallback) | null
331
- };
332
- export type CompressImage = (options : CompressImageOptions) => void;
333
- export type CompressImageSuccess = {
334
- /**
335
- * 压缩后图片的临时文件路径
336
- */
337
- tempFilePath : string
338
- };
339
-
340
- export type CompressImageFail = IMediaError;
341
- export type CompressImageSuccessCallback = (callback : CompressImageSuccess) => void
342
- export type CompressImageFailCallback = (callback : CompressImageFail) => void
343
- export type CompressImageCompleteCallback = ChooseImageCompleteCallback
344
-
345
- export type CompressImageOptions = {
346
- /**
347
- * 图片路径,图片的路径,可以是相对路径、临时文件路径、存储文件路径
348
- */
349
- src : string.ImageURIString,
350
- /**
351
- * 压缩质量,范围0~100,数值越小,质量越低,压缩率越高(仅对jpg有效)
352
- */
353
- quality ?: number | null,
354
- /**
355
- * 旋转度数,范围0~360
356
- */
357
- rotate ?: number | null,
358
- /**
359
- * 缩放图片的宽度
360
- */
361
- width ?: string | null,
362
- /**
363
- * 缩放图片的高度
364
- */
365
- height ?: string | null,
366
- /**
367
- * 压缩后图片的高度,单位为px,若不填写则默认以compressedWidth为准等比缩放
368
- */
369
- compressedHeight ?: number | null,
370
- /**
371
- * 压缩后图片的宽度,单位为px,若不填写则默认以compressedHeight为准等比缩放。
372
- */
373
- compressedWidth ?: number | null,
374
- /**
375
- * 接口调用成功的回调函数
376
- */
377
- success ?: (CompressImageSuccessCallback) | null,
378
- /**
379
- * 接口调用失败的回调函数
380
- */
381
- fail ?: (CompressImageFailCallback) | null,
382
- /**
383
- * 接口调用结束的回调函数(调用成功、失败都会执行)
384
- */
385
- complete ?: (CompressImageCompleteCallback) | null
386
- };
387
-
388
- export type ChooseVideoSuccess = {
389
- /**
390
- * 选定视频的临时文件路径
391
- */
392
- tempFilePath : string,
393
- /**
394
- * 选定的视频文件,仅H5支持
395
- */
396
- // tempFile: File|null,
397
- /**
398
- * 选定视频的时间长度
399
- */
400
- duration : number,
401
- /**
402
- * 选定视频的数据量大小
403
- */
404
- size : number,
405
- /**
406
- * 返回选定视频的长
407
- */
408
- height : number,
409
- /**
410
- * 返回选定视频的宽
411
- */
412
- width : number,
413
- /**
414
- * 包含扩展名的文件名称(仅H5支持)
415
- */
416
- // name: string | null
417
- };
418
-
419
- export type ChooseVideoFail = IMediaError;
420
- export type ChooseVideoSuccessCallback = (callback : ChooseVideoSuccess) => void
421
- export type ChooseVideoFailCallback = (callback : ChooseVideoFail) => void
422
- export type ChooseVideoCompleteCallback = ChooseImageCompleteCallback
423
-
424
- export type ChooseVideoOptions = {
425
- /**
426
- * album 从相册选视频,camera 使用相机拍摄,默认为:['album', 'camera']
427
- */
428
- sourceType ?: (string[]) | null,
429
- /**
430
- * 是否压缩所选的视频源文件,默认值为true,需要压缩
431
- * @type boolean
432
- */
433
- compressed ?: boolean | null,
434
- /**
435
- * 拍摄视频最长拍摄时间,单位秒。最长支持 60 秒
436
- */
437
- maxDuration ?: number | null,
438
- /**
439
- * 摄像切换
440
- * - front: 前置摄像头
441
- * - back: 后置摄像头
442
- * @type 'front' | 'back'
443
- */
444
- camera ?: string | null,
445
- /**
446
- * 根据文件拓展名过滤,每一项都不能是空字符串。默认不过滤。
447
- */
448
- extension ?: (string[]) | null,
449
- /**
450
- * 接口调用成功,返回视频文件的临时文件路径,详见返回参数说明
451
- */
452
- success ?: (ChooseVideoSuccessCallback) | null,
453
- /**
454
- * 接口调用失败的回调函数
455
- */
456
- fail ?: (ChooseVideoFailCallback) | null,
457
- /**
458
- * 接口调用结束的回调函数(调用成功、失败都会执行)
459
- */
460
- complete ?: (ChooseVideoCompleteCallback) | null
461
- };
462
-
463
- export type ChooseVideo = (options : ChooseVideoOptions) => void;
464
-
465
- export type GetVideoInfoSuccess = {
466
- /**
467
- * 画面方向
468
- */
469
- orientation : string | null,
470
- /**
471
- * 视频格式
472
- */
473
- type : string | null,
474
- /**
475
- * 视频长度
476
- */
477
- duration : number,
478
- /**
479
- * 视频大小,单位 kB
480
- */
481
- size : number,
482
- /**
483
- * 视频的长,单位 px
484
- */
485
- height : number,
486
- /**
487
- * 视频的宽,单位 px
488
- */
489
- width : number,
490
- /**
491
- * 视频帧率
492
- */
493
- fps : number | null,
494
- /**
495
- * 视频码率,单位 kbps
496
- */
497
- bitrate : number | null
498
- };
499
-
500
- export type GetVideoInfoFail = IMediaError;
501
- export type GetVideoInfoSuccessCallback = (callback : GetVideoInfoSuccess) => void
502
- export type GetVideoInfoFailCallback = (callback : GetVideoInfoFail) => void
503
- export type GetVideoInfoCompleteCallback = ChooseImageCompleteCallback
504
-
505
- export type GetVideoInfoOptions = {
506
- /**
507
- * 视频文件路径,可以是临时文件路径也可以是永久文件路径
508
- */
509
- src : string.VideoURIString,
510
- /**
511
- * 接口调用成功的回调函数
512
- */
513
- success ?: (GetVideoInfoSuccessCallback) | null,
514
- /**
515
- * 接口调用失败的回调函数
516
- */
517
- fail ?: (GetVideoInfoFailCallback) | null,
518
- /**
519
- * 接口调用结束的回调函数(调用成功、失败都会执行)
520
- */
521
- complete ?: (GetVideoInfoCompleteCallback) | null
522
- };
523
-
524
- export type GetVideoInfo = (options : GetVideoInfoOptions) => void;
525
-
526
- export type SaveVideoToPhotosAlbumSuccess = {};
527
-
528
- export type SaveVideoToPhotosAlbumFail = IMediaError;
529
- export type SaveVideoToPhotosAlbumSuccessCallback = (callback : SaveVideoToPhotosAlbumSuccess) => void
530
- export type SaveVideoToPhotosAlbumFailCallback = (callback : SaveVideoToPhotosAlbumFail) => void
531
- export type SaveVideoToPhotosAlbumCompleteCallback = ChooseImageCompleteCallback
532
-
533
- export type SaveVideoToPhotosAlbumOptions = {
534
- /**
535
- * 视频文件路径,可以是临时文件路径也可以是永久文件路径
536
- */
537
- filePath : string.VideoURIString,
538
- /**
539
- * 接口调用成功的回调函数
540
- */
541
- success ?: (SaveVideoToPhotosAlbumSuccessCallback) | null,
542
- /**
543
- * 接口调用失败的回调函数
544
- */
545
- fail ?: (SaveVideoToPhotosAlbumFailCallback) | null,
546
- /**
547
- * 接口调用结束的回调函数(调用成功、失败都会执行)
548
- */
549
- complete ?: (SaveVideoToPhotosAlbumCompleteCallback) | null
550
- };
551
-
552
- export type SaveVideoToPhotosAlbum = (options : SaveVideoToPhotosAlbumOptions) => void;
553
-
554
- export type CompressVideoSuccess = {
555
- /**
556
- * 压缩后的临时文件地址
557
- */
558
- tempFilePath : string,
559
- /**
560
- * 压缩后的大小,单位 kB
561
- */
562
- size : number
563
- };
564
-
565
- export type CompressVideoFail = IMediaError;
566
- export type CompressVideoSuccessCallback = (callback : CompressVideoSuccess) => void
567
- export type CompressVideoFailCallback = (callback : CompressVideoFail) => void
568
- export type CompressVideoCompleteCallback = ChooseImageCompleteCallback
569
-
570
- export type CompressVideoOptions = {
571
- /**
572
- * 视频文件路径,可以是临时文件路径也可以是永久文件路径
573
- */
574
- src : string.VideoURIString,
575
- /**
576
- * 压缩质量
577
- * - low: 低
578
- * - medium: 中
579
- * - high: 高
580
- * @type 'low' | 'medium' | 'high'
581
- */
582
- quality ?: string | null,
583
- /**
584
- * 码率,单位 kbps
585
- */
586
- bitrate ?: number | null,
587
- /**
588
- * 帧率
589
- */
590
- fps ?: number | null,
591
- /**
592
- * 相对于原视频的分辨率比例,取值范围(0, 1]
593
- */
594
- resolution ?: number | null,
595
- /**
596
- * 接口调用成功的回调函数
597
- */
598
- success ?: (CompressVideoSuccessCallback) | null,
599
- /**
600
- * 接口调用失败的回调函数
601
- */
602
- fail ?: (CompressVideoFailCallback) | null,
603
- /**
604
- * 接口调用结束的回调函数(调用成功、失败都会执行)
605
- */
606
- complete ?: (CompressVideoCompleteCallback) | null
607
- };
608
-
609
- export type CompressVideo = (options : CompressVideoOptions) => void;
610
-
611
- export interface Uni {
612
- /**
613
- * 从本地相册选择图片或使用相机拍照
614
- * @description 从本地相册选择图片或使用相机拍照
615
- * @uniPlatform {
616
- * "app": {
617
- * "android": {
618
- * "osVer": "4.4",
619
- * "uniVer": "√",
620
- * "unixVer": "3.9+"
621
- * }
622
- * },
623
- * "web": {
624
- * "uniVer": "√",
625
- * "unixVer": "4.0"
626
- * }
627
- * }
628
- * @uniVueVersion 2,3
629
- * @example
630
- * ```typescript
631
- * uni.chooseImage({
632
- * count:3,
633
- * success(e){
634
- * console.log(JSON.stringify(e))
635
- * }
636
- * })
637
- * ```
638
- * @tutorial http://uniapp.dcloud.io/api/media/image?id=chooseimage
639
- * @autotest {
640
- generated:false
641
- }
642
- */
643
- chooseImage(options : ChooseImageOptions) : void;
644
- /**
645
- * 预览图片
646
- * @description 预览图片
647
- * @uniPlatform {
648
- * "app": {
649
- * "android": {
650
- * "osVer": "4.4",
651
- * "uniVer": "√",
652
- * "unixVer": "3.9+"
653
- * }
654
- * },
655
- * "web": {
656
- * "uniVer": "√",
657
- * "unixVer": "4.0"
658
- * }
659
- * }
660
- * @uniVueVersion 2,3
661
- * @example
662
- * ```typescript
663
- * uni.previewImage({
664
- * urls:['/static/a.jpg','/static/b.jpg'],
665
- * success(e){
666
- * console.log(JSON.stringify(e))
667
- * }
668
- * })
669
- * ```
670
- * @tutorial http://uniapp.dcloud.io/api/media/image?id=previewimage
671
- * @autotest {
672
- generated:false
673
- }
674
- */
675
- previewImage(options : PreviewImageOptions) : void;
676
- /**
677
- * 关闭图片预览
678
- * @description 关闭图片预览
679
- * @uniPlatform {
680
- * "app": {
681
- * "android": {
682
- * "osVer": "4.4",
683
- * "uniVer": "√",
684
- * "unixVer": "3.9+"
685
- * }
686
- * }
687
- * }
688
- * @uniVueVersion 2,3
689
- * @example
690
- * ```typescript
691
- * uni.closePreviewImage({
692
- * success(e){
693
- * console.log(JSON.stringify(e))
694
- * }
695
- * })
696
- * ```
697
- * @tutorial http://uniapp.dcloud.io/api/media/image?id=closepreviewimage
698
- * @autotest {
699
- generated:false
700
- }
701
- */
702
- closePreviewImage(options : ClosePreviewImageOptions) : void;
703
- /**
704
- * 获取图片信息
705
- * @description 获取图片信息
706
- * @uniPlatform {
707
- * "app": {
708
- * "android": {
709
- * "osVer": "4.4",
710
- * "uniVer": "√",
711
- * "unixVer": "3.9+"
712
- * }
713
- * }
714
- * }
715
- * @uniVueVersion 2,3
716
- * @example
717
- * ```typescript
718
- * uni.getImageInfo({
719
- * src:'/static/a.jpg',
720
- * success(e){
721
- * console.log(JSON.stringify(e))
722
- * },
723
- * })
724
- * ```
725
- * @tutorial http://uniapp.dcloud.io/api/media/image?id=getimageinfo
726
- * @autotest {
727
- generated:false,
728
- case:[
729
- {
730
- input:[{"src":"/static/a.jpg"}]
731
- }
732
- ]
733
- }
734
- */
735
- getImageInfo(options : GetImageInfoOptions) : void;
736
- /**
737
- * 保存图片到系统相册
738
- * @description 保存图片到系统相册
739
- * @uniPlatform {
740
- * "app": {
741
- * "android": {
742
- * "osVer": "4.4",
743
- * "uniVer": "√",
744
- * "unixVer": "3.9+"
745
- * }
746
- * }
747
- * }
748
- * @uniVueVersion 2,3
749
- * @example
750
- * ```typescript
751
- * uni.saveImageToPhotosAlbum({
752
- * filePath:'/static/a.jpg',
753
- * success(e){
754
- * console.log(JSON.stringify(e))
755
- * },
756
- * })
757
- * ```
758
- * @tutorial http://uniapp.dcloud.io/api/media/image?id=saveimagetophotosalbum
759
- * @autotest {
760
- generated:false,
761
- case:[
762
- {
763
- input:[{"filePath":"/static/a.jpg"}]
764
- }
765
- ]
766
- }
767
- */
768
- saveImageToPhotosAlbum(options : SaveImageToPhotosAlbumOptions) : void;
769
- /**
770
- * 压缩图片
771
- * @description 压缩图片
772
- * @uniPlatform {
773
- * "app": {
774
- * "android": {
775
- * "osVer": "4.4",
776
- * "uniVer": "√",
777
- * "unixVer": "3.9+"
778
- * }
779
- * }
780
- * }
781
- * @uniVueVersion 2,3
782
- * @example
783
- * ```typescript
784
- * uni.compressImage({
785
- * src:'/static/a.jpg',
786
- * quality:80,
787
- * success(e){
788
- * console.log(JSON.stringify(e))
789
- * },
790
- * })
791
- * ```
792
- * @tutorial http://uniapp.dcloud.io/api/media/image?id=compressimage
793
- * @autotest {
794
- generated:false,
795
- case:[
796
- {
797
- input:[{"src":"/static/d.jpg"},{"rotate","30"}]
798
- }
799
- ]
800
- }
801
- */
802
- compressImage(options : CompressImageOptions) : void;
803
- /**
804
- * 拍摄视频或从手机相册中选视频,返回视频的临时文件路径。
805
- * @description 拍摄视频或从手机相册中选视频,返回视频的临时文件路径。
806
- * @uniPlatform {
807
- * "app": {
808
- * "android": {
809
- * "osVer": "4.4",
810
- * "uniVer": "√",
811
- * "unixVer": "3.9+"
812
- * }
813
- * }
814
- * }
815
- * @uniVueVersion 2,3
816
- * @example
817
- * ```typescript
818
- * uni.chooseVideo({
819
- * success(e){
820
- * console.log(JSON.stringify(e))
821
- * },
822
- * })
823
- * ```
824
- * @tutorial http://uniapp.dcloud.io/api/media/video?id=choosevideo
825
- *
826
- */
827
- chooseVideo(options : ChooseVideoOptions) : void;
828
- /**
829
- * 获取视频详细信息
830
- * @description 获取视频详细信息
831
- * @uniPlatform {
832
- * "app": {
833
- * "android": {
834
- * "osVer": "4.4",
835
- * "uniVer": "√",
836
- * "unixVer": "3.9+"
837
- * }
838
- * }
839
- * }
840
- * @uniVueVersion 2,3
841
- * @example
842
- * ```typescript
843
- * uni.GetVideoInfo({
844
- * src:"/static/a.mp4",
845
- * success(e){
846
- * console.log(JSON.stringify(e))
847
- * },
848
- * })
849
- * ```
850
- * @tutorial http://uniapp.dcloud.io/api/media/video?id=getvideoinfo
851
- *
852
- */
853
- getVideoInfo(options : GetVideoInfoOptions) : void;
854
- /**
855
- * 保存视频到系统相册
856
- * @description 保存视频到系统相册
857
- * @uniPlatform {
858
- * "app": {
859
- * "android": {
860
- * "osVer": "4.4",
861
- * "uniVer": "√",
862
- * "unixVer": "3.9+"
863
- * }
864
- * }
865
- * }
866
- * @uniVueVersion 2,3
867
- * @example
868
- * ```typescript
869
- * uni.saveVideoToPhotosAlbum({
870
- * filePath:"/static/a.mp4",
871
- * success(e){
872
- * console.log(JSON.stringify(e))
873
- * },
874
- * })
875
- * ```
876
- * @tutorial http://uniapp.dcloud.io/api/media/video?id=savevideotophotosalbum
877
- *
878
- */
879
- saveVideoToPhotosAlbum(options : SaveVideoToPhotosAlbumOptions) : void;
880
- /**
881
- * 压缩视频
882
- * @description 压缩视频
883
- * @uniPlatform {
884
- * "app": {
885
- * "android": {
886
- * "osVer": "4.4",
887
- * "uniVer": "√",
888
- * "unixVer": "3.9+"
889
- * }
890
- * }
891
- * }
892
- * @uniVueVersion 2,3
893
- * @example
894
- * ```typescript
895
- * uni.compressVideo({
896
- * src:"/static/a.mp4",
897
- * quality:"low",
898
- * success(e){
899
- * console.log(JSON.stringify(e))
900
- * },
901
- * })
902
- * ```
903
- * @tutorial http://uniapp.dcloud.io/api/media/video?id=compressvideo
904
- *
905
- */
906
- compressVideo(options : CompressVideoOptions) : void;
1
+
2
+ /**
3
+ * 错误码
4
+ * - 1101001 用户取消
5
+ * - 1101002 urls至少包含一张图片地址
6
+ * - 1101003 文件不存在
7
+ * - 1101004 图片加载失败
8
+ * - 1101005 未获取权限
9
+ * - 1101006 图片或视频保存失败
10
+ * - 1101007 图片裁剪失败
11
+ * - 1101008 拍照或录像失败
12
+ * - 1101009 图片压缩失败
13
+ * - 1101010 其他错误
14
+ */
15
+
16
+ export type MediaErrorCode = 1101001 | 1101002 | 1101003 | 1101004 | 1101005 | 1101006 | 1101007 | 1101008 | 1101009 | 1101010;
17
+
18
+ /**
19
+ * 图片或视频操作失败的错误回调
20
+ */
21
+ export interface IMediaError extends IUniError {
22
+ errCode : MediaErrorCode
23
+ };
24
+
25
+
26
+ export type ChooseImageSuccess = {
27
+ /**
28
+ * 调用API的名称
29
+ */
30
+ errSubject : string,
31
+ /**
32
+ * 描述信息
33
+ */
34
+ errMsg : string,
35
+ /**
36
+ * 图片的本地文件路径列表
37
+ * @type string | string []
38
+ */
39
+ tempFilePaths : Array<string>,
40
+ /**
41
+ * 图片的本地文件列表
42
+ */
43
+ tempFiles : any
44
+ }
45
+
46
+ export type ChooseImageFail = IMediaError;
47
+ export type ChooseImageSuccessCallback = (callback : ChooseImageSuccess) => void
48
+ export type ChooseImageFailCallback = (callback : ChooseImageFail) => void
49
+ export type ChooseImageCompleteCallback = (callback : any) => void
50
+
51
+ export type ChooseImageCropOptions = {
52
+ /**
53
+ * 裁剪的宽度,单位为px,用于计算裁剪宽高比。
54
+ */
55
+ width : number;
56
+ /**
57
+ * 裁剪的高度,单位为px,用于计算裁剪宽高比。
58
+ */
59
+ height : number;
60
+ /**
61
+ * 取值范围为1-100,数值越小,质量越低(仅对jpg格式有效)。默认值为80。
62
+ * @defaultValue 80
63
+ */
64
+ quality : (number) | null;
65
+ /**
66
+ * 是否将width和height作为裁剪保存图片真实的像素值。默认值为true。注:设置为false时在裁剪编辑界面显示图片的像素值,设置为true时不显示。
67
+ * @type boolean
68
+ */
69
+ resize : (boolean) | null;
70
+ }
71
+
72
+ export type ChooseImageOptions = {
73
+ /**
74
+ * 最多可以选择的图片张数,app端不限制,微信小程序最多可支持20个。
75
+ * @defaultValue 9
76
+ */
77
+ count ?: (number) | null,
78
+ /**
79
+ * original 原图,compressed 压缩图,默认二者都有
80
+ * @type string | string []
81
+ * @defaultValue ['original','compressed']
82
+ */
83
+ sizeType ?: (string[]) | null,
84
+ /**
85
+ * album 从相册选图,camera 使用相机,默认二者都有
86
+ * @defaultValue ['album','camera']
87
+ */
88
+ sourceType ?: (string[]) | null,
89
+ /**
90
+ * 根据文件拓展名过滤,每一项都不能是空字符串。默认不过滤。仅H5支持
91
+ * @uniPlatform {
92
+ * "app": {
93
+ * "android": {
94
+ * "osVer": "5.0",
95
+ * "uniVer": "√",
96
+ * "unixVer": "x"
97
+ * }
98
+ * }
99
+ * }
100
+ */
101
+ extension ?: (string[]) | null,
102
+ /**
103
+ * 图像裁剪参数,设置后 sizeType 失效。
104
+ */
105
+ crop ?: (ChooseImageCropOptions) | null,
106
+ /**
107
+ * 成功则返回图片的本地文件路径列表 tempFilePaths
108
+ */
109
+ success ?: (ChooseImageSuccessCallback) | null,
110
+ /**
111
+ * 接口调用失败的回调函数
112
+ */
113
+ fail ?: (ChooseImageFailCallback) | null,
114
+ /**
115
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
116
+ */
117
+ complete ?: (ChooseImageCompleteCallback) | null
118
+ }
119
+
120
+ export type ChooseImage = (options : ChooseImageOptions) => void
121
+
122
+ export type PreviewImageSuccess = {
123
+ /**
124
+ * 调用API的名称
125
+ */
126
+ errSubject : string,
127
+ /**
128
+ * 描述信息
129
+ */
130
+ errMsg : string
131
+ }
132
+
133
+ export type LongPressActionsSuccessData = {
134
+ /**
135
+ * 接口调用失败的回调函数
136
+ */
137
+ tapIndex : number,
138
+ /**
139
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
140
+ */
141
+ index : number
142
+ };
143
+ export type LongPressActionsOptions = {
144
+ /**
145
+ * 按钮的文字数组
146
+ */
147
+ itemList : string[],
148
+ /**
149
+ * 按钮的文字颜色,字符串格式,默认为"#000000"
150
+ */
151
+ itemColor : string | null,
152
+ /**
153
+ * 接口调用成功的回调函数
154
+ */
155
+ success : ((result : LongPressActionsSuccessData) => void) | null,
156
+ /**
157
+ * 接口调用失败的回调函数
158
+ */
159
+ fail : ((result : any) => void) | null,
160
+ /**
161
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
162
+ */
163
+ complete : ((result : any) => void) | null
164
+ };
165
+
166
+
167
+ export type PreviewImageFail = IMediaError;
168
+ export type PreviewImageSuccessCallback = (callback : PreviewImageSuccess) => void
169
+ export type PreviewImageFailCallback = (callback : PreviewImageFail) => void
170
+ export type PreviewImageCompleteCallback = ChooseImageCompleteCallback
171
+
172
+ export type PreviewImageOptions = {
173
+ /**
174
+ * current 为当前显示图片的链接/索引值,不填或填写的值无效则为 urls 的第一张。
175
+ * @type string | number
176
+ */
177
+ current ?: any | null,
178
+ /**
179
+ * 需要预览的图片链接列表
180
+ */
181
+ urls : Array<string.ImageURIString>,
182
+ /**
183
+ * 图片指示器样式
184
+ * - default: 底部圆点指示器
185
+ * - number: 顶部数字指示器
186
+ * - none: 不显示指示器
187
+ * @type 'default' | 'number' | 'none'
188
+ */
189
+ indicator ?: string | null,
190
+ /**
191
+ * 是否可循环预览
192
+ * @type boolean
193
+ */
194
+ loop ?: boolean | null,
195
+ /**
196
+ * 长按图片显示操作菜单,如不填默认为保存相册。
197
+ * @uniPlatform {
198
+ * "app": {
199
+ * "android": {
200
+ * "osVer": "4.4",
201
+ * "uniVer": "√",
202
+ * "unixVer": "x"
203
+ * }
204
+ * }
205
+ * }
206
+ */
207
+ longPressActions ?: LongPressActionsOptions | null,
208
+ /**
209
+ * 接口调用成功的回调函数
210
+ */
211
+ success ?: (PreviewImageSuccessCallback) | null,
212
+ /**
213
+ * 接口调用失败的回调函数
214
+ */
215
+ fail ?: (PreviewImageFailCallback) | null,
216
+ /**
217
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
218
+ */
219
+ complete ?: (PreviewImageCompleteCallback) | null
220
+ };
221
+
222
+ export type PreviewImage = (options : PreviewImageOptions) => void;
223
+
224
+ export type ClosePreviewImage = (options : ClosePreviewImageOptions) => void;
225
+ export type ClosePreviewImageSuccess = {
226
+ /**
227
+ * 错误信息
228
+ */
229
+ errMsg : string
230
+ };
231
+
232
+ export type ClosePreviewImageFail = IMediaError;
233
+ export type ClosePreviewImageSuccessCallback = (callback : ClosePreviewImageSuccess) => void
234
+ export type ClosePreviewImageFailCallback = (callback : ClosePreviewImageFail) => void
235
+ export type ClosePreviewImageCompleteCallback = ChooseImageCompleteCallback
236
+
237
+ export type ClosePreviewImageOptions = {
238
+ /**
239
+ * 接口调用成功的回调函数
240
+ */
241
+ success ?: (ClosePreviewImageSuccessCallback) | null,
242
+ /**
243
+ * 接口调用失败的回调函数
244
+ */
245
+ fail ?: (ClosePreviewImageFailCallback) | null,
246
+ /**
247
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
248
+ */
249
+ complete ?: (ClosePreviewImageCompleteCallback) | null
250
+ };
251
+
252
+ export type GetImageInfo = (options : GetImageInfoOptions) => void;
253
+ export type GetImageInfoSuccess = {
254
+ /**
255
+ * 图片宽度,单位px
256
+ */
257
+ width : number,
258
+ /**
259
+ * 图片高度,单位px
260
+ */
261
+ height : number,
262
+ /**
263
+ * 返回图片的本地路径
264
+ */
265
+ path : string,
266
+ /**
267
+ * 返回图片的方向
268
+ */
269
+ orientation : string | null,
270
+ /**
271
+ * 返回图片的格式
272
+ */
273
+ type : string | null
274
+ };
275
+
276
+ export type GetImageInfoFail = IMediaError;
277
+ export type GetImageInfoSuccessCallback = (callback : GetImageInfoSuccess) => void
278
+ export type GetImageInfoFailCallback = (callback : GetImageInfoFail) => void
279
+ export type GetImageInfoCompleteCallback = ChooseImageCompleteCallback
280
+
281
+ export type GetImageInfoOptions = {
282
+ /**
283
+ * 图片的路径,可以是相对路径,临时文件路径,存储文件路径,网络图片路径
284
+ */
285
+ src : string.ImageURIString,
286
+ /**
287
+ * 接口调用成功的回调函数
288
+ */
289
+ success ?: (GetImageInfoSuccessCallback) | null,
290
+ /**
291
+ * 接口调用失败的回调函数
292
+ */
293
+ fail ?: (GetImageInfoFailCallback) | null,
294
+ /**
295
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
296
+ */
297
+ complete ?: (GetImageInfoCompleteCallback) | null
298
+ };
299
+
300
+ export type SaveImageToPhotosAlbum = (options : SaveImageToPhotosAlbumOptions) => void;
301
+
302
+ export type SaveImageToPhotosAlbumSuccess = {
303
+ /**
304
+ * 保存到相册的图片路径
305
+ */
306
+ path : string
307
+ };
308
+
309
+ export type SaveImageToPhotosAlbumFail = IMediaError;
310
+ export type SaveImageToPhotosAlbumSuccessCallback = (callback : SaveImageToPhotosAlbumSuccess) => void
311
+ export type SaveImageToPhotosAlbumFailCallback = (callback : SaveImageToPhotosAlbumFail) => void
312
+ export type SaveImageToPhotosAlbumCompleteCallback = ChooseImageCompleteCallback
313
+
314
+ export type SaveImageToPhotosAlbumOptions = {
315
+ /**
316
+ * 图片文件路径,可以是临时文件路径也可以是永久文件路径,不支持网络图片路径
317
+ */
318
+ filePath : string.ImageURIString,
319
+ /**
320
+ * 接口调用成功的回调函数
321
+ */
322
+ success ?: (SaveImageToPhotosAlbumSuccessCallback) | null,
323
+ /**
324
+ * 接口调用失败的回调函数
325
+ */
326
+ fail ?: (SaveImageToPhotosAlbumFailCallback) | null,
327
+ /**
328
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
329
+ */
330
+ complete ?: (SaveImageToPhotosAlbumCompleteCallback) | null
331
+ };
332
+ export type CompressImage = (options : CompressImageOptions) => void;
333
+ export type CompressImageSuccess = {
334
+ /**
335
+ * 压缩后图片的临时文件路径
336
+ */
337
+ tempFilePath : string
338
+ };
339
+
340
+ export type CompressImageFail = IMediaError;
341
+ export type CompressImageSuccessCallback = (callback : CompressImageSuccess) => void
342
+ export type CompressImageFailCallback = (callback : CompressImageFail) => void
343
+ export type CompressImageCompleteCallback = ChooseImageCompleteCallback
344
+
345
+ export type CompressImageOptions = {
346
+ /**
347
+ * 图片路径,图片的路径,可以是相对路径、临时文件路径、存储文件路径
348
+ */
349
+ src : string.ImageURIString,
350
+ /**
351
+ * 压缩质量,范围0~100,数值越小,质量越低,压缩率越高(仅对jpg有效)
352
+ */
353
+ quality ?: number | null,
354
+ /**
355
+ * 旋转度数,范围0~360
356
+ */
357
+ rotate ?: number | null,
358
+ /**
359
+ * 缩放图片的宽度
360
+ */
361
+ width ?: string | null,
362
+ /**
363
+ * 缩放图片的高度
364
+ */
365
+ height ?: string | null,
366
+ /**
367
+ * 压缩后图片的高度,单位为px,若不填写则默认以compressedWidth为准等比缩放
368
+ */
369
+ compressedHeight ?: number | null,
370
+ /**
371
+ * 压缩后图片的宽度,单位为px,若不填写则默认以compressedHeight为准等比缩放。
372
+ */
373
+ compressedWidth ?: number | null,
374
+ /**
375
+ * 接口调用成功的回调函数
376
+ */
377
+ success ?: (CompressImageSuccessCallback) | null,
378
+ /**
379
+ * 接口调用失败的回调函数
380
+ */
381
+ fail ?: (CompressImageFailCallback) | null,
382
+ /**
383
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
384
+ */
385
+ complete ?: (CompressImageCompleteCallback) | null
386
+ };
387
+
388
+ export type ChooseVideoSuccess = {
389
+ /**
390
+ * 选定视频的临时文件路径
391
+ */
392
+ tempFilePath : string,
393
+ /**
394
+ * 选定的视频文件,仅H5支持
395
+ */
396
+ // tempFile: File|null,
397
+ /**
398
+ * 选定视频的时间长度
399
+ */
400
+ duration : number,
401
+ /**
402
+ * 选定视频的数据量大小
403
+ */
404
+ size : number,
405
+ /**
406
+ * 返回选定视频的长
407
+ */
408
+ height : number,
409
+ /**
410
+ * 返回选定视频的宽
411
+ */
412
+ width : number,
413
+ /**
414
+ * 包含扩展名的文件名称(仅H5支持)
415
+ */
416
+ // name: string | null
417
+ };
418
+
419
+ export type ChooseVideoFail = IMediaError;
420
+ export type ChooseVideoSuccessCallback = (callback : ChooseVideoSuccess) => void
421
+ export type ChooseVideoFailCallback = (callback : ChooseVideoFail) => void
422
+ export type ChooseVideoCompleteCallback = ChooseImageCompleteCallback
423
+
424
+ export type ChooseVideoOptions = {
425
+ /**
426
+ * album 从相册选视频,camera 使用相机拍摄,默认为:['album', 'camera']
427
+ */
428
+ sourceType ?: (string[]) | null,
429
+ /**
430
+ * 是否压缩所选的视频源文件,默认值为true,需要压缩
431
+ * @type boolean
432
+ */
433
+ compressed ?: boolean | null,
434
+ /**
435
+ * 拍摄视频最长拍摄时间,单位秒。最长支持 60 秒
436
+ */
437
+ maxDuration ?: number | null,
438
+ /**
439
+ * 摄像切换
440
+ * - front: 前置摄像头
441
+ * - back: 后置摄像头
442
+ * @type 'front' | 'back'
443
+ */
444
+ camera ?: string | null,
445
+ /**
446
+ * 根据文件拓展名过滤,每一项都不能是空字符串。默认不过滤。
447
+ */
448
+ extension ?: (string[]) | null,
449
+ /**
450
+ * 接口调用成功,返回视频文件的临时文件路径,详见返回参数说明
451
+ */
452
+ success ?: (ChooseVideoSuccessCallback) | null,
453
+ /**
454
+ * 接口调用失败的回调函数
455
+ */
456
+ fail ?: (ChooseVideoFailCallback) | null,
457
+ /**
458
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
459
+ */
460
+ complete ?: (ChooseVideoCompleteCallback) | null
461
+ };
462
+
463
+ export type ChooseVideo = (options : ChooseVideoOptions) => void;
464
+
465
+ export type GetVideoInfoSuccess = {
466
+ /**
467
+ * 画面方向
468
+ */
469
+ orientation : string | null,
470
+ /**
471
+ * 视频格式
472
+ */
473
+ type : string | null,
474
+ /**
475
+ * 视频长度
476
+ */
477
+ duration : number,
478
+ /**
479
+ * 视频大小,单位 kB
480
+ */
481
+ size : number,
482
+ /**
483
+ * 视频的长,单位 px
484
+ */
485
+ height : number,
486
+ /**
487
+ * 视频的宽,单位 px
488
+ */
489
+ width : number,
490
+ /**
491
+ * 视频帧率
492
+ */
493
+ fps : number | null,
494
+ /**
495
+ * 视频码率,单位 kbps
496
+ */
497
+ bitrate : number | null
498
+ };
499
+
500
+ export type GetVideoInfoFail = IMediaError;
501
+ export type GetVideoInfoSuccessCallback = (callback : GetVideoInfoSuccess) => void
502
+ export type GetVideoInfoFailCallback = (callback : GetVideoInfoFail) => void
503
+ export type GetVideoInfoCompleteCallback = ChooseImageCompleteCallback
504
+
505
+ export type GetVideoInfoOptions = {
506
+ /**
507
+ * 视频文件路径,可以是临时文件路径也可以是永久文件路径
508
+ */
509
+ src : string.VideoURIString,
510
+ /**
511
+ * 接口调用成功的回调函数
512
+ */
513
+ success ?: (GetVideoInfoSuccessCallback) | null,
514
+ /**
515
+ * 接口调用失败的回调函数
516
+ */
517
+ fail ?: (GetVideoInfoFailCallback) | null,
518
+ /**
519
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
520
+ */
521
+ complete ?: (GetVideoInfoCompleteCallback) | null
522
+ };
523
+
524
+ export type GetVideoInfo = (options : GetVideoInfoOptions) => void;
525
+
526
+ export type SaveVideoToPhotosAlbumSuccess = {};
527
+
528
+ export type SaveVideoToPhotosAlbumFail = IMediaError;
529
+ export type SaveVideoToPhotosAlbumSuccessCallback = (callback : SaveVideoToPhotosAlbumSuccess) => void
530
+ export type SaveVideoToPhotosAlbumFailCallback = (callback : SaveVideoToPhotosAlbumFail) => void
531
+ export type SaveVideoToPhotosAlbumCompleteCallback = ChooseImageCompleteCallback
532
+
533
+ export type SaveVideoToPhotosAlbumOptions = {
534
+ /**
535
+ * 视频文件路径,可以是临时文件路径也可以是永久文件路径
536
+ */
537
+ filePath : string.VideoURIString,
538
+ /**
539
+ * 接口调用成功的回调函数
540
+ */
541
+ success ?: (SaveVideoToPhotosAlbumSuccessCallback) | null,
542
+ /**
543
+ * 接口调用失败的回调函数
544
+ */
545
+ fail ?: (SaveVideoToPhotosAlbumFailCallback) | null,
546
+ /**
547
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
548
+ */
549
+ complete ?: (SaveVideoToPhotosAlbumCompleteCallback) | null
550
+ };
551
+
552
+ export type SaveVideoToPhotosAlbum = (options : SaveVideoToPhotosAlbumOptions) => void;
553
+
554
+ export type CompressVideoSuccess = {
555
+ /**
556
+ * 压缩后的临时文件地址
557
+ */
558
+ tempFilePath : string,
559
+ /**
560
+ * 压缩后的大小,单位 kB
561
+ */
562
+ size : number
563
+ };
564
+
565
+ export type CompressVideoFail = IMediaError;
566
+ export type CompressVideoSuccessCallback = (callback : CompressVideoSuccess) => void
567
+ export type CompressVideoFailCallback = (callback : CompressVideoFail) => void
568
+ export type CompressVideoCompleteCallback = ChooseImageCompleteCallback
569
+
570
+ export type CompressVideoOptions = {
571
+ /**
572
+ * 视频文件路径,可以是临时文件路径也可以是永久文件路径
573
+ */
574
+ src : string.VideoURIString,
575
+ /**
576
+ * 压缩质量
577
+ * - low: 低
578
+ * - medium: 中
579
+ * - high: 高
580
+ * @type 'low' | 'medium' | 'high'
581
+ */
582
+ quality ?: string | null,
583
+ /**
584
+ * 码率,单位 kbps
585
+ */
586
+ bitrate ?: number | null,
587
+ /**
588
+ * 帧率
589
+ */
590
+ fps ?: number | null,
591
+ /**
592
+ * 相对于原视频的分辨率比例,取值范围(0, 1]
593
+ */
594
+ resolution ?: number | null,
595
+ /**
596
+ * 接口调用成功的回调函数
597
+ */
598
+ success ?: (CompressVideoSuccessCallback) | null,
599
+ /**
600
+ * 接口调用失败的回调函数
601
+ */
602
+ fail ?: (CompressVideoFailCallback) | null,
603
+ /**
604
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
605
+ */
606
+ complete ?: (CompressVideoCompleteCallback) | null
607
+ };
608
+
609
+ export type CompressVideo = (options : CompressVideoOptions) => void;
610
+
611
+ export interface Uni {
612
+ /**
613
+ * 从本地相册选择图片或使用相机拍照
614
+ * @description 从本地相册选择图片或使用相机拍照
615
+ * @uniPlatform {
616
+ * "app": {
617
+ * "android": {
618
+ * "osVer": "4.4",
619
+ * "uniVer": "√",
620
+ * "unixVer": "3.9+"
621
+ * },
622
+ * "ios": {
623
+ * "osVer": "12.0",
624
+ * "uniVer": "√",
625
+ * "unixVer": "4.11"
626
+ * }
627
+ * },
628
+ * "web": {
629
+ * "uniVer": "√",
630
+ * "unixVer": "4.0"
631
+ * }
632
+ * }
633
+ * @uniVueVersion 2,3
634
+ * @example
635
+ * ```typescript
636
+ * uni.chooseImage({
637
+ * count:3,
638
+ * success(e){
639
+ * console.log(JSON.stringify(e))
640
+ * }
641
+ * })
642
+ * ```
643
+ * @tutorial http://uniapp.dcloud.io/api/media/image?id=chooseimage
644
+ * @autotest {
645
+ generated:false
646
+ }
647
+ */
648
+ chooseImage(options : ChooseImageOptions) : void;
649
+ /**
650
+ * 预览图片
651
+ * @description 预览图片
652
+ * @uniPlatform {
653
+ * "app": {
654
+ * "android": {
655
+ * "osVer": "4.4",
656
+ * "uniVer": "√",
657
+ * "unixVer": "3.9+"
658
+ * },
659
+ * "ios": {
660
+ * "osVer": "12.0",
661
+ * "uniVer": "√",
662
+ * "unixVer": "4.11"
663
+ * }
664
+ * },
665
+ * "web": {
666
+ * "uniVer": "√",
667
+ * "unixVer": "4.0"
668
+ * }
669
+ * }
670
+ * @uniVueVersion 2,3
671
+ * @example
672
+ * ```typescript
673
+ * uni.previewImage({
674
+ * urls:['/static/a.jpg','/static/b.jpg'],
675
+ * success(e){
676
+ * console.log(JSON.stringify(e))
677
+ * }
678
+ * })
679
+ * ```
680
+ * @tutorial http://uniapp.dcloud.io/api/media/image?id=previewimage
681
+ * @autotest {
682
+ generated:false
683
+ }
684
+ */
685
+ previewImage(options : PreviewImageOptions) : void;
686
+ /**
687
+ * 关闭图片预览
688
+ * @description 关闭图片预览
689
+ * @uniPlatform {
690
+ * "app": {
691
+ * "android": {
692
+ * "osVer": "4.4",
693
+ * "uniVer": "√",
694
+ * "unixVer": "3.9+"
695
+ * },
696
+ * "ios": {
697
+ * "osVer": "12.0",
698
+ * "uniVer": "√",
699
+ * "unixVer": "4.11"
700
+ * }
701
+ * }
702
+ * }
703
+ * @uniVueVersion 2,3
704
+ * @example
705
+ * ```typescript
706
+ * uni.closePreviewImage({
707
+ * success(e){
708
+ * console.log(JSON.stringify(e))
709
+ * }
710
+ * })
711
+ * ```
712
+ * @tutorial http://uniapp.dcloud.io/api/media/image?id=closepreviewimage
713
+ * @autotest {
714
+ generated:false
715
+ }
716
+ */
717
+ closePreviewImage(options : ClosePreviewImageOptions) : void;
718
+ /**
719
+ * 获取图片信息
720
+ * @description 获取图片信息
721
+ * @uniPlatform {
722
+ * "app": {
723
+ * "android": {
724
+ * "osVer": "4.4",
725
+ * "uniVer": "√",
726
+ * "unixVer": "3.9+"
727
+ * }
728
+ * }
729
+ * }
730
+ * @uniVueVersion 2,3
731
+ * @example
732
+ * ```typescript
733
+ * uni.getImageInfo({
734
+ * src:'/static/a.jpg',
735
+ * success(e){
736
+ * console.log(JSON.stringify(e))
737
+ * },
738
+ * })
739
+ * ```
740
+ * @tutorial http://uniapp.dcloud.io/api/media/image?id=getimageinfo
741
+ * @autotest {
742
+ generated:false,
743
+ case:[
744
+ {
745
+ input:[{"src":"/static/a.jpg"}]
746
+ }
747
+ ]
748
+ }
749
+ */
750
+ getImageInfo(options : GetImageInfoOptions) : void;
751
+ /**
752
+ * 保存图片到系统相册
753
+ * @description 保存图片到系统相册
754
+ * @uniPlatform {
755
+ * "app": {
756
+ * "android": {
757
+ * "osVer": "4.4",
758
+ * "uniVer": "√",
759
+ * "unixVer": "3.9+"
760
+ * },
761
+ * "ios": {
762
+ * "osVer": "12.0",
763
+ * "uniVer": "",
764
+ * "unixVer": "4.11"
765
+ * }
766
+ * }
767
+ * }
768
+ * @uniVueVersion 2,3
769
+ * @example
770
+ * ```typescript
771
+ * uni.saveImageToPhotosAlbum({
772
+ * filePath:'/static/a.jpg',
773
+ * success(e){
774
+ * console.log(JSON.stringify(e))
775
+ * },
776
+ * })
777
+ * ```
778
+ * @tutorial http://uniapp.dcloud.io/api/media/image?id=saveimagetophotosalbum
779
+ * @autotest {
780
+ generated:false,
781
+ case:[
782
+ {
783
+ input:[{"filePath":"/static/a.jpg"}]
784
+ }
785
+ ]
786
+ }
787
+ */
788
+ saveImageToPhotosAlbum(options : SaveImageToPhotosAlbumOptions) : void;
789
+ /**
790
+ * 压缩图片
791
+ * @description 压缩图片
792
+ * @uniPlatform {
793
+ * "app": {
794
+ * "android": {
795
+ * "osVer": "4.4",
796
+ * "uniVer": "√",
797
+ * "unixVer": "3.9+"
798
+ * }
799
+ * }
800
+ * }
801
+ * @uniVueVersion 2,3
802
+ * @example
803
+ * ```typescript
804
+ * uni.compressImage({
805
+ * src:'/static/a.jpg',
806
+ * quality:80,
807
+ * success(e){
808
+ * console.log(JSON.stringify(e))
809
+ * },
810
+ * })
811
+ * ```
812
+ * @tutorial http://uniapp.dcloud.io/api/media/image?id=compressimage
813
+ * @autotest {
814
+ generated:false,
815
+ case:[
816
+ {
817
+ input:[{"src":"/static/d.jpg"},{"rotate","30"}]
818
+ }
819
+ ]
820
+ }
821
+ */
822
+ compressImage(options : CompressImageOptions) : void;
823
+ /**
824
+ * 拍摄视频或从手机相册中选视频,返回视频的临时文件路径。
825
+ * @description 拍摄视频或从手机相册中选视频,返回视频的临时文件路径。
826
+ * @uniPlatform {
827
+ * "app": {
828
+ * "android": {
829
+ * "osVer": "4.4",
830
+ * "uniVer": "√",
831
+ * "unixVer": "3.9+"
832
+ * }
833
+ * }
834
+ * }
835
+ * @uniVueVersion 2,3
836
+ * @example
837
+ * ```typescript
838
+ * uni.chooseVideo({
839
+ * success(e){
840
+ * console.log(JSON.stringify(e))
841
+ * },
842
+ * })
843
+ * ```
844
+ * @tutorial http://uniapp.dcloud.io/api/media/video?id=choosevideo
845
+ *
846
+ */
847
+ chooseVideo(options : ChooseVideoOptions) : void;
848
+ /**
849
+ * 获取视频详细信息
850
+ * @description 获取视频详细信息
851
+ * @uniPlatform {
852
+ * "app": {
853
+ * "android": {
854
+ * "osVer": "4.4",
855
+ * "uniVer": "√",
856
+ * "unixVer": "3.9+"
857
+ * }
858
+ * }
859
+ * }
860
+ * @uniVueVersion 2,3
861
+ * @example
862
+ * ```typescript
863
+ * uni.GetVideoInfo({
864
+ * src:"/static/a.mp4",
865
+ * success(e){
866
+ * console.log(JSON.stringify(e))
867
+ * },
868
+ * })
869
+ * ```
870
+ * @tutorial http://uniapp.dcloud.io/api/media/video?id=getvideoinfo
871
+ *
872
+ */
873
+ getVideoInfo(options : GetVideoInfoOptions) : void;
874
+ /**
875
+ * 保存视频到系统相册
876
+ * @description 保存视频到系统相册
877
+ * @uniPlatform {
878
+ * "app": {
879
+ * "android": {
880
+ * "osVer": "4.4",
881
+ * "uniVer": "√",
882
+ * "unixVer": "3.9+"
883
+ * }
884
+ * }
885
+ * }
886
+ * @uniVueVersion 2,3
887
+ * @example
888
+ * ```typescript
889
+ * uni.saveVideoToPhotosAlbum({
890
+ * filePath:"/static/a.mp4",
891
+ * success(e){
892
+ * console.log(JSON.stringify(e))
893
+ * },
894
+ * })
895
+ * ```
896
+ * @tutorial http://uniapp.dcloud.io/api/media/video?id=savevideotophotosalbum
897
+ *
898
+ */
899
+ saveVideoToPhotosAlbum(options : SaveVideoToPhotosAlbumOptions) : void;
900
+ /**
901
+ * 压缩视频
902
+ * @description 压缩视频
903
+ * @uniPlatform {
904
+ * "app": {
905
+ * "android": {
906
+ * "osVer": "4.4",
907
+ * "uniVer": "√",
908
+ * "unixVer": "3.9+"
909
+ * }
910
+ * }
911
+ * }
912
+ * @uniVueVersion 2,3
913
+ * @example
914
+ * ```typescript
915
+ * uni.compressVideo({
916
+ * src:"/static/a.mp4",
917
+ * quality:"low",
918
+ * success(e){
919
+ * console.log(JSON.stringify(e))
920
+ * },
921
+ * })
922
+ * ```
923
+ * @tutorial http://uniapp.dcloud.io/api/media/video?id=compressvideo
924
+ *
925
+ */
926
+ compressVideo(options : CompressVideoOptions) : void;
907
927
  }