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/types/typedefs.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* @property {boolean=} autoPlay 自动播放 默认false
|
|
12
12
|
* @property {boolean=} hasAudio 是否有音频,如果设置false,则不对音频数据解码,提升性能。
|
|
13
13
|
* @property {number=} volume 音量大小, 默认 0.5。
|
|
14
|
-
* @property {(0 | 1 | 2)=} scaleMode 设置渲染模式, 默认 1
|
|
14
|
+
* @property {(0 | 1 | 2)=} scaleMode 设置渲染模式, 默认 1 等比缩放,最大边填充, 取值 0 | 1 | 2。
|
|
15
15
|
* @property {boolean=} debug 是否开启控制台调试打印。默认 false
|
|
16
16
|
* @property {number=} timeout 设置超时时长, 单位秒, 在连接成功之前(loading)和播放中途(heart),如果超过设定时长无数据返回,则回调timeout事件。默认 10
|
|
17
17
|
* @property {number=} heartTimeout 设置超时时长, 单位秒, 播放中途,如果超过设定时长无数据返回,则回调timeout事件。默认 5
|
|
@@ -19,10 +19,15 @@
|
|
|
19
19
|
* @property {number=} loadingTimeout 设置超时时长, 单位秒。默认 10
|
|
20
20
|
* @property {boolean=} loadingTimeoutReplay 是否开启loading超时之后自动再播放, 默认 true
|
|
21
21
|
* @property {boolean=} keepScreenOn 开启屏幕常亮,在手机浏览器上, canvas标签渲染视频并不会像video标签那样保持屏幕常。默认 false
|
|
22
|
-
* @property {boolean=}
|
|
22
|
+
* @property {boolean=} isMute 是否静音,默认是关闭声音播放的。默认 true
|
|
23
23
|
* @property {boolean=} useMSE 是否开启MediaSource硬解码。视频编码只支持H.264视频(Safari on iOS不支持)。默认 false
|
|
24
24
|
* @property {boolean=} autoWasm 在使用MSE或者Webcodecs 播放H265的时候,是否自动降级到wasm模式。默认 true
|
|
25
|
-
*
|
|
25
|
+
* @property {boolean=} isLive 是否是直播。默认 true @1.0.3
|
|
26
|
+
* @property {boolean=} isEzviz 是否是萤石开放平台设备, @1.0.3
|
|
27
|
+
* @property {string=} accessToken 开放平台 accessToken, @1.0.3
|
|
28
|
+
* @property {Object=} env 环境变量, @1.0.3
|
|
29
|
+
* @property {string=} env.domain 开放平台 api domain, @1.0.3
|
|
30
|
+
* @property {string=} timeZone 时区 默认 0, @1.0.3
|
|
26
31
|
*/
|
|
27
32
|
/**
|
|
28
33
|
*
|
|
@@ -37,6 +42,17 @@
|
|
|
37
42
|
* @property {string} volume 音量
|
|
38
43
|
* @property {boolean} isDebug 是否打印日志
|
|
39
44
|
*/
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* @description 视频流清晰度
|
|
48
|
+
* @typedef VideoLevel
|
|
49
|
+
*
|
|
50
|
+
* @property {number} videoLevel 清晰度 (0 | 1 | 2 | 3 | 4 | 5 | 6)
|
|
51
|
+
* @property {number} streamTypeIn 1: 主码流,2:子码流
|
|
52
|
+
* @property {string} name 清晰度名称
|
|
53
|
+
* @property {string} url 播放地址
|
|
54
|
+
* @property {stirng=} type 用来判断是否是默认主子码流清晰度 (compatible)
|
|
55
|
+
*/
|
|
40
56
|
export const Types: {};
|
|
41
57
|
export type FlvOptions = {
|
|
42
58
|
/**
|
|
@@ -72,7 +88,7 @@ export type FlvOptions = {
|
|
|
72
88
|
*/
|
|
73
89
|
volume?: number | undefined;
|
|
74
90
|
/**
|
|
75
|
-
* 设置渲染模式, 默认 1
|
|
91
|
+
* 设置渲染模式, 默认 1 等比缩放,最大边填充, 取值 0 | 1 | 2。
|
|
76
92
|
*/
|
|
77
93
|
scaleMode?: (0 | 1 | 2) | undefined;
|
|
78
94
|
/**
|
|
@@ -104,9 +120,9 @@ export type FlvOptions = {
|
|
|
104
120
|
*/
|
|
105
121
|
keepScreenOn?: boolean | undefined;
|
|
106
122
|
/**
|
|
107
|
-
*
|
|
123
|
+
* 是否静音,默认是关闭声音播放的。默认 true
|
|
108
124
|
*/
|
|
109
|
-
|
|
125
|
+
isMute?: boolean | undefined;
|
|
110
126
|
/**
|
|
111
127
|
* 是否开启MediaSource硬解码。视频编码只支持H.264视频(Safari on iOS不支持)。默认 false
|
|
112
128
|
*/
|
|
@@ -115,6 +131,10 @@ export type FlvOptions = {
|
|
|
115
131
|
* 在使用MSE或者Webcodecs 播放H265的时候,是否自动降级到wasm模式。默认 true
|
|
116
132
|
*/
|
|
117
133
|
autoWasm?: boolean | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* 是否是直播。默认 true
|
|
136
|
+
*/
|
|
137
|
+
isLive?: boolean | undefined;
|
|
118
138
|
};
|
|
119
139
|
export type PlayerState = {
|
|
120
140
|
/**
|
|
@@ -146,3 +166,25 @@ export type PlayerState = {
|
|
|
146
166
|
*/
|
|
147
167
|
isDebug: boolean;
|
|
148
168
|
};
|
|
169
|
+
export type VideoLevel = {
|
|
170
|
+
/**
|
|
171
|
+
* 清晰度 (0 | 1 | 2 | 3 | 4 | 5 | 6)
|
|
172
|
+
*/
|
|
173
|
+
videoLevel: number;
|
|
174
|
+
/**
|
|
175
|
+
* 1: 主码流,2:子码流
|
|
176
|
+
*/
|
|
177
|
+
streamTypeIn: number;
|
|
178
|
+
/**
|
|
179
|
+
* 清晰度名称
|
|
180
|
+
*/
|
|
181
|
+
name: string;
|
|
182
|
+
/**
|
|
183
|
+
* 播放地址
|
|
184
|
+
*/
|
|
185
|
+
url: string;
|
|
186
|
+
/**
|
|
187
|
+
* 用来判断是否是默认主子码流清晰度 (compatible)
|
|
188
|
+
*/
|
|
189
|
+
type?: stirng;
|
|
190
|
+
};
|
package/types/utils/debug.d.ts
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 从播放地址中解析信息
|
|
3
|
+
* @param {string} urlStr
|
|
4
|
+
* @returns
|
|
5
|
+
*/
|
|
6
|
+
export function getInfoByUrl(urlStr: string, isEzviz?: boolean): {
|
|
7
|
+
protocol: string;
|
|
8
|
+
hostname: string;
|
|
9
|
+
port: string;
|
|
10
|
+
pathname: string;
|
|
11
|
+
search: string;
|
|
12
|
+
query: {};
|
|
13
|
+
url: string;
|
|
14
|
+
};
|
package/types/utils/index.d.ts
CHANGED
|
@@ -3,10 +3,9 @@ export function supportOffscreen($canvas: any): boolean;
|
|
|
3
3
|
export function supportOffscreenV2(): boolean;
|
|
4
4
|
export function createContextGL($canvas: any): any;
|
|
5
5
|
export function audioContextUnlock(context: any): void;
|
|
6
|
-
export function dataURLToFile(dataURL
|
|
6
|
+
export function dataURLToFile(dataURL: string, fileName: any): File;
|
|
7
7
|
export function downloadFile(file: any, fileName: any): void;
|
|
8
8
|
export function downloadImg(content: any, fileName: any): void;
|
|
9
|
-
export function checkFull(): boolean;
|
|
10
9
|
export function now(): number;
|
|
11
10
|
export function clamp(num: any, a: any, b: any): number;
|
|
12
11
|
export function setStyle(element: any, key: any, value: any): any;
|
|
@@ -27,7 +26,6 @@ export function formatVideoDecoderConfigure(avcC: any): {
|
|
|
27
26
|
codec: string;
|
|
28
27
|
description: any;
|
|
29
28
|
};
|
|
30
|
-
export function isFullScreen(): any;
|
|
31
29
|
export function bpsSize(value: any): string;
|
|
32
30
|
export function fpsStatus(fps: any): number;
|
|
33
31
|
export function createEmptyImageBitmap(width: any, height: any): Promise<ImageBitmap>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function padStart(num: any): string;
|