ezuikit-flv 1.0.2 → 1.0.3-alpha.2
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/CHANGELOG.md +11 -2
- package/README.md +6 -83
- package/decoder.js +3 -3
- package/index.js +6 -18
- package/package.json +2 -2
- package/types/constant/index.d.ts +14 -1
- package/types/index.d.ts +121 -21
- package/types/player/base-player.d.ts +9 -0
- package/types/player/hard-player/index.d.ts +15 -9
- package/types/player/hard-player/videoLoader.d.ts +3 -2
- package/types/player/index.d.ts +2 -2
- package/types/player/interface.d.ts +2 -1
- package/types/player/soft-player/canvasLoader.d.ts +5 -0
- package/types/player/soft-player/index.d.ts +4 -9
- package/types/services/HttpUtil.d.ts +19 -0
- package/types/services/api.d.ts +7 -0
- package/types/services/getAddress.d.ts +22 -0
- package/types/services/getLocalVideoUnifyQuery.d.ts +15 -0
- package/types/services/getVideoQuality.d.ts +38 -0
- package/types/services/setVideoLevel.d.ts +5 -0
- package/types/stream/index.d.ts +1 -2
- package/types/typedefs.d.ts +48 -6
- package/types/utils/debug.d.ts +1 -1
- package/types/utils/formatDateTIme.d.ts +6 -0
- package/types/utils/getInfoByUrl.d.ts +14 -0
- package/types/utils/index.d.ts +1 -3
- package/types/utils/number.d.ts +1 -0
- package/types/flv-mse/flv.min.d.ts +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ezuikit-flv",
|
|
3
|
-
"version": "1.0.2",
|
|
3
|
+
"version": "1.0.3-alpha.2",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"types": "./types",
|
|
6
6
|
"author": "Ezviz-OpenBiz",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@ezuikit/player-base": "0.1.0-alpha.1",
|
|
18
18
|
"@ezuikit/utils-collect": "0.1.0-beta.1",
|
|
19
19
|
"@ezuikit/utils-logger": "1.0.1",
|
|
20
|
-
"browser-tool": "
|
|
20
|
+
"browser-tool": "1.0.5",
|
|
21
21
|
"eventemitter3": "^5.0.1",
|
|
22
22
|
"recordrtc": "5.6.2",
|
|
23
23
|
"screenfull": "5.1.0"
|
|
@@ -25,7 +25,7 @@ export namespace DEFAULT_PLAYER_OPTIONS {
|
|
|
25
25
|
export let loadingTimeoutReplayTimes: number;
|
|
26
26
|
export let heartTimeoutReplayTimes: number;
|
|
27
27
|
export let keepScreenOn: boolean;
|
|
28
|
-
export let
|
|
28
|
+
export let isMute: boolean;
|
|
29
29
|
export let hasAudio: boolean;
|
|
30
30
|
export let volume: number;
|
|
31
31
|
export let hasVideo: boolean;
|
|
@@ -93,8 +93,10 @@ export namespace EVENTS {
|
|
|
93
93
|
export let mute: string;
|
|
94
94
|
export let load: string;
|
|
95
95
|
export let loading: string;
|
|
96
|
+
export let loaded: string;
|
|
96
97
|
export let videoInfo: string;
|
|
97
98
|
export let timeUpdate: string;
|
|
99
|
+
export let timeUpdateOSD: string;
|
|
98
100
|
export let audioInfo: string;
|
|
99
101
|
export let log: string;
|
|
100
102
|
export let error: string;
|
|
@@ -127,6 +129,13 @@ export namespace EVENTS {
|
|
|
127
129
|
export let videoTimeUpdate: string;
|
|
128
130
|
export let videoSyncAudio: string;
|
|
129
131
|
export let playToRenderTimes: string;
|
|
132
|
+
export let localVideoRecords: string;
|
|
133
|
+
export let getDefinitionListResult: string;
|
|
134
|
+
export let definitionChange: string;
|
|
135
|
+
export let definitionListChange: string;
|
|
136
|
+
export let playbackRateListChange: string;
|
|
137
|
+
export let playbackRateChange: string;
|
|
138
|
+
export let decoderLoaded: string;
|
|
130
139
|
}
|
|
131
140
|
export namespace FLV_EVENTS {
|
|
132
141
|
import load_1 = EVENTS.load;
|
|
@@ -266,3 +275,7 @@ export namespace FETCH_ERROR {
|
|
|
266
275
|
let abortError2: string;
|
|
267
276
|
let abort: string;
|
|
268
277
|
}
|
|
278
|
+
/**
|
|
279
|
+
* 开放平台https接口
|
|
280
|
+
*/
|
|
281
|
+
export const HTTP_ENV_DOMAIN: "https://open.ys7.com/";
|
package/types/index.d.ts
CHANGED
|
@@ -2,16 +2,14 @@ export default EzuikitFlv;
|
|
|
2
2
|
/**
|
|
3
3
|
* @classdesc EzuikitFlv.js 播放flv直播流, 支持播放h264/h265的直播视频流
|
|
4
4
|
* @example
|
|
5
|
-
* ```js
|
|
6
5
|
* const flv = new EzuikitFlv({
|
|
7
6
|
* id: "EleId",
|
|
8
7
|
* url: "https://open.ys7.com/v3/openlive/E71992743_1_1.flv"
|
|
9
8
|
* })
|
|
10
|
-
* ```
|
|
11
9
|
*/
|
|
12
10
|
declare class EzuikitFlv extends EventEmitter<string | symbol, any> {
|
|
13
11
|
/**
|
|
14
|
-
* @description
|
|
12
|
+
* @description EzuikitFlv error events
|
|
15
13
|
* @static
|
|
16
14
|
* @member
|
|
17
15
|
* @example
|
|
@@ -33,6 +31,17 @@ declare class EzuikitFlv extends EventEmitter<string | symbol, any> {
|
|
|
33
31
|
wasmDecodeError: string;
|
|
34
32
|
webglAlignmentError: string;
|
|
35
33
|
};
|
|
34
|
+
static QUALITY_ENUM: {
|
|
35
|
+
0: string;
|
|
36
|
+
1: string;
|
|
37
|
+
2: string;
|
|
38
|
+
3: string;
|
|
39
|
+
4: string;
|
|
40
|
+
5: string;
|
|
41
|
+
6: string;
|
|
42
|
+
};
|
|
43
|
+
/** 旋转角度 */
|
|
44
|
+
static ROTATE: number[];
|
|
36
45
|
/** */
|
|
37
46
|
static TIMEOUT: {
|
|
38
47
|
loadingTimeout: string;
|
|
@@ -44,6 +53,7 @@ declare class EzuikitFlv extends EventEmitter<string | symbol, any> {
|
|
|
44
53
|
* @returns {FlvOptions}
|
|
45
54
|
*/
|
|
46
55
|
private static _setOptions;
|
|
56
|
+
/** 版本号 EzuikitFlv.version */
|
|
47
57
|
static version: string;
|
|
48
58
|
/**
|
|
49
59
|
* @description 静态方法 判断是否支持播放地址
|
|
@@ -54,9 +64,7 @@ declare class EzuikitFlv extends EventEmitter<string | symbol, any> {
|
|
|
54
64
|
* @static
|
|
55
65
|
*
|
|
56
66
|
* @example
|
|
57
|
-
* ```js
|
|
58
67
|
* EzuikitFlv.supportType({url: "https://open.ys7.com/v3/openlive/E71992743_1_1.flv", type:'flv'})
|
|
59
|
-
* ```
|
|
60
68
|
*/
|
|
61
69
|
static supportType(options: {
|
|
62
70
|
url?: string | undefined;
|
|
@@ -68,11 +76,81 @@ declare class EzuikitFlv extends EventEmitter<string | symbol, any> {
|
|
|
68
76
|
*/
|
|
69
77
|
constructor(options: FlvOptions);
|
|
70
78
|
event: EventEmitter<string | symbol, any>;
|
|
79
|
+
urlInfo: {};
|
|
80
|
+
seekTime: number;
|
|
71
81
|
_opt: FlvOptions;
|
|
72
82
|
$container: any;
|
|
73
83
|
_loadingTimeoutReplayTimes: number;
|
|
74
84
|
_heartTimeoutReplayTimes: number;
|
|
75
85
|
events: Events;
|
|
86
|
+
_videoInfo: {};
|
|
87
|
+
definitionList: any[];
|
|
88
|
+
definition: {};
|
|
89
|
+
/**
|
|
90
|
+
* @private
|
|
91
|
+
*/
|
|
92
|
+
private _playbackRate;
|
|
93
|
+
playbackRateList: number[];
|
|
94
|
+
playbackRecords: any[];
|
|
95
|
+
/**
|
|
96
|
+
* https 接口调用 仅针对萤石设备
|
|
97
|
+
* @since @1.0.3
|
|
98
|
+
* @private
|
|
99
|
+
*/
|
|
100
|
+
private _httpServices;
|
|
101
|
+
/**
|
|
102
|
+
* @description 自定义设置清晰度列表, 仅对萤石设备预览生效, 需要第一次 definitionListChange 事件监听后调用, 不然会被接口覆盖
|
|
103
|
+
* @param {VideoLevel} list
|
|
104
|
+
* @since 1.0.3
|
|
105
|
+
* @returns {void}
|
|
106
|
+
*/
|
|
107
|
+
setDefinitionList(list: VideoLevel): void;
|
|
108
|
+
/**
|
|
109
|
+
* @description 切换清晰度,仅对萤石设备预览生效
|
|
110
|
+
* @param {VideoLevel} definition 清晰
|
|
111
|
+
* @since 1.0.3
|
|
112
|
+
* @returns {void}
|
|
113
|
+
*/
|
|
114
|
+
switchDefinition(definition: VideoLevel): void;
|
|
115
|
+
/**
|
|
116
|
+
* @description 自定义设置倍速列表, 仅对萤石设备回放生效
|
|
117
|
+
* @param {Array<number>} list
|
|
118
|
+
* @since 1.0.3
|
|
119
|
+
* @returns {void}
|
|
120
|
+
*/
|
|
121
|
+
setPlaybackRateList(list: Array<number>): void;
|
|
122
|
+
set playbackRate(rate: number);
|
|
123
|
+
get playbackRate(): number;
|
|
124
|
+
/**
|
|
125
|
+
* @description 切换倍速,仅对萤石设备回放生效
|
|
126
|
+
* @param {number} rate
|
|
127
|
+
* @since 1.0.3
|
|
128
|
+
* @returns {void}
|
|
129
|
+
*/
|
|
130
|
+
switchPlaybackRate(rate: number): void;
|
|
131
|
+
/**
|
|
132
|
+
* @description 获取回放地址
|
|
133
|
+
* @private
|
|
134
|
+
* @returns {Promise<number>} // 0 成功 1 失败
|
|
135
|
+
*/
|
|
136
|
+
private _getNewPlaybackPlayUrl;
|
|
137
|
+
/**
|
|
138
|
+
* @description 跳转到指定时间 仅对萤石设备回放生效
|
|
139
|
+
* @param {stirng} time seekTime YYYYMMDDhhmmss
|
|
140
|
+
*/
|
|
141
|
+
seek(seekTime: any): Promise<void>;
|
|
142
|
+
/**
|
|
143
|
+
* @description 是否是回放
|
|
144
|
+
* @param {string} url
|
|
145
|
+
* @private
|
|
146
|
+
* @since @1.0.3
|
|
147
|
+
* @returns {boolean}
|
|
148
|
+
*/
|
|
149
|
+
private _isEzvizPlayback;
|
|
150
|
+
/**
|
|
151
|
+
* 当前是否在播放中
|
|
152
|
+
*/
|
|
153
|
+
get playing(): any;
|
|
76
154
|
/**
|
|
77
155
|
* @description 销毁
|
|
78
156
|
* @example
|
|
@@ -176,14 +254,6 @@ declare class EzuikitFlv extends EventEmitter<string | symbol, any> {
|
|
|
176
254
|
* flv.pause()
|
|
177
255
|
*/
|
|
178
256
|
pause(): Promise<unknown>;
|
|
179
|
-
/**
|
|
180
|
-
* @description 关闭视频,不释放底层资源
|
|
181
|
-
* @private
|
|
182
|
-
* @returns {void}
|
|
183
|
-
* @example
|
|
184
|
-
* flv.close()
|
|
185
|
-
*/
|
|
186
|
-
private close;
|
|
187
257
|
/**
|
|
188
258
|
* @description 清理画布为黑色背景
|
|
189
259
|
* @private
|
|
@@ -213,6 +283,7 @@ declare class EzuikitFlv extends EventEmitter<string | symbol, any> {
|
|
|
213
283
|
* @param {number=} width 宽
|
|
214
284
|
* @param {number=} height 高
|
|
215
285
|
* @example
|
|
286
|
+
*
|
|
216
287
|
* flv.resize()
|
|
217
288
|
*/
|
|
218
289
|
resize(width?: number | undefined, height?: number | undefined): void;
|
|
@@ -226,8 +297,8 @@ declare class EzuikitFlv extends EventEmitter<string | symbol, any> {
|
|
|
226
297
|
private setBufferTime;
|
|
227
298
|
/**
|
|
228
299
|
* @description 设置旋转角度,支持,0(默认), 90, 180, 270 四个值。
|
|
300
|
+
* @param {number} deg 旋转角度取值 EzuikitFlv.ROTATE
|
|
229
301
|
* @returns {Promise}
|
|
230
|
-
* @param {number} deg
|
|
231
302
|
* @example
|
|
232
303
|
* flv.setRotate(90) // 旋转90度
|
|
233
304
|
*/
|
|
@@ -251,12 +322,27 @@ declare class EzuikitFlv extends EventEmitter<string | symbol, any> {
|
|
|
251
322
|
* @param {Boolean} flag
|
|
252
323
|
*/
|
|
253
324
|
private _setFullscreen;
|
|
325
|
+
/**
|
|
326
|
+
* 当前容器全屏中
|
|
327
|
+
* @returns {boolean}
|
|
328
|
+
*/
|
|
329
|
+
get fullscreening(): boolean;
|
|
330
|
+
/**
|
|
331
|
+
* 当前视频的信息, 推荐使用监听 videoInfo 事件
|
|
332
|
+
* @returns {Object}
|
|
333
|
+
*/
|
|
334
|
+
get videoInfo(): any;
|
|
335
|
+
/**
|
|
336
|
+
* 当前播放时间(从0 开始 单位秒)
|
|
337
|
+
* @returns {number}
|
|
338
|
+
*/
|
|
339
|
+
get currentTime(): number;
|
|
254
340
|
/**
|
|
255
341
|
* @description 全屏播放视频(不支持移动端)
|
|
256
342
|
* @returns {Promise}
|
|
343
|
+
* @deprecated
|
|
257
344
|
* @example
|
|
258
345
|
* flv.fullScreen() // 全屏
|
|
259
|
-
*
|
|
260
346
|
*/
|
|
261
347
|
fullScreen(): Promise<any>;
|
|
262
348
|
/**
|
|
@@ -264,12 +350,12 @@ declare class EzuikitFlv extends EventEmitter<string | symbol, any> {
|
|
|
264
350
|
* @returns {Promise}
|
|
265
351
|
* @example
|
|
266
352
|
* flv.fullscreen() // 全屏
|
|
267
|
-
*
|
|
268
353
|
*/
|
|
269
354
|
fullscreen(): Promise<any>;
|
|
270
355
|
/**
|
|
271
356
|
* @description 退出全屏播放视频
|
|
272
357
|
* @returns {Promise}
|
|
358
|
+
* @deprecated
|
|
273
359
|
* @example
|
|
274
360
|
* flv.cancelFullScreen() // 退出全屏
|
|
275
361
|
*/
|
|
@@ -278,15 +364,23 @@ declare class EzuikitFlv extends EventEmitter<string | symbol, any> {
|
|
|
278
364
|
* @description 取消全屏播放视频
|
|
279
365
|
* @returns {Promise}
|
|
280
366
|
* @example
|
|
281
|
-
* flv.exitFullscreen() //
|
|
367
|
+
* flv.exitFullscreen() // 退出全屏
|
|
282
368
|
*/
|
|
283
369
|
exitFullscreen(): Promise<any>;
|
|
284
370
|
/**
|
|
285
|
-
* @description
|
|
286
|
-
* @
|
|
287
|
-
* @
|
|
371
|
+
* @description 截图,调用后弹出下载框保存截图
|
|
372
|
+
* @param {string=} filename 保存的文件名, 默认 时间戳
|
|
373
|
+
* @param {string=} format 截图的格式,可选png或jpeg或者webp ,默认 png
|
|
374
|
+
* @param {number=} quality 当格式是jpeg或者webp时,压缩质量,取值0 ~ 1 ,默认 0.92
|
|
375
|
+
* @param {("download" | "base64" | "blob")} type download,base64,blob, 默认download
|
|
376
|
+
*
|
|
377
|
+
* @returns {string | Blob | undefined}
|
|
378
|
+
* @since 1.0.3
|
|
379
|
+
* @example
|
|
380
|
+
* flv.screenshot()
|
|
381
|
+
* flv.screenshot("filename", "jpeg", 0.7, "download")
|
|
288
382
|
*/
|
|
289
|
-
|
|
383
|
+
screenshot(filename?: string | undefined, format?: string | undefined, quality?: number | undefined, type?: ("download" | "base64" | "blob")): string | Blob | undefined;
|
|
290
384
|
/**
|
|
291
385
|
* @description 获取播放器的状态
|
|
292
386
|
* @returns {PlayerState} 播放器的状态
|
|
@@ -297,11 +391,17 @@ declare class EzuikitFlv extends EventEmitter<string | symbol, any> {
|
|
|
297
391
|
/**
|
|
298
392
|
* @description 获取设置
|
|
299
393
|
* @returns {object}
|
|
394
|
+
*
|
|
395
|
+
* @example
|
|
396
|
+
* player.getOptions()
|
|
300
397
|
*/
|
|
301
398
|
getOptions(): object;
|
|
302
399
|
/**
|
|
303
400
|
* @description 获取版本
|
|
304
401
|
* @returns {string}
|
|
402
|
+
*
|
|
403
|
+
* @example
|
|
404
|
+
* player.getVersion()
|
|
305
405
|
*/
|
|
306
406
|
getVersion(): string;
|
|
307
407
|
}
|
|
@@ -38,12 +38,21 @@ export default class BasePlayer extends Emitter {
|
|
|
38
38
|
_audioTimestamp: number;
|
|
39
39
|
events: Events;
|
|
40
40
|
video: any;
|
|
41
|
+
_fullscreen: boolean;
|
|
41
42
|
control: Control;
|
|
43
|
+
set fullscreen(value: any);
|
|
44
|
+
get fullscreen(): any;
|
|
45
|
+
set webFullscreen(value: any);
|
|
46
|
+
get webFullscreen(): any;
|
|
42
47
|
/**
|
|
43
48
|
*
|
|
44
49
|
* @param options
|
|
45
50
|
*/
|
|
46
51
|
updateOption(options: any): void;
|
|
52
|
+
/**
|
|
53
|
+
* @description 重置尺寸
|
|
54
|
+
*/
|
|
55
|
+
resize(): void;
|
|
47
56
|
}
|
|
48
57
|
import Emitter from '../utils/emitter';
|
|
49
58
|
import Debug from '../utils/debug';
|
|
@@ -30,8 +30,15 @@ export default class HardPlayer extends BasePlayer {
|
|
|
30
30
|
_pause: boolean;
|
|
31
31
|
_decodedFrames: number;
|
|
32
32
|
constructor(container: HTMLElement, options: RequiredFlvOptions);
|
|
33
|
-
close():
|
|
33
|
+
close(): void;
|
|
34
34
|
_createPlayer(options: RequiredFlvOptions): void;
|
|
35
|
+
/**
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
38
|
+
_removeFlvEvents(): void;
|
|
39
|
+
/**
|
|
40
|
+
* @private
|
|
41
|
+
*/
|
|
35
42
|
_flvEvents(): void;
|
|
36
43
|
getOption(): RequiredFlvOptions;
|
|
37
44
|
emitError(errorType: string, message?: string): void;
|
|
@@ -40,10 +47,6 @@ export default class HardPlayer extends BasePlayer {
|
|
|
40
47
|
*/
|
|
41
48
|
destroy(): void;
|
|
42
49
|
resetStats(): void;
|
|
43
|
-
set fullscreen(value: any);
|
|
44
|
-
get fullscreen(): any;
|
|
45
|
-
set webFullscreen(value: boolean);
|
|
46
|
-
get webFullscreen(): boolean;
|
|
47
50
|
set loaded(value: boolean);
|
|
48
51
|
get loaded(): boolean;
|
|
49
52
|
set playing(value: boolean);
|
|
@@ -81,14 +84,17 @@ export default class HardPlayer extends BasePlayer {
|
|
|
81
84
|
/**
|
|
82
85
|
* @description 播放
|
|
83
86
|
* @param url
|
|
84
|
-
* @param options
|
|
87
|
+
* @param {object} options
|
|
85
88
|
* @returns {Promise}
|
|
86
89
|
*/
|
|
87
|
-
play(
|
|
88
|
-
|
|
90
|
+
play(options?: {
|
|
91
|
+
url?: string;
|
|
92
|
+
}): Promise<unknown>;
|
|
93
|
+
_play(options?: {
|
|
94
|
+
url?: string;
|
|
95
|
+
}): Promise<void>;
|
|
89
96
|
_close(): Promise<unknown>;
|
|
90
97
|
pause(): Promise<unknown>;
|
|
91
98
|
resumeAudioAfterPause(): void;
|
|
92
99
|
mute(flag: boolean): void;
|
|
93
|
-
resize(): void;
|
|
94
100
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import CommonLoader from '../commonLoader';
|
|
2
|
-
import { ScreenshotFormat } from '../interface';
|
|
3
|
-
import HardPlayer from '.';
|
|
2
|
+
import { type ScreenshotFormat } from '../interface';
|
|
3
|
+
import type HardPlayer from '.';
|
|
4
4
|
export default class VideoLoader extends CommonLoader {
|
|
5
5
|
_delayPlay: boolean;
|
|
6
6
|
$canvasElement: HTMLCanvasElement;
|
|
@@ -25,4 +25,5 @@ export default class VideoLoader extends CommonLoader {
|
|
|
25
25
|
resize(): void;
|
|
26
26
|
_resizeElement($Element: HTMLVideoElement | HTMLImageElement): void;
|
|
27
27
|
isPlaying(): boolean;
|
|
28
|
+
get currentTime(): number;
|
|
28
29
|
}
|
package/types/player/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default class PlayerLoader {
|
|
2
|
-
static getLoaderFactory(useMSE: any): typeof SoftPlayer | typeof
|
|
2
|
+
static getLoaderFactory(useMSE: any): typeof SoftPlayer | typeof HardPlayer;
|
|
3
3
|
constructor(container: any, options: any);
|
|
4
4
|
_opt: any;
|
|
5
5
|
}
|
|
6
6
|
import SoftPlayer from './soft-player';
|
|
7
|
-
import
|
|
7
|
+
import HardPlayer from './hard-player';
|
|
@@ -13,13 +13,14 @@ export type TFlvOptions = {
|
|
|
13
13
|
loadingTimeout: number;
|
|
14
14
|
loadingTimeoutReplay: boolean;
|
|
15
15
|
keepScreenOn: boolean;
|
|
16
|
-
|
|
16
|
+
isMute: boolean;
|
|
17
17
|
useMSE: boolean;
|
|
18
18
|
autoWasm: boolean;
|
|
19
19
|
wasmDecodeErrorReplay: boolean;
|
|
20
20
|
useWebFullScreen: boolean;
|
|
21
21
|
width: number;
|
|
22
22
|
height: number;
|
|
23
|
+
isLive: boolean;
|
|
23
24
|
};
|
|
24
25
|
export type RequiredFlvOptions = Required<TFlvOptions> & {
|
|
25
26
|
url: string;
|
|
@@ -13,6 +13,7 @@ export default class CanvasVideoLoader extends CommonLoader {
|
|
|
13
13
|
height: string;
|
|
14
14
|
encType: string;
|
|
15
15
|
};
|
|
16
|
+
_currentTime: number;
|
|
16
17
|
_contextmenuEvent: (e: any) => void;
|
|
17
18
|
_initContextGl(): void;
|
|
18
19
|
_initContext2D(): void;
|
|
@@ -23,5 +24,9 @@ export default class CanvasVideoLoader extends CommonLoader {
|
|
|
23
24
|
render(msg: any): void;
|
|
24
25
|
screenshot(filename: any, format: any, quality: any, type: any): string | File;
|
|
25
26
|
resize(): void;
|
|
27
|
+
/**
|
|
28
|
+
* 当前播放pts (单位秒)
|
|
29
|
+
*/
|
|
30
|
+
get currentTime(): number;
|
|
26
31
|
}
|
|
27
32
|
import CommonLoader from '../commonLoader';
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description 软解
|
|
3
|
+
*/
|
|
1
4
|
export default class SoftPlayer extends BasePlayer {
|
|
2
5
|
constructor(container: any, options: any);
|
|
3
6
|
audio: Audio;
|
|
@@ -9,10 +12,6 @@ export default class SoftPlayer extends BasePlayer {
|
|
|
9
12
|
set volume(value: number);
|
|
10
13
|
get volume(): number;
|
|
11
14
|
destroy(): void;
|
|
12
|
-
set fullscreen(value: any);
|
|
13
|
-
get fullscreen(): any;
|
|
14
|
-
set webFullscreen(value: any);
|
|
15
|
-
get webFullscreen(): any;
|
|
16
15
|
set loaded(value: boolean);
|
|
17
16
|
get loaded(): boolean;
|
|
18
17
|
set playing(value: boolean);
|
|
@@ -29,7 +28,7 @@ export default class SoftPlayer extends BasePlayer {
|
|
|
29
28
|
*
|
|
30
29
|
* @returns {Promise<unknown>}
|
|
31
30
|
*/
|
|
32
|
-
|
|
31
|
+
_init(): Promise<unknown>;
|
|
33
32
|
/**
|
|
34
33
|
*
|
|
35
34
|
* @param url
|
|
@@ -53,10 +52,6 @@ export default class SoftPlayer extends BasePlayer {
|
|
|
53
52
|
* @param {boolean} flag
|
|
54
53
|
*/
|
|
55
54
|
mute(flag: boolean): void;
|
|
56
|
-
/**
|
|
57
|
-
* @description 重置尺寸
|
|
58
|
-
*/
|
|
59
|
-
resize(): void;
|
|
60
55
|
_onlyMseOrWcsVideo(): any;
|
|
61
56
|
/**
|
|
62
57
|
* 心跳检查
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default HttpUtil;
|
|
2
|
+
declare class HttpUtil {
|
|
3
|
+
static defaults: {
|
|
4
|
+
baseURL: string;
|
|
5
|
+
accessToken: string;
|
|
6
|
+
deviceSerial: string;
|
|
7
|
+
channelNo: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param {string} url 请求地址
|
|
12
|
+
*/
|
|
13
|
+
static get(url: string, options?: {}): Promise<Response>;
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @param {string} url 请求地址
|
|
17
|
+
*/
|
|
18
|
+
static post(url: string, options?: {}): Promise<Response>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description 获取播放地址 https://open.ys7.com/help/1414
|
|
3
|
+
* @param {Obejct} params
|
|
4
|
+
* @param {number=} params.expireTime 过期时长,单位秒;针对hls/rtmp/flv设置有效期,相对时间;30秒-720天
|
|
5
|
+
* @param {number=} params.type 地址的类型,1-预览,2-本地录像回放,3-云存储录像回放,非必选,默认为1;回放仅支持rtmp、ezopen、flv协议
|
|
6
|
+
* @param {number=} params.quality 视频清晰度,1-高清(主码流)、2-流畅(子码流)
|
|
7
|
+
* @param {string=} params.startTime 本地录像/云存储录像回放开始时间,云存储开始结束时间必须在同一天,示例:2019-12-01 00:00:00
|
|
8
|
+
* @param {string=} params.stopTime 本地录像/云存储录像回放结束时间,云存储开始结束时间必须在同一天,示例:2019-12-01 23:59:59
|
|
9
|
+
* @param {number=} params.playbackSpeed 回放倍速。倍速为 -1( 支持的最大倍速)、0.5、1、2、4、8、16; 仅支持protocol为4-flv 且 type为2-本地录像回放( 部分设备可能不支持16倍速) 或者 3-云存储录像回放
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
export function getAddressService(params?: Obejct): Promise<any>;
|
|
13
|
+
export function getPlaybackAddressService(params?: {}): Promise<any>;
|
|
14
|
+
/**
|
|
15
|
+
* @description 获取直播地址
|
|
16
|
+
* @param {{quality: 1 | 2, expireTime: number}} params
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
export function getLiveAddressService(params?: {
|
|
20
|
+
quality: 1 | 2;
|
|
21
|
+
expireTime: number;
|
|
22
|
+
}): Promise<any>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description 获取查询设备本地录像 (开始结束时间必须在同一天) https://open.ys7.com/help/3922
|
|
3
|
+
* @param {Obejct} params
|
|
4
|
+
* @param {string | number} params.startTime 开始时间 (毫秒)
|
|
5
|
+
* @param {string | number} params.endTime 结束时间(毫秒)
|
|
6
|
+
* @param {(string | number)=} params.pageSize 每页个数 默认200, 最大200, 超出自动遍历下一页
|
|
7
|
+
*
|
|
8
|
+
* @returns {Array<{"startTime": number,"endTime": number,"type": string, "size":number }>}
|
|
9
|
+
*/
|
|
10
|
+
export function getLocalVideoUnifyQueryService(player: any, params: Obejct): Array<{
|
|
11
|
+
"startTime": number;
|
|
12
|
+
"endTime": number;
|
|
13
|
+
"type": string;
|
|
14
|
+
"size": number;
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description 获取设备视频质量查询接口 https://open.ys7.com/help/3922
|
|
3
|
+
*
|
|
4
|
+
* @returns {Array<{"streamTypeIn": 1 | 2,"videoLevel": 0 | 1 | 2 | 3 | 4 | 5 |6, name: string }>}
|
|
5
|
+
*/
|
|
6
|
+
export function getVideoQualityService(player: any): Array<{
|
|
7
|
+
"streamTypeIn": 1 | 2;
|
|
8
|
+
"videoLevel": 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
9
|
+
name: string;
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* videoLevel 清晰度枚举
|
|
13
|
+
*/
|
|
14
|
+
export const QUALITY_ENUM: {
|
|
15
|
+
0: string;
|
|
16
|
+
1: string;
|
|
17
|
+
2: string;
|
|
18
|
+
3: string;
|
|
19
|
+
4: string;
|
|
20
|
+
5: string;
|
|
21
|
+
6: string;
|
|
22
|
+
};
|
|
23
|
+
export const DEFAULT_QUALITY: {
|
|
24
|
+
/**
|
|
25
|
+
* 0: 流畅
|
|
26
|
+
* 1: 标清
|
|
27
|
+
* 2: 高清
|
|
28
|
+
* 3: 超清
|
|
29
|
+
* 4: 极清
|
|
30
|
+
* 5: 3K
|
|
31
|
+
* 6: 4K
|
|
32
|
+
*/
|
|
33
|
+
videoLevel: number;
|
|
34
|
+
name: string;
|
|
35
|
+
streamTypeIn: number;
|
|
36
|
+
/** 用来区分清晰度是否是默认值还是接口返回的 */
|
|
37
|
+
type: string;
|
|
38
|
+
}[];
|
package/types/stream/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export default class Stream {
|
|
2
|
-
static getLoaderFactory(protocol: any): typeof FetchLoader
|
|
2
|
+
static getLoaderFactory(protocol: any): typeof FetchLoader;
|
|
3
3
|
constructor(player: any);
|
|
4
4
|
}
|
|
5
5
|
import FetchLoader from './fetchLoader';
|
|
6
|
-
import WebsocketLoader from './websocketLoader';
|