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

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
@@ -2006,6 +2006,14 @@ class HLSPlayer extends BasePlayer {
2006
2006
  async decodeLoop() {
2007
2007
  console.log("[DecodeLoop] START, isFMP4:", this.isFMP4);
2008
2008
  let batchCount = 0;
2009
+ const READY_TIMEOUT_MS = 5e3;
2010
+ const readyTimeoutId = setTimeout(() => {
2011
+ if (!this.readyFired) {
2012
+ console.warn("[HLSPlayer] Ready timeout, triggering onReady anyway");
2013
+ this.readyFired = true;
2014
+ this.callbacks.onReady?.();
2015
+ }
2016
+ }, READY_TIMEOUT_MS);
2009
2017
  while (this.isPlaying && !this.decodeLoopAbort) {
2010
2018
  const sampleQueueSize = this.sampleQueue.length;
2011
2019
  const maxSamplesBeforePause = this.config.maxQueueSize * 3;
@@ -2112,6 +2120,7 @@ class HLSPlayer extends BasePlayer {
2112
2120
  await this.sleep(2);
2113
2121
  }
2114
2122
  }
2123
+ clearTimeout(readyTimeoutId);
2115
2124
  console.log("[DecodeLoop] END, batches:", batchCount);
2116
2125
  }
2117
2126
  /**
@@ -3416,8 +3425,8 @@ class FLVPlayer extends BasePlayer {
3416
3425
  * 开始播放(覆盖基类方法)
3417
3426
  */
3418
3427
  async play() {
3419
- const MIN_BUFFER_SIZE = this.config.isLive ? 3 : this.dynamicMinBufferSize;
3420
- const MAX_WAIT_TIME = this.config.isLive ? 3e3 : 1e4;
3428
+ const MIN_BUFFER_SIZE = 2;
3429
+ const MAX_WAIT_TIME = this.config.isLive ? 1e3 : 5e3;
3421
3430
  const startTime = Date.now();
3422
3431
  console.log(`[FLVPlayer] Waiting for buffer (target: ${MIN_BUFFER_SIZE} frames)...`);
3423
3432
  let aggressiveDecodeCount = 0;
@@ -3451,6 +3460,11 @@ class FLVPlayer extends BasePlayer {
3451
3460
  }
3452
3461
  }
3453
3462
  console.log("[FLVPlayer] Buffer ready, frames:", this._timedFrameBuffer.length, "queue:", this._videoTagQueue.length);
3463
+ if (!this.readyFired) {
3464
+ console.warn("[FLVPlayer] No frames decoded after buffer wait, triggering onReady anyway");
3465
+ this.readyFired = true;
3466
+ this.callbacks.onReady?.();
3467
+ }
3454
3468
  if (this._timedFrameBuffer.length > 0) {
3455
3469
  if (this.config.isLive && this._timedFrameBuffer.length > 60) {
3456
3470
  const droppedCount = this._timedFrameBuffer.length - 30;
@@ -3680,8 +3694,8 @@ class FLVPlayer extends BasePlayer {
3680
3694
  }
3681
3695
  const chunks = [];
3682
3696
  let totalLength = 0;
3683
- const MIN_DATA_SIZE = isLive ? 100 * 1024 : 500 * 1024;
3684
- const TIMEOUT_MS = isLive ? 5e3 : 8e3;
3697
+ const MIN_DATA_SIZE = isLive ? 30 * 1024 : 64 * 1024;
3698
+ const TIMEOUT_MS = isLive ? 2e3 : 5e3;
3685
3699
  const startTime = Date.now();
3686
3700
  let started = false;
3687
3701
  let lastLoggedTags = 0;