@dcloudio/uni-app-x 0.5.10 → 0.5.12

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.
@@ -1,171 +1,318 @@
1
- import { ComponentPublicInstance } from 'vue'
1
+ import { ComponentPublicInstance } from 'vue';
2
2
 
3
- export type CreateVideoContext = (videoId: VideoIdString, component?: ComponentPublicInstance | null) => VideoContext | null;
3
+ export type CreateVideoContext = (videoId : string, component ?: ComponentPublicInstance | null) => VideoContext | null;
4
4
 
5
5
  export type Danmu = {
6
- /**
7
- * 弹幕文字
8
- */
9
- text: string | null,
10
- /**
11
- * 弹幕颜色
12
- */
13
- color: string | null,
14
- /**
15
- * 显示时刻
16
- */
17
- time: number | null
6
+ /**
7
+ * 弹幕文字
8
+ */
9
+ text : string | null,
10
+ /**
11
+ * 弹幕颜色
12
+ */
13
+ color : string | null,
14
+ /**
15
+ * 显示时刻
16
+ */
17
+ time : number | null
18
18
  };
19
19
 
20
20
  export type RequestFullScreenOptions = {
21
- /**
22
- * direction
23
- * - 0: 正常竖向
24
- * - 90: 屏幕逆时针90度
25
- * - -90: 屏幕顺时针90度
26
- * @type 0 | 90 | -90
27
- */
28
- direction: number | null
21
+ /**
22
+ * direction
23
+ * - 0: 正常竖向
24
+ * - 90: 屏幕逆时针90度
25
+ * - -90: 屏幕顺时针90度
26
+ * @type 0 | 90 | -90
27
+ */
28
+ direction : number | null
29
29
  };
30
30
 
31
31
  export interface VideoContext {
32
- /**
33
- * @description 播放
34
- * @uniPlatform {
35
- * "app": {
36
- * "android": {
37
- * "osVer": "4.4",
38
- * "uniVer": "√",
39
- * "unixVer": "3.9.0"
40
- * }
41
- * }
42
- * }
43
- * @uniVueVersion 2,3
44
- */
45
- play(): void;
46
- /**
47
- * @description 暂停
48
- * @uniPlatform {
49
- * "app": {
50
- * "android": {
51
- * "osVer": "4.4",
52
- * "uniVer": "√",
53
- * "unixVer": "3.9.0"
54
- * }
55
- * }
56
- * }
57
- * @uniVueVersion 2,3
58
- */
59
- pause(): void;
60
- /**
61
- * @description 跳转到指定位置
62
- * @param {number} position 跳转到指定位置(秒)
63
- * @uniPlatform {
64
- * "app": {
65
- * "android": {
66
- * "osVer": "4.4",
67
- * "uniVer": "√",
68
- * "unixVer": "3.9.0"
69
- * }
70
- * }
71
- * }
72
- * @uniVueVersion 2,3
73
- */
74
- seek(position: number): void;
75
- /**
76
- * @description 停止视频
77
- * @uniPlatform {
78
- * "app": {
79
- * "android": {
80
- * "osVer": "4.4",
81
- * "uniVer": "√",
82
- * "unixVer": "3.9.0"
83
- * }
84
- * }
85
- * }
86
- * @uniVueVersion 2,3
87
- */
88
- stop(): void;
89
- /**
90
- * @description 发送弹幕
91
- * @param {Danmu} 属性 text, color
92
- * @uniPlatform {
93
- * "app": {
94
- * "android": {
95
- * "osVer": "4.4",
96
- * "uniVer": "√",
97
- * "unixVer": "3.9.0"
98
- * }
99
- * }
100
- * }
101
- * @uniVueVersion 2,3
102
- */
103
- sendDanmu(danmu: Danmu): void;
104
- /**
105
- * @description 设置倍速播放
106
- * @param {number} rate, 支持倍率 0.5/0.8/1.0/1.25/1.5
107
- * @uniPlatform {
108
- * "app": {
109
- * "android": {
110
- * "osVer": "4.4",
111
- * "uniVer": "√",
112
- * "unixVer": "3.9.0"
113
- * }
114
- * }
115
- * }
116
- * @uniVueVersion 2,3
117
- */
118
- playbackRate(rate: number): void;
119
- /**
120
- * @description 进入全屏
121
- * @param {RequestFullScreenOptions} direction, 0|正常竖向, 90|屏幕逆时针90度, -90|屏幕顺时针90度
122
- * @uniPlatform {
123
- * "app": {
124
- * "android": {
125
- * "osVer": "4.4",
126
- * "uniVer": "√",
127
- * "unixVer": "3.9.0"
128
- * }
129
- * }
130
- * }
131
- * @uniVueVersion 2,3
132
- */
133
- requestFullScreen(direction: RequestFullScreenOptions | null): void;
134
- /**
135
- * 退出全屏
136
- * @description 退出全屏
137
- * @uniPlatform {
138
- * "app": {
139
- * "android": {
140
- * "osVer": "4.4",
141
- * "uniVer": "√",
142
- * "unixVer": "3.9.0"
143
- * }
144
- * }
145
- * }
146
- * @uniVueVersion 2,3
147
- */
148
- exitFullScreen(): void;
32
+ /**
33
+ * @description 播放
34
+ * @uniPlatform {
35
+ * "app": {
36
+ * "android": {
37
+ * "osVer": "4.4",
38
+ * "uniVer": "√",
39
+ * "unixVer": "3.9.0"
40
+ * }
41
+ * }
42
+ * }
43
+ * @uniVueVersion 2,3
44
+ */
45
+ play() : void;
46
+ /**
47
+ * @description 暂停
48
+ * @uniPlatform {
49
+ * "app": {
50
+ * "android": {
51
+ * "osVer": "4.4",
52
+ * "uniVer": "√",
53
+ * "unixVer": "3.9.0"
54
+ * }
55
+ * }
56
+ * }
57
+ * @uniVueVersion 2,3
58
+ */
59
+ pause() : void;
60
+ /**
61
+ * @description 跳转到指定位置
62
+ * @param {number} position 跳转到指定位置(秒)
63
+ * @uniPlatform {
64
+ * "app": {
65
+ * "android": {
66
+ * "osVer": "4.4",
67
+ * "uniVer": "√",
68
+ * "unixVer": "3.9.0"
69
+ * }
70
+ * }
71
+ * }
72
+ * @uniVueVersion 2,3
73
+ */
74
+ seek(position : number) : void;
75
+ /**
76
+ * @description 停止视频
77
+ * @uniPlatform {
78
+ * "app": {
79
+ * "android": {
80
+ * "osVer": "4.4",
81
+ * "uniVer": "√",
82
+ * "unixVer": "3.9.0"
83
+ * }
84
+ * }
85
+ * }
86
+ * @uniVueVersion 2,3
87
+ */
88
+ stop() : void;
89
+ /**
90
+ * @description 发送弹幕
91
+ * @param {Danmu} 属性 text, color
92
+ * @uniPlatform {
93
+ * "app": {
94
+ * "android": {
95
+ * "osVer": "4.4",
96
+ * "uniVer": "√",
97
+ * "unixVer": "3.9.0"
98
+ * }
99
+ * }
100
+ * }
101
+ * @uniVueVersion 2,3
102
+ */
103
+ sendDanmu(danmu : Danmu) : void;
104
+ /**
105
+ * @description 设置倍速播放
106
+ * @param {number} rate, 支持倍率 0.5/0.8/1.0/1.25/1.5
107
+ * @uniPlatform {
108
+ * "app": {
109
+ * "android": {
110
+ * "osVer": "4.4",
111
+ * "uniVer": "√",
112
+ * "unixVer": "3.9.0"
113
+ * }
114
+ * }
115
+ * }
116
+ * @uniVueVersion 2,3
117
+ */
118
+ playbackRate(rate : number) : void;
119
+ /**
120
+ * @description 进入全屏
121
+ * @param {RequestFullScreenOptions} direction, 0|正常竖向, 90|屏幕逆时针90度, -90|屏幕顺时针90度
122
+ * @uniPlatform {
123
+ * "app": {
124
+ * "android": {
125
+ * "osVer": "4.4",
126
+ * "uniVer": "√",
127
+ * "unixVer": "3.9.0"
128
+ * }
129
+ * }
130
+ * }
131
+ * @uniVueVersion 2,3
132
+ */
133
+ requestFullScreen(direction : RequestFullScreenOptions | null) : void;
134
+ /**
135
+ * 退出全屏
136
+ * @description 退出全屏
137
+ * @uniPlatform {
138
+ * "app": {
139
+ * "android": {
140
+ * "osVer": "4.4",
141
+ * "uniVer": "√",
142
+ * "unixVer": "3.9.0"
143
+ * }
144
+ * }
145
+ * }
146
+ * @uniVueVersion 2,3
147
+ */
148
+ exitFullScreen() : void;
149
149
  }
150
150
 
151
151
  export interface Uni {
152
- /**
153
- * 创建并返回 video 上下文 videoContext 对象
154
- * @description 创建并返回 video 上下文 videoContext 对象
155
- * @uniPlatform {
156
- * "app": {
157
- * "android": {
158
- * "osVer": "4.4",
159
- * "uniVer": "√",
160
- * "unixVer": "√"
161
- * }
162
- * }
163
- * }
164
- * @uniVueVersion 2,3
165
- * @return {VideoContext} 视频对象
166
- *
167
- * @tutorial http://uniapp.dcloud.io/api/media/video-context?id=createVideoContext
168
- *
169
- */
170
- createVideoContext(videoId : string | HBuilderX.VideoIdString, component?: ComponentPublicInstance | null) : VideoContext | null
152
+ /**
153
+ * 创建并返回 video 上下文 videoContext 对象
154
+ * @description 创建并返回 video 上下文 videoContext 对象
155
+ * @uniPlatform {
156
+ * "app": {
157
+ * "android": {
158
+ * "osVer": "4.4",
159
+ * "uniVer": "√",
160
+ * "unixVer": "√"
161
+ * }
162
+ * }
163
+ * }
164
+ * @uniVueVersion 2,3
165
+ * @return {VideoContext} 视频对象
166
+ *
167
+ * @tutorial http://uniapp.dcloud.io/api/media/video-context?id=createVideoContext
168
+ *
169
+ */
170
+ createVideoContext(videoId : string, component ?: ComponentPublicInstance | null) : VideoContext | null
171
+ }
172
+
173
+ /**
174
+ * timeupdate 事件
175
+ * 播放进度变化时触发
176
+ */
177
+ export class VideoTimeUpdateEvent extends CustomEvent<VideoTimeUpdateEventDetail> {
178
+ constructor(detail : VideoTimeUpdateEventDetail) {
179
+ super("timeupdate", detail);
180
+ }
181
+ }
182
+
183
+ export type VideoTimeUpdateEventDetail = {
184
+ /**
185
+ * 当前进度
186
+ */
187
+ currentTime : number,
188
+ /**
189
+ * 总进度
190
+ */
191
+ duration : number
192
+ }
193
+
194
+ /**
195
+ * fullscreenchange 事件
196
+ * 当视频进入和退出全屏是触发
197
+ */
198
+ export class VideoFullScreenChangeEvent extends CustomEvent<VideoFullScreenChangeEventDetail> {
199
+ constructor(detail : VideoFullScreenChangeEventDetail) {
200
+ super("fullscreenchange", detail);
201
+ }
202
+ }
203
+
204
+ export type VideoFullScreenChangeEventDetail = {
205
+ /**
206
+ * 是否全屏
207
+ */
208
+ fullScreen : boolean,
209
+ /**
210
+ * 横竖屏,取值 vertical 或 horizontal
211
+ */
212
+ direction : string
213
+ }
214
+
215
+ /**
216
+ * error 事件
217
+ * 视频播放出错时触发
218
+ */
219
+ export class VideoErrorEvent extends CustomEvent<VideoError> {
220
+ constructor(detail : VideoError) {
221
+ super("error", detail);
222
+ }
223
+ }
224
+
225
+ /**
226
+ * progress 事件
227
+ * 加载进度变化时触发
228
+ */
229
+ export class VideoProgressChangeEvent extends CustomEvent<VideoProgressChangeEventDetail> {
230
+ constructor(detail : VideoProgressChangeEventDetail) {
231
+ super("progress", detail);
232
+ }
233
+ }
234
+
235
+ export type VideoProgressChangeEventDetail = {
236
+ /**
237
+ * 加载进度百分比
238
+ */
239
+ buffered : number
240
+ }
241
+
242
+ /**
243
+ * fullscreenclick 事件
244
+ * 视频播放全屏播放时点击事件
245
+ */
246
+ export class VideoFullScreenClickEvent extends CustomEvent<VideoFullScreenClickEventDetail> {
247
+ constructor(detail : VideoFullScreenClickEventDetail) {
248
+ super("fullscreenclick", detail);
249
+ }
250
+ }
251
+
252
+ export type VideoFullScreenClickEventDetail = {
253
+ /**
254
+ * 点击点相对于屏幕左侧边缘的 X 轴坐标
255
+ */
256
+ screenX : number,
257
+ /**
258
+ * 点击点相对于屏幕顶部边缘的 Y 轴坐标
259
+ */
260
+ screenY : number,
261
+ /**
262
+ * 屏幕总宽度
263
+ */
264
+ screenWidth : number,
265
+ /**
266
+ * 屏幕总高度
267
+ */
268
+ screenHeight : number
269
+ }
270
+
271
+ /**
272
+ * controlstoggle 事件
273
+ * 切换播放控件显示隐藏时触发
274
+ */
275
+ export class VideoControlsToggleEvent extends CustomEvent<VideoControlsToggleEventDetail> {
276
+ constructor(detail : VideoControlsToggleEventDetail) {
277
+ super("controlstoggle", detail);
278
+ }
279
+ }
280
+
281
+ export type VideoControlsToggleEventDetail = {
282
+ /**
283
+ * 是否显示
284
+ */
285
+ show : boolean
286
+ }
287
+
288
+ /**
289
+ * 统一错误主题(模块)名称
290
+ */
291
+ export const UniErrorSubject = 'uni-video';
292
+
293
+ /**
294
+ * 统一错误码
295
+ * 100001 网络错误
296
+ * 200001 内部错误
297
+ * 300001 SDK错误
298
+ */
299
+ export type VideoErrorCode = 100001 | 200001 | 300001
300
+
301
+ /**
302
+ * 统一错误描述信息
303
+ */
304
+ export const UniErrors : Map<VideoErrorCode, string> = new Map([
305
+ [100001, 'network error'],
306
+ [200001, 'internal error'],
307
+ [300001, 'sdk error']
308
+ ]);
309
+
310
+ export class VideoError extends UniError {
311
+ constructor(errCode : VideoErrorCode, cause : SourceError | null = null) {
312
+ super();
313
+ this.errSubject = UniErrorSubject;
314
+ this.errCode = errCode;
315
+ this.errMsg = UniErrors[errCode] ?? "";
316
+ this.cause = cause;
317
+ }
171
318
  }
@@ -0,0 +1 @@
1
+ /// <reference path='./lib/uni-facialRecognitionVerify/utssdk/index.d.ts' />
@@ -0,0 +1,15 @@
1
+ import {
2
+ StartFacialRecognitionVerifySuccess as StartFacialRecognitionVerifySuccessOrigin,
3
+ StartFacialRecognitionVerifyOptions as StartFacialRecognitionVerifyOptionsOrigin,
4
+ GetFacialRecognitionMetaInfo as GetFacialRecognitionMetaInfoOrigin,
5
+ StartFacialRecognitionVerify as StartFacialRecognitionVerifyOrigin,
6
+ Uni as UniOrigin
7
+ } from './interface'
8
+
9
+ declare global {
10
+ type StartFacialRecognitionVerifySuccess = StartFacialRecognitionVerifySuccessOrigin
11
+ type StartFacialRecognitionVerifyOptions = StartFacialRecognitionVerifyOptionsOrigin
12
+ type GetFacialRecognitionMetaInfo = GetFacialRecognitionMetaInfoOrigin
13
+ type StartFacialRecognitionVerify = StartFacialRecognitionVerifyOrigin
14
+ interface Uni extends UniOrigin { }
15
+ }
@@ -0,0 +1,66 @@
1
+ export type StartFacialRecognitionVerifySuccess = {
2
+ /**
3
+ * 错误码
4
+ */
5
+ errCode: number,
6
+ /**
7
+ * 调用API的名称
8
+ */
9
+ errSubject: string,
10
+ /**
11
+ * 错误的详细信息
12
+ */
13
+ errMsg: string,
14
+ /**
15
+ * 错误来源
16
+ */
17
+ cause?: any
18
+ }
19
+
20
+ export type StartFacialRecognitionVerifyOptions = {
21
+ /**
22
+ * certifyId 调用实人认证的id
23
+ */
24
+ certifyId: string,
25
+ /**
26
+ * 活体检测页面的进度条颜色。
27
+ */
28
+ progressBarColor?: string,
29
+ /**
30
+ * 认证界面UI朝向。仅Android支持
31
+ */
32
+ screenOrientation?: string,
33
+ /**
34
+ * 成功回调
35
+ */
36
+ success?: (res: StartFacialRecognitionVerifySuccess) => void,
37
+ /**
38
+ * 失败回调
39
+ */
40
+ fail?: (res: UniError) => void,
41
+ /**
42
+ * 完成回调
43
+ */
44
+ complete?: (res: any) => void
45
+ }
46
+
47
+ /**
48
+ * 获取阿里云实人认证meta info
49
+ */
50
+ export type GetFacialRecognitionMetaInfo = () => string
51
+
52
+ /**
53
+ * 启动人脸识别
54
+ */
55
+ export type StartFacialRecognitionVerify = (faceStyle: StartFacialRecognitionVerifyOptions) => void
56
+
57
+ export interface Uni {
58
+ /**
59
+ * 获取阿里云实人认证meta info
60
+ */
61
+ getFacialRecognitionMetaInfo() : string,
62
+ /**
63
+ * 启动人脸识别
64
+ */
65
+ startFacialRecognitionVerify(faceStyle: StartFacialRecognitionVerifyOptions) : void
66
+ }