ezuikit-flv 1.0.1 → 1.0.2-alpha.1
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 +7 -7
- package/types/flv-mse/flv.min.d.ts +0 -1
- package/types/index.d.ts +53 -30
- package/types/player/hard-player/index.d.ts +2 -3
- package/types/player/soft-player/index.d.ts +8 -8
- 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.1",
|
|
3
|
+
"version": "1.0.2-alpha.1",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"types": "./types",
|
|
6
|
+
"author": "Ezviz-OpenBiz",
|
|
6
7
|
"files": [
|
|
7
8
|
"CHANGELOG.md",
|
|
8
9
|
"decoder.js",
|
|
@@ -12,9 +13,8 @@
|
|
|
12
13
|
"README.md",
|
|
13
14
|
"types"
|
|
14
15
|
],
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public",
|
|
18
|
+
"registry": "https://registry.npmjs.org/"
|
|
19
|
+
}
|
|
20
|
+
}
|
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,12 +20,7 @@ declare class EzuikitFlv extends Emitter {
|
|
|
15
20
|
static ERROR: {
|
|
16
21
|
playError: string;
|
|
17
22
|
fetchError: string;
|
|
18
|
-
websocketError: string;
|
|
19
|
-
* @description 开启声音 默认音量 0.5
|
|
20
|
-
* @returns {void}
|
|
21
|
-
* @example
|
|
22
|
-
* player.openSound() //
|
|
23
|
-
*/
|
|
23
|
+
websocketError: string;
|
|
24
24
|
webcodecsH265NotSupport: string;
|
|
25
25
|
webcodecsDecodeError: string;
|
|
26
26
|
webcodecsWidthOrHeightChange: string;
|
|
@@ -38,6 +38,24 @@ declare class EzuikitFlv extends Emitter {
|
|
|
38
38
|
loadingTimeout: string;
|
|
39
39
|
delayTimeout: string;
|
|
40
40
|
};
|
|
41
|
+
static version: string;
|
|
42
|
+
/**
|
|
43
|
+
* @description 静态方法 判断是否支持播放地址
|
|
44
|
+
* @param {Object} options
|
|
45
|
+
* @param {string=} options.url
|
|
46
|
+
* @param {type=} options.type
|
|
47
|
+
* @returns {boolean}
|
|
48
|
+
* @static
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```js
|
|
52
|
+
* EzuikitFlv.supportType({url: "https://open.ys7.com/v3/openlive/E71992743_1_1.flv", type:'flv'})
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
static supportType(options: {
|
|
56
|
+
url?: string | undefined;
|
|
57
|
+
type?: type | undefined;
|
|
58
|
+
}): boolean;
|
|
41
59
|
/**
|
|
42
60
|
* @constructor
|
|
43
61
|
* @param {FlvOptions} options
|
|
@@ -51,7 +69,7 @@ declare class EzuikitFlv extends Emitter {
|
|
|
51
69
|
/**
|
|
52
70
|
* @description 销毁
|
|
53
71
|
* @example
|
|
54
|
-
*
|
|
72
|
+
* flv.destroy()
|
|
55
73
|
*/
|
|
56
74
|
destroy(): void;
|
|
57
75
|
player: Player;
|
|
@@ -79,21 +97,21 @@ declare class EzuikitFlv extends Emitter {
|
|
|
79
97
|
* @param {boolean} value true: 开启, false: 关闭
|
|
80
98
|
* @returns {void}
|
|
81
99
|
* @example
|
|
82
|
-
*
|
|
100
|
+
* flv.setDebug(false)
|
|
83
101
|
*/
|
|
84
102
|
setDebug(value: boolean): void;
|
|
85
103
|
/**
|
|
86
104
|
* @description 关闭声音
|
|
87
105
|
* @returns {void}
|
|
88
106
|
* @example
|
|
89
|
-
*
|
|
107
|
+
* flv.closeSound()
|
|
90
108
|
*/
|
|
91
109
|
closeSound(): void;
|
|
92
110
|
/**
|
|
93
111
|
* @description 开启声音 默认音量 0.5
|
|
94
112
|
* @returns {void}
|
|
95
113
|
* @example
|
|
96
|
-
*
|
|
114
|
+
* flv.openSound() //
|
|
97
115
|
*/
|
|
98
116
|
openSound(): void;
|
|
99
117
|
/**
|
|
@@ -101,23 +119,30 @@ declare class EzuikitFlv extends Emitter {
|
|
|
101
119
|
* @param {number} value 音量 0~1
|
|
102
120
|
* @returns {void}
|
|
103
121
|
* @example
|
|
104
|
-
*
|
|
122
|
+
* flv.setVolume(0.5)
|
|
105
123
|
*/
|
|
106
124
|
setVolume(value: number): void;
|
|
107
125
|
/**
|
|
108
126
|
* @description 获取音量, 音量 0~1
|
|
109
127
|
* @returns {number}
|
|
110
128
|
* @example
|
|
111
|
-
*
|
|
129
|
+
* flv.getVolume()
|
|
112
130
|
*/
|
|
113
131
|
getVolume(): number;
|
|
132
|
+
/**
|
|
133
|
+
* @description 音频回复
|
|
134
|
+
* @returns {void}
|
|
135
|
+
* @example
|
|
136
|
+
* flv.audioResume()
|
|
137
|
+
*/
|
|
138
|
+
audioResume(): void;
|
|
114
139
|
/**
|
|
115
140
|
* @description 设置超时时长, 单位秒 在连接成功之前和播放中途,如果超过设定时长无数据返回,则回调timeout事件
|
|
116
141
|
* @private
|
|
117
142
|
* @param {number} time 设置超时时长, 单位秒
|
|
118
143
|
* @returns {void}
|
|
119
144
|
* @example
|
|
120
|
-
*
|
|
145
|
+
* flv.setTimeout(3)
|
|
121
146
|
*/
|
|
122
147
|
private setTimeout;
|
|
123
148
|
/**
|
|
@@ -126,14 +151,14 @@ declare class EzuikitFlv extends Emitter {
|
|
|
126
151
|
* @param {0 | 1 | 2} type 0: 完全填充canvas区域; 1: 等比缩放, 最大边填充 ; 2: 等比缩放后,最小边填充,完全填充canvas区域,画面不被拉伸,没有黑边,但画面显示不全
|
|
127
152
|
* @returns {Promise}
|
|
128
153
|
* @example
|
|
129
|
-
*
|
|
154
|
+
* flv.setScaleMode(1)
|
|
130
155
|
*/
|
|
131
156
|
private setScaleMode;
|
|
132
157
|
/**
|
|
133
158
|
* @description 暂停
|
|
134
159
|
* @returns {Promise<unknown>}
|
|
135
160
|
* @example
|
|
136
|
-
*
|
|
161
|
+
* flv.pause()
|
|
137
162
|
*/
|
|
138
163
|
pause(): Promise<unknown>;
|
|
139
164
|
/**
|
|
@@ -141,7 +166,7 @@ declare class EzuikitFlv extends Emitter {
|
|
|
141
166
|
* @private
|
|
142
167
|
* @returns {void}
|
|
143
168
|
* @example
|
|
144
|
-
*
|
|
169
|
+
* flv.close()
|
|
145
170
|
*/
|
|
146
171
|
private close;
|
|
147
172
|
/**
|
|
@@ -149,7 +174,7 @@ declare class EzuikitFlv extends Emitter {
|
|
|
149
174
|
* @private
|
|
150
175
|
* @returns {void}
|
|
151
176
|
* @example
|
|
152
|
-
*
|
|
177
|
+
* flv.clearView()
|
|
153
178
|
*/
|
|
154
179
|
private clearView;
|
|
155
180
|
/**
|
|
@@ -157,7 +182,7 @@ declare class EzuikitFlv extends Emitter {
|
|
|
157
182
|
* @param {FlvOptions=} options
|
|
158
183
|
* @returns {Promise}
|
|
159
184
|
* @example
|
|
160
|
-
*
|
|
185
|
+
* flv.play()
|
|
161
186
|
*/
|
|
162
187
|
play(options?: FlvOptions): Promise<any>;
|
|
163
188
|
/**
|
|
@@ -172,7 +197,7 @@ declare class EzuikitFlv extends Emitter {
|
|
|
172
197
|
* @description 重新调整视图大小
|
|
173
198
|
* @private
|
|
174
199
|
* @example
|
|
175
|
-
*
|
|
200
|
+
* flv.resize()
|
|
176
201
|
*/
|
|
177
202
|
private resize;
|
|
178
203
|
/**
|
|
@@ -180,17 +205,17 @@ declare class EzuikitFlv extends Emitter {
|
|
|
180
205
|
* @private
|
|
181
206
|
* @param {number} time 大缓冲时长 s
|
|
182
207
|
* @example
|
|
183
|
-
*
|
|
208
|
+
* flv.setBufferTime(3)
|
|
184
209
|
*/
|
|
185
210
|
private setBufferTime;
|
|
186
211
|
/**
|
|
187
212
|
* @description 设置旋转角度,支持,0(默认), 90, 180, 270 四个值。
|
|
188
|
-
* @param {0 | 90 | 180 | 270} deg 旋转角度
|
|
189
213
|
* @returns {Promise}
|
|
214
|
+
* @param {number} deg
|
|
190
215
|
* @example
|
|
191
|
-
*
|
|
216
|
+
* flv.setRotate(90) // 旋转90度
|
|
192
217
|
*/
|
|
193
|
-
setRotate(deg:
|
|
218
|
+
setRotate(deg: number): Promise<any>;
|
|
194
219
|
/**
|
|
195
220
|
* @description 返回是否加载完毕
|
|
196
221
|
* @private
|
|
@@ -201,7 +226,7 @@ declare class EzuikitFlv extends Emitter {
|
|
|
201
226
|
* @description 开启屏幕常亮,在手机浏览器上
|
|
202
227
|
* @returns {void}
|
|
203
228
|
* @example
|
|
204
|
-
*
|
|
229
|
+
* flv.setKeepScreenOn()
|
|
205
230
|
*/
|
|
206
231
|
setKeepScreenOn(): void;
|
|
207
232
|
/**
|
|
@@ -213,27 +238,25 @@ declare class EzuikitFlv extends Emitter {
|
|
|
213
238
|
/**
|
|
214
239
|
* @description 全屏播放视频
|
|
215
240
|
* @example
|
|
216
|
-
*
|
|
241
|
+
* flv.fullScreen() // 全屏
|
|
217
242
|
*/
|
|
218
243
|
fullScreen(): void;
|
|
219
244
|
/**
|
|
220
245
|
* @description 取消全屏播放视频
|
|
221
246
|
* @example
|
|
222
|
-
*
|
|
247
|
+
* flv.cancelFullScreen() // 全屏
|
|
223
248
|
*/
|
|
224
249
|
cancelFullScreen(): void;
|
|
225
250
|
/**
|
|
226
251
|
* @description 获取播放器的状态
|
|
227
252
|
* @returns {PlayerState} 播放器的状态
|
|
228
253
|
* @example
|
|
229
|
-
*
|
|
254
|
+
* flv.getState()
|
|
230
255
|
*/
|
|
231
256
|
getState(): PlayerState;
|
|
232
257
|
/**
|
|
233
258
|
* @description 获取版本
|
|
234
259
|
* @returns {string}
|
|
235
|
-
* @example
|
|
236
|
-
* player.getVersion()
|
|
237
260
|
*/
|
|
238
261
|
getVersion(): string;
|
|
239
262
|
}
|
|
@@ -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
|
/**
|
|
@@ -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
|
+
}
|