@give-tech/ec-player 0.0.1-beta.45 → 0.0.1-beta.46

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/dist/index.js CHANGED
@@ -1941,6 +1941,16 @@ class HLSPlayer extends BasePlayer {
1941
1941
  * 销毁播放器,释放所有资源
1942
1942
  */
1943
1943
  destroy() {
1944
+ console.log("[HLSPlayer] Destroying player...");
1945
+ this.isPlaying = false;
1946
+ this.decodeLoopAbort = true;
1947
+ if (this.frameTimer !== null) {
1948
+ cancelAnimationFrame(this.frameTimer);
1949
+ this.frameTimer = null;
1950
+ }
1951
+ if (this.prefetcher) {
1952
+ this.prefetcher.stop();
1953
+ }
1944
1954
  if (this.abortController) {
1945
1955
  this.abortController.abort();
1946
1956
  this.abortController = null;
@@ -1954,6 +1964,7 @@ class HLSPlayer extends BasePlayer {
1954
1964
  this.hevcDecoder = null;
1955
1965
  }
1956
1966
  super.destroy();
1967
+ console.log("[HLSPlayer] Player destroyed");
1957
1968
  }
1958
1969
  /**
1959
1970
  * 跳转到指定时间
@@ -3501,7 +3512,22 @@ class FLVPlayer extends BasePlayer {
3501
3512
  * 销毁播放器,释放所有资源
3502
3513
  */
3503
3514
  destroy() {
3515
+ console.log("[FLVPlayer] Destroying player...");
3516
+ this.isPlaying = false;
3517
+ this.decodeLoopAbort = true;
3518
+ if (this.frameTimer !== null) {
3519
+ cancelAnimationFrame(this.frameTimer);
3520
+ this.frameTimer = null;
3521
+ }
3522
+ if (this.prefetcher) {
3523
+ this.prefetcher.stop();
3524
+ this.prefetcher.cancelDownload();
3525
+ }
3504
3526
  this.stopLiveDownload();
3527
+ if (this.prefetcher) {
3528
+ this.prefetcher.reset();
3529
+ this.prefetcher = null;
3530
+ }
3505
3531
  if (this.h264Decoder) {
3506
3532
  this.h264Decoder.destroy();
3507
3533
  this.h264Decoder = null;
@@ -3510,11 +3536,8 @@ class FLVPlayer extends BasePlayer {
3510
3536
  this.hevcDecoder.destroy();
3511
3537
  this.hevcDecoder = null;
3512
3538
  }
3513
- if (this.prefetcher) {
3514
- this.prefetcher.reset();
3515
- this.prefetcher = null;
3516
- }
3517
3539
  super.destroy();
3540
+ console.log("[FLVPlayer] Player destroyed");
3518
3541
  }
3519
3542
  /**
3520
3543
  * 处理预取缓冲区数据(供预取器调用)