easy-player-pro 0.1.7 → 0.1.9
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.
|
@@ -115,7 +115,8 @@ export class EasyPlayerPro {
|
|
|
115
115
|
this.onError = (err) => {
|
|
116
116
|
};
|
|
117
117
|
this.config = merge({}, defaultConfig, config);
|
|
118
|
-
this.
|
|
118
|
+
this.container = container;
|
|
119
|
+
this.player = new window.EasyPlayerPro(this.container, this.config);
|
|
119
120
|
this.videoElement = this.player.$container.querySelector('video');
|
|
120
121
|
this.isDestroy = false;
|
|
121
122
|
this.controller = new AbortController();
|
|
@@ -391,13 +392,22 @@ export class EasyPlayerPro {
|
|
|
391
392
|
* 关闭视频,释放底层资源
|
|
392
393
|
*/
|
|
393
394
|
destroy() {
|
|
394
|
-
|
|
395
|
-
if (this.
|
|
396
|
-
this.
|
|
395
|
+
try {
|
|
396
|
+
if (this.player) {
|
|
397
|
+
if (this._isRtcSRS()) {
|
|
398
|
+
this.controller.abort();
|
|
399
|
+
}
|
|
400
|
+
this.player.destroy().catch(() => { });
|
|
397
401
|
}
|
|
398
|
-
this.player
|
|
402
|
+
this.player = null;
|
|
403
|
+
this.container.innerHTML = '';
|
|
404
|
+
this.container.removeAttribute('data--easy-prov');
|
|
405
|
+
this.isDestroy = true;
|
|
399
406
|
}
|
|
400
|
-
|
|
401
|
-
|
|
407
|
+
catch (error) { }
|
|
408
|
+
}
|
|
409
|
+
close() {
|
|
410
|
+
this.destroy();
|
|
411
|
+
this.player = new window.EasyPlayerPro(this.container, this.config);
|
|
402
412
|
}
|
|
403
413
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type EasyPlayerProConfig } from "./config";
|
|
2
|
-
export type
|
|
2
|
+
export type VideoInfoType = {
|
|
3
3
|
encType: string;
|
|
4
4
|
encTypeCode: number;
|
|
5
5
|
height: number;
|
|
6
6
|
width: number;
|
|
7
7
|
};
|
|
8
|
-
export type
|
|
8
|
+
export type AudioInfoType = {
|
|
9
9
|
encTypeCode: string;
|
|
10
10
|
encType: string;
|
|
11
11
|
channels: number;
|
|
@@ -15,6 +15,7 @@ export type AudioInfo = {
|
|
|
15
15
|
export declare class EasyPlayerPro {
|
|
16
16
|
private player;
|
|
17
17
|
private config;
|
|
18
|
+
private container;
|
|
18
19
|
private _url;
|
|
19
20
|
private videoElement;
|
|
20
21
|
private controller;
|
|
@@ -34,11 +35,11 @@ export declare class EasyPlayerPro {
|
|
|
34
35
|
/**
|
|
35
36
|
* 视频信息回调
|
|
36
37
|
*/
|
|
37
|
-
onVideoInfo: (videoInfo:
|
|
38
|
+
onVideoInfo: (videoInfo: VideoInfoType) => void;
|
|
38
39
|
/**
|
|
39
40
|
* 音频信息回调
|
|
40
41
|
*/
|
|
41
|
-
onAudioInfo: (audioInfo:
|
|
42
|
+
onAudioInfo: (audioInfo: AudioInfoType) => void;
|
|
42
43
|
/**
|
|
43
44
|
* 全屏事件
|
|
44
45
|
*/
|
|
@@ -170,11 +171,11 @@ export declare class EasyPlayerPro {
|
|
|
170
171
|
/**
|
|
171
172
|
* 获取视频信息
|
|
172
173
|
*/
|
|
173
|
-
getVideoInfo():
|
|
174
|
+
getVideoInfo(): VideoInfoType | null;
|
|
174
175
|
/**
|
|
175
176
|
* 获取音频信息
|
|
176
177
|
*/
|
|
177
|
-
getAudioInfo():
|
|
178
|
+
getAudioInfo(): AudioInfoType | null;
|
|
178
179
|
/**
|
|
179
180
|
* 设置语音对讲状态(PTZ需开启)
|
|
180
181
|
* @param isMic
|
|
@@ -188,4 +189,45 @@ export declare class EasyPlayerPro {
|
|
|
188
189
|
* 关闭视频,释放底层资源
|
|
189
190
|
*/
|
|
190
191
|
destroy(): void;
|
|
192
|
+
close(): void;
|
|
193
|
+
}
|
|
194
|
+
export interface EasyPlayerProType {
|
|
195
|
+
isDestroy: boolean;
|
|
196
|
+
onPlay: () => void;
|
|
197
|
+
onPause: () => void;
|
|
198
|
+
onVideoInfo: (videoInfo: VideoInfoType) => void;
|
|
199
|
+
onAudioInfo: (audioInfo: AudioInfoType) => void;
|
|
200
|
+
onFullscreen: (isFullscreen: boolean) => void;
|
|
201
|
+
onMute: (isMute: boolean) => void;
|
|
202
|
+
onKBps: (KBps: number) => void;
|
|
203
|
+
onStretch: (isStretch: boolean) => void;
|
|
204
|
+
onPTZ: (ptz: any) => void;
|
|
205
|
+
onScreenshots: () => void;
|
|
206
|
+
onContextmenuClose: () => void;
|
|
207
|
+
onDecodeHevc: () => void;
|
|
208
|
+
onLiveEnd: () => void;
|
|
209
|
+
onTimeout: () => void;
|
|
210
|
+
onRecordEnd: () => void;
|
|
211
|
+
onRecordStart: () => void;
|
|
212
|
+
onQualityChange: (quality: string) => void;
|
|
213
|
+
onPlaybackSeek: () => void;
|
|
214
|
+
onPlaybackRate: () => void;
|
|
215
|
+
onTimestamps: () => void;
|
|
216
|
+
onError: (err: any) => void;
|
|
217
|
+
play: (url: string) => Promise<void>;
|
|
218
|
+
pause: () => void;
|
|
219
|
+
isPause: () => boolean;
|
|
220
|
+
setMute: (isMute: boolean) => void;
|
|
221
|
+
isMute: () => boolean | null;
|
|
222
|
+
screenshot: (name?: string, type?: string, rato?: number, format?: string) => string | Blob | null;
|
|
223
|
+
setFullscreen: (isFullscreen: boolean) => void;
|
|
224
|
+
exitFullscreen: () => void;
|
|
225
|
+
setQuality: (quality: string) => void;
|
|
226
|
+
setRate: (rate: number) => void;
|
|
227
|
+
seekTime: (time: number) => void;
|
|
228
|
+
getVideoInfo: () => VideoInfoType | null;
|
|
229
|
+
getAudioInfo: () => AudioInfoType | null;
|
|
230
|
+
setMic: (isMic: boolean) => void;
|
|
231
|
+
destroy: () => void;
|
|
232
|
+
close: () => void;
|
|
191
233
|
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import './css/index.css';
|
|
2
2
|
import * as easyPlayer from './core/easy-player-pro';
|
|
3
|
-
|
|
4
|
-
export type
|
|
3
|
+
import type { EasyPlayerProConfig } from './core/config';
|
|
4
|
+
export type VideoInfoType = easyPlayer.VideoInfoType;
|
|
5
|
+
export type AudioInfoType = easyPlayer.AudioInfoType;
|
|
6
|
+
export type EasyPlayerProType = easyPlayer.EasyPlayerProType;
|
|
7
|
+
export type EasyPlayerProConfigType = EasyPlayerProConfig;
|
|
5
8
|
declare const _default: typeof easyPlayer.EasyPlayerPro;
|
|
6
9
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "easy-player-pro",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "easy-player-pro 是一款能够同时支持HTTP、HTTP-FLV、HLS(m3u8)、WS、WEBRTC、FMP4视频直播与视频点播等多种协议,支持H.264、H.265、AAC、G711A、Mp3等多种音视频编码格式,支持MSE、WASM、WebCodec等多种解码方式,支持Windows、Linux、Android、iOS全平台终端的H5播放器,使用简单, 功能强大",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./lib/index.js",
|