easy-player-pro 0.1.8 → 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
|
}
|
|
@@ -15,6 +15,7 @@ export type AudioInfoType = {
|
|
|
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;
|
|
@@ -188,6 +189,7 @@ export declare class EasyPlayerPro {
|
|
|
188
189
|
* 关闭视频,释放底层资源
|
|
189
190
|
*/
|
|
190
191
|
destroy(): void;
|
|
192
|
+
close(): void;
|
|
191
193
|
}
|
|
192
194
|
export interface EasyPlayerProType {
|
|
193
195
|
isDestroy: boolean;
|
|
@@ -227,4 +229,5 @@ export interface EasyPlayerProType {
|
|
|
227
229
|
getAudioInfo: () => AudioInfoType | null;
|
|
228
230
|
setMic: (isMic: boolean) => void;
|
|
229
231
|
destroy: () => void;
|
|
232
|
+
close: () => void;
|
|
230
233
|
}
|
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",
|