@give-tech/ec-player 0.0.1-beta.50 → 0.0.1-beta.51

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
@@ -1841,6 +1841,7 @@ class HLSPlayer extends BasePlayer {
1841
1841
  this.lastRenderTime = 0;
1842
1842
  this.playStartTime = 0;
1843
1843
  this.accumulatedMediaTime = 0;
1844
+ this._consecutiveEmptyBuffer = 0;
1844
1845
  this._lastLogTime = 0;
1845
1846
  this._lastRafTime = 0;
1846
1847
  this.renderLoop = (timestamp = 0) => {
@@ -1884,6 +1885,7 @@ class HLSPlayer extends BasePlayer {
1884
1885
  if (this.state.isBuffering) {
1885
1886
  this.updateState({ isBuffering: false, bufferingProgress: void 0 });
1886
1887
  }
1888
+ this._consecutiveEmptyBuffer = 0;
1887
1889
  const timescale = this.fmp4Demuxer.getTimescale();
1888
1890
  if (this.playStartTime === 0) {
1889
1891
  this.playStartTime = now;
@@ -1935,7 +1937,10 @@ class HLSPlayer extends BasePlayer {
1935
1937
  }
1936
1938
  } else {
1937
1939
  if (this.isPlaying && !this.state.isBuffering) {
1938
- this.updateState({ isBuffering: true });
1940
+ this._consecutiveEmptyBuffer++;
1941
+ if (this._consecutiveEmptyBuffer >= 15) {
1942
+ this.updateState({ isBuffering: true });
1943
+ }
1939
1944
  }
1940
1945
  if (this.playStartTime === 0) {
1941
1946
  console.log("[renderLoop] Waiting for frames...");
@@ -3463,7 +3468,9 @@ class FLVPlayer extends BasePlayer {
3463
3468
  }
3464
3469
  } else {
3465
3470
  if (this.isPlaying && !this.state.isBuffering) {
3466
- this.updateState({ isBuffering: true });
3471
+ if (this.consecutiveEmptyBuffer >= 15) {
3472
+ this.updateState({ isBuffering: true });
3473
+ }
3467
3474
  }
3468
3475
  if (this.consecutiveEmptyBuffer === 0 && this.lastRenderedDts >= 0) {
3469
3476
  this.bufferEmptyStartTime = now;