ezuikit-flv 1.0.1 → 1.0.2-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 +15 -7
- package/README.md +1 -1
- package/decoder.js +1 -1
- package/index.js +14 -2
- package/package.json +3 -7
- package/types/flv-mse/flv.min.d.ts +0 -1
- package/types/index.d.ts +56 -27
- package/types/player/hard-player/index.d.ts +2 -3
- package/types/player/soft-player/index.d.ts +8 -8
- package/types/typedefs.d.ts +5 -0
- package/types/utils/monitor.d.ts +13 -0
- package/types/utils/codec-support.d.ts +0 -2
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ezuikit-flv",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2-alpha.2",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"types": "./types",
|
|
6
|
+
"author": "Ezviz-OpenBiz",
|
|
6
7
|
"files": [
|
|
7
8
|
"CHANGELOG.md",
|
|
8
9
|
"decoder.js",
|
|
@@ -11,10 +12,5 @@
|
|
|
11
12
|
"package.json",
|
|
12
13
|
"README.md",
|
|
13
14
|
"types"
|
|
14
|
-
]
|
|
15
|
-
"bugs": {
|
|
16
|
-
"url": "https://github.com/Ezviz-OpenBiz/EZUIKit-flv/issues"
|
|
17
|
-
},
|
|
18
|
-
"repository": "git@github.com:Ezviz-OpenBiz/EZUIKit-flv.git",
|
|
19
|
-
"homepage": "https://ezviz-openbiz.github.io/EZUIKit-flv/"
|
|
15
|
+
]
|
|
20
16
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -2,7 +2,12 @@ export default EzuikitFlv;
|
|
|
2
2
|
/**
|
|
3
3
|
* @classdesc EzuikitFlv.js 播放flv直播流, 支持播放h264/h265的直播视频流
|
|
4
4
|
* @example
|
|
5
|
-
*
|
|
5
|
+
* ```js
|
|
6
|
+
* const flv = new EzuikitFlv({
|
|
7
|
+
* container: "EleId",
|
|
8
|
+
* url: "https://open.ys7.com/v3/openlive/E71992743_1_1.flv"
|
|
9
|
+
* })
|
|
10
|
+
* ```
|
|
6
11
|
*/
|
|
7
12
|
declare class EzuikitFlv extends Emitter {
|
|
8
13
|
/**
|
|
@@ -15,11 +20,12 @@ declare class EzuikitFlv extends Emitter {
|
|
|
15
20
|
static ERROR: {
|
|
16
21
|
playError: string;
|
|
17
22
|
fetchError: string;
|
|
18
|
-
websocketError: string;
|
|
19
|
-
|
|
23
|
+
websocketError: string;
|
|
24
|
+
/**
|
|
25
|
+
* @description 关闭声音
|
|
20
26
|
* @returns {void}
|
|
21
27
|
* @example
|
|
22
|
-
*
|
|
28
|
+
* flv.closeSound()
|
|
23
29
|
*/
|
|
24
30
|
webcodecsH265NotSupport: string;
|
|
25
31
|
webcodecsDecodeError: string;
|
|
@@ -38,6 +44,24 @@ declare class EzuikitFlv extends Emitter {
|
|
|
38
44
|
loadingTimeout: string;
|
|
39
45
|
delayTimeout: string;
|
|
40
46
|
};
|
|
47
|
+
static version: string;
|
|
48
|
+
/**
|
|
49
|
+
* @description 静态方法 判断是否支持播放地址
|
|
50
|
+
* @param {Object} options
|
|
51
|
+
* @param {string=} options.url
|
|
52
|
+
* @param {type=} options.type
|
|
53
|
+
* @returns {boolean}
|
|
54
|
+
* @static
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```js
|
|
58
|
+
* EzuikitFlv.supportType({url: "https://open.ys7.com/v3/openlive/E71992743_1_1.flv", type:'flv'})
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
static supportType(options: {
|
|
62
|
+
url?: string | undefined;
|
|
63
|
+
type?: type | undefined;
|
|
64
|
+
}): boolean;
|
|
41
65
|
/**
|
|
42
66
|
* @constructor
|
|
43
67
|
* @param {FlvOptions} options
|
|
@@ -51,7 +75,7 @@ declare class EzuikitFlv extends Emitter {
|
|
|
51
75
|
/**
|
|
52
76
|
* @description 销毁
|
|
53
77
|
* @example
|
|
54
|
-
*
|
|
78
|
+
* flv.destroy()
|
|
55
79
|
*/
|
|
56
80
|
destroy(): void;
|
|
57
81
|
player: Player;
|
|
@@ -79,21 +103,21 @@ declare class EzuikitFlv extends Emitter {
|
|
|
79
103
|
* @param {boolean} value true: 开启, false: 关闭
|
|
80
104
|
* @returns {void}
|
|
81
105
|
* @example
|
|
82
|
-
*
|
|
106
|
+
* flv.setDebug(false)
|
|
83
107
|
*/
|
|
84
108
|
setDebug(value: boolean): void;
|
|
85
109
|
/**
|
|
86
110
|
* @description 关闭声音
|
|
87
111
|
* @returns {void}
|
|
88
112
|
* @example
|
|
89
|
-
*
|
|
113
|
+
* flv.closeSound()
|
|
90
114
|
*/
|
|
91
115
|
closeSound(): void;
|
|
92
116
|
/**
|
|
93
117
|
* @description 开启声音 默认音量 0.5
|
|
94
118
|
* @returns {void}
|
|
95
119
|
* @example
|
|
96
|
-
*
|
|
120
|
+
* flv.openSound() //
|
|
97
121
|
*/
|
|
98
122
|
openSound(): void;
|
|
99
123
|
/**
|
|
@@ -101,23 +125,30 @@ declare class EzuikitFlv extends Emitter {
|
|
|
101
125
|
* @param {number} value 音量 0~1
|
|
102
126
|
* @returns {void}
|
|
103
127
|
* @example
|
|
104
|
-
*
|
|
128
|
+
* flv.setVolume(0.5)
|
|
105
129
|
*/
|
|
106
130
|
setVolume(value: number): void;
|
|
107
131
|
/**
|
|
108
132
|
* @description 获取音量, 音量 0~1
|
|
109
133
|
* @returns {number}
|
|
110
134
|
* @example
|
|
111
|
-
*
|
|
135
|
+
* flv.getVolume()
|
|
112
136
|
*/
|
|
113
137
|
getVolume(): number;
|
|
138
|
+
/**
|
|
139
|
+
* @description 音频回复
|
|
140
|
+
* @returns {void}
|
|
141
|
+
* @example
|
|
142
|
+
* flv.audioResume()
|
|
143
|
+
*/
|
|
144
|
+
audioResume(): void;
|
|
114
145
|
/**
|
|
115
146
|
* @description 设置超时时长, 单位秒 在连接成功之前和播放中途,如果超过设定时长无数据返回,则回调timeout事件
|
|
116
147
|
* @private
|
|
117
148
|
* @param {number} time 设置超时时长, 单位秒
|
|
118
149
|
* @returns {void}
|
|
119
150
|
* @example
|
|
120
|
-
*
|
|
151
|
+
* flv.setTimeout(3)
|
|
121
152
|
*/
|
|
122
153
|
private setTimeout;
|
|
123
154
|
/**
|
|
@@ -126,14 +157,14 @@ declare class EzuikitFlv extends Emitter {
|
|
|
126
157
|
* @param {0 | 1 | 2} type 0: 完全填充canvas区域; 1: 等比缩放, 最大边填充 ; 2: 等比缩放后,最小边填充,完全填充canvas区域,画面不被拉伸,没有黑边,但画面显示不全
|
|
127
158
|
* @returns {Promise}
|
|
128
159
|
* @example
|
|
129
|
-
*
|
|
160
|
+
* flv.setScaleMode(1)
|
|
130
161
|
*/
|
|
131
162
|
private setScaleMode;
|
|
132
163
|
/**
|
|
133
164
|
* @description 暂停
|
|
134
165
|
* @returns {Promise<unknown>}
|
|
135
166
|
* @example
|
|
136
|
-
*
|
|
167
|
+
* flv.pause()
|
|
137
168
|
*/
|
|
138
169
|
pause(): Promise<unknown>;
|
|
139
170
|
/**
|
|
@@ -141,7 +172,7 @@ declare class EzuikitFlv extends Emitter {
|
|
|
141
172
|
* @private
|
|
142
173
|
* @returns {void}
|
|
143
174
|
* @example
|
|
144
|
-
*
|
|
175
|
+
* flv.close()
|
|
145
176
|
*/
|
|
146
177
|
private close;
|
|
147
178
|
/**
|
|
@@ -149,7 +180,7 @@ declare class EzuikitFlv extends Emitter {
|
|
|
149
180
|
* @private
|
|
150
181
|
* @returns {void}
|
|
151
182
|
* @example
|
|
152
|
-
*
|
|
183
|
+
* flv.clearView()
|
|
153
184
|
*/
|
|
154
185
|
private clearView;
|
|
155
186
|
/**
|
|
@@ -157,7 +188,7 @@ declare class EzuikitFlv extends Emitter {
|
|
|
157
188
|
* @param {FlvOptions=} options
|
|
158
189
|
* @returns {Promise}
|
|
159
190
|
* @example
|
|
160
|
-
*
|
|
191
|
+
* flv.play()
|
|
161
192
|
*/
|
|
162
193
|
play(options?: FlvOptions): Promise<any>;
|
|
163
194
|
/**
|
|
@@ -172,7 +203,7 @@ declare class EzuikitFlv extends Emitter {
|
|
|
172
203
|
* @description 重新调整视图大小
|
|
173
204
|
* @private
|
|
174
205
|
* @example
|
|
175
|
-
*
|
|
206
|
+
* flv.resize()
|
|
176
207
|
*/
|
|
177
208
|
private resize;
|
|
178
209
|
/**
|
|
@@ -180,17 +211,17 @@ declare class EzuikitFlv extends Emitter {
|
|
|
180
211
|
* @private
|
|
181
212
|
* @param {number} time 大缓冲时长 s
|
|
182
213
|
* @example
|
|
183
|
-
*
|
|
214
|
+
* flv.setBufferTime(3)
|
|
184
215
|
*/
|
|
185
216
|
private setBufferTime;
|
|
186
217
|
/**
|
|
187
218
|
* @description 设置旋转角度,支持,0(默认), 90, 180, 270 四个值。
|
|
188
|
-
* @param {0 | 90 | 180 | 270} deg 旋转角度
|
|
189
219
|
* @returns {Promise}
|
|
220
|
+
* @param {number} deg
|
|
190
221
|
* @example
|
|
191
|
-
*
|
|
222
|
+
* flv.setRotate(90) // 旋转90度
|
|
192
223
|
*/
|
|
193
|
-
setRotate(deg:
|
|
224
|
+
setRotate(deg: number): Promise<any>;
|
|
194
225
|
/**
|
|
195
226
|
* @description 返回是否加载完毕
|
|
196
227
|
* @private
|
|
@@ -201,7 +232,7 @@ declare class EzuikitFlv extends Emitter {
|
|
|
201
232
|
* @description 开启屏幕常亮,在手机浏览器上
|
|
202
233
|
* @returns {void}
|
|
203
234
|
* @example
|
|
204
|
-
*
|
|
235
|
+
* flv.setKeepScreenOn()
|
|
205
236
|
*/
|
|
206
237
|
setKeepScreenOn(): void;
|
|
207
238
|
/**
|
|
@@ -213,27 +244,25 @@ declare class EzuikitFlv extends Emitter {
|
|
|
213
244
|
/**
|
|
214
245
|
* @description 全屏播放视频
|
|
215
246
|
* @example
|
|
216
|
-
*
|
|
247
|
+
* flv.fullScreen() // 全屏
|
|
217
248
|
*/
|
|
218
249
|
fullScreen(): void;
|
|
219
250
|
/**
|
|
220
251
|
* @description 取消全屏播放视频
|
|
221
252
|
* @example
|
|
222
|
-
*
|
|
253
|
+
* flv.cancelFullScreen() // 全屏
|
|
223
254
|
*/
|
|
224
255
|
cancelFullScreen(): void;
|
|
225
256
|
/**
|
|
226
257
|
* @description 获取播放器的状态
|
|
227
258
|
* @returns {PlayerState} 播放器的状态
|
|
228
259
|
* @example
|
|
229
|
-
*
|
|
260
|
+
* flv.getState()
|
|
230
261
|
*/
|
|
231
262
|
getState(): PlayerState;
|
|
232
263
|
/**
|
|
233
264
|
* @description 获取版本
|
|
234
265
|
* @returns {string}
|
|
235
|
-
* @example
|
|
236
|
-
* player.getVersion()
|
|
237
266
|
*/
|
|
238
267
|
getVersion(): string;
|
|
239
268
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { PlayerInterface } from '../interface';
|
|
1
|
+
import { type PlayerInterface, type RequiredFlvOptions } from '../interface';
|
|
2
2
|
import Events from '../../utils/events';
|
|
3
3
|
import Video from './videoLoader';
|
|
4
|
-
import Control from '../../control';
|
|
5
|
-
import { RequiredFlvOptions } from '../interface';
|
|
4
|
+
import type Control from '../../control';
|
|
6
5
|
import BasePlayer from '../base-player';
|
|
7
6
|
/**
|
|
8
7
|
* @class
|
|
@@ -7,22 +7,22 @@ export default class SoftPlayer extends BasePlayer {
|
|
|
7
7
|
_lastVolume: any;
|
|
8
8
|
keepScreenOn: NoSleep;
|
|
9
9
|
destroy(): void;
|
|
10
|
-
set fullscreen(
|
|
10
|
+
set fullscreen(value: any);
|
|
11
11
|
get fullscreen(): any;
|
|
12
|
-
set webFullscreen(
|
|
12
|
+
set webFullscreen(value: any);
|
|
13
13
|
get webFullscreen(): any;
|
|
14
|
-
set loaded(
|
|
14
|
+
set loaded(value: boolean);
|
|
15
15
|
get loaded(): boolean;
|
|
16
|
-
set playing(
|
|
16
|
+
set playing(value: boolean);
|
|
17
17
|
get playing(): boolean;
|
|
18
|
-
set loading(
|
|
18
|
+
set loading(value: boolean);
|
|
19
19
|
get loading(): boolean;
|
|
20
|
-
set volume(
|
|
20
|
+
set volume(value: any);
|
|
21
21
|
get volume(): any;
|
|
22
22
|
get lastVolume(): any;
|
|
23
|
-
set audioTimestamp(
|
|
23
|
+
set audioTimestamp(value: number);
|
|
24
24
|
get audioTimestamp(): number;
|
|
25
|
-
set videoTimestamp(
|
|
25
|
+
set videoTimestamp(value: number);
|
|
26
26
|
get videoTimestamp(): number;
|
|
27
27
|
get isDebug(): boolean;
|
|
28
28
|
/**
|
package/types/typedefs.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* @typedef FlvOptions
|
|
5
5
|
*
|
|
6
6
|
* @property {string | HTMLElement} container 渲染容器
|
|
7
|
+
* @property {string } id 渲染容器id 优先级比 container 高
|
|
7
8
|
* @property {number=} videoBuffer 设置最大缓冲时长,单位秒,播放器会自动消除延迟。
|
|
8
9
|
* @property {string=} decoder 解码库worker地址 默认 `decoder.js`, wasm 文件要和decoder在同一个文件夹中
|
|
9
10
|
* @property {boolean=} hasAudio 是否有音频,如果设置false,则不对音频数据解码,提升性能。
|
|
@@ -39,6 +40,10 @@ export type FlvOptions = {
|
|
|
39
40
|
* 渲染容器
|
|
40
41
|
*/
|
|
41
42
|
container: string | HTMLElement;
|
|
43
|
+
/**
|
|
44
|
+
* 渲染容器id 优先级比 container 高
|
|
45
|
+
*/
|
|
46
|
+
id: string;
|
|
42
47
|
/**
|
|
43
48
|
* 设置最大缓冲时长,单位秒,播放器会自动消除延迟。
|
|
44
49
|
*/
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default Monitor;
|
|
2
|
+
/**
|
|
3
|
+
* /pages/viewpage.action?pageId=663566571
|
|
4
|
+
*/
|
|
5
|
+
declare class Monitor {
|
|
6
|
+
static initMonitor(ignoreMonitor: any): void;
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param {1 | 2 | 3 | 50 | 51 | 100} type 1: 初始化 2: 播放成功 3: 播放异常 50: api 调用 51:错误回调 100: 接口上报
|
|
10
|
+
* @param {ReportData} logInfo
|
|
11
|
+
*/
|
|
12
|
+
static report(action: any, logInfo?: ReportData): void;
|
|
13
|
+
}
|