@give-tech/ec-player 0.0.1-beta.13 → 0.0.1-beta.14

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
@@ -1548,9 +1548,14 @@ class HLSPlayer extends BasePlayer {
1548
1548
  this.lastRenderTime = 0;
1549
1549
  this.playStartTime = 0;
1550
1550
  this.accumulatedMediaTime = 0;
1551
+ this._lastLogTime = 0;
1551
1552
  this.renderLoop = (timestamp = 0) => {
1552
1553
  if (!this.isPlaying) return;
1553
1554
  const now = performance.now();
1555
+ if (!this._lastLogTime || now - this._lastLogTime > 1e3) {
1556
+ this._lastLogTime = now;
1557
+ console.log("[renderLoop] frameBuffer=", this.frameBuffer.length, "renderer=", !!this.renderer);
1558
+ }
1554
1559
  const downloaded = this.isFMP4 ? this.sampleQueue.length : this.nalQueue.length;
1555
1560
  const segments = this.isFMP4 ? this.fmp4Segments : this.segments;
1556
1561
  const totalSegments = segments.length;
@@ -1567,9 +1572,13 @@ class HLSPlayer extends BasePlayer {
1567
1572
  if (this.playStartTime === 0) {
1568
1573
  this.playStartTime = now;
1569
1574
  this.accumulatedMediaTime = 0;
1575
+ console.log("[renderLoop] Init: timescale=", timescale);
1570
1576
  }
1571
1577
  const elapsedWallTime = now - this.playStartTime;
1572
1578
  const frameDurationMs = frame.duration ? frame.duration * 1e3 / timescale : 33.33;
1579
+ if (Math.floor(elapsedWallTime / 1e3) !== Math.floor((elapsedWallTime - 20) / 1e3)) {
1580
+ console.log("[renderLoop] elapsed=", Math.floor(elapsedWallTime), "accumulated=", Math.floor(this.accumulatedMediaTime), "frameDuration=", frame.duration, "frameDurationMs=", frameDurationMs.toFixed(2), "frameBuffer=", this.frameBuffer.length);
1581
+ }
1573
1582
  const bufferMs = 50;
1574
1583
  if (elapsedWallTime >= this.accumulatedMediaTime - bufferMs) {
1575
1584
  this.frameBuffer.shift();
@@ -1582,7 +1591,9 @@ class HLSPlayer extends BasePlayer {
1582
1591
  this.callbacks.onFrameRender?.(frame);
1583
1592
  }
1584
1593
  } else {
1585
- this.lastRenderTime = 0;
1594
+ if (this.playStartTime !== 0) {
1595
+ this.playStartTime = now - this.accumulatedMediaTime;
1596
+ }
1586
1597
  }
1587
1598
  this.frameTimer = requestAnimationFrame(this.renderLoop);
1588
1599
  };
@@ -1702,7 +1713,6 @@ class HLSPlayer extends BasePlayer {
1702
1713
  */
1703
1714
  async decodeLoop() {
1704
1715
  console.log("[DecodeLoop] START, isFMP4:", this.isFMP4);
1705
- console.log("[DecodeLoop] END");
1706
1716
  let batchCount = 0;
1707
1717
  while (this.isPlaying && !this.decodeLoopAbort) {
1708
1718
  this.prefetcher?.processQueue();