@give-tech/ec-player 0.0.1-beta.50 → 0.0.1-beta.52
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.
|
|
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.
|
|
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;
|
|
@@ -3471,8 +3478,6 @@ class FLVPlayer extends BasePlayer {
|
|
|
3471
3478
|
this.consecutiveEmptyBuffer++;
|
|
3472
3479
|
if (isLive && this.bufferEmptyStartTime > 0) {
|
|
3473
3480
|
this.pausedTime = now - this.bufferEmptyStartTime;
|
|
3474
|
-
} else if (!isLive && this.bufferEmptyStartTime > 0) {
|
|
3475
|
-
this.playStartTimeOffset = now - this.bufferEmptyStartTime;
|
|
3476
3481
|
}
|
|
3477
3482
|
if (this.consecutiveEmptyBuffer === 1) {
|
|
3478
3483
|
console.warn("[FLVPlayer] Buffer empty, waiting for frames... queue:", this._videoTagQueue.length);
|
|
@@ -4450,6 +4455,10 @@ class EcPlayerCore {
|
|
|
4450
4455
|
this.player.load(url),
|
|
4451
4456
|
this.player.preInitDecoder()
|
|
4452
4457
|
]);
|
|
4458
|
+
if (!this.player) {
|
|
4459
|
+
console.log("[EcPlayerCore] Player destroyed during load, aborting");
|
|
4460
|
+
return;
|
|
4461
|
+
}
|
|
4453
4462
|
if (this.player instanceof HLSPlayer) {
|
|
4454
4463
|
this.detectedFormat = this.player.isFMP4 ? "hls-fmp4" : "hls-ts";
|
|
4455
4464
|
console.log("[EcPlayerCore] Updated format after playlist parse:", this.detectedFormat);
|