@give-tech/ec-player 0.0.1-beta.39 → 0.0.1-beta.40

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
@@ -1718,6 +1718,7 @@ class HLSPlayer extends BasePlayer {
1718
1718
  this._currentSegmentDuration = 0;
1719
1719
  this.prefetcher = null;
1720
1720
  this.abortController = null;
1721
+ this.readyFired = false;
1721
1722
  this._nalCountInCurrentSegment = 0;
1722
1723
  this.lastRenderTime = 0;
1723
1724
  this.playStartTime = 0;
@@ -1831,6 +1832,7 @@ class HLSPlayer extends BasePlayer {
1831
1832
  this._nalQueue.length = 0;
1832
1833
  this._sampleQueue.length = 0;
1833
1834
  this.currentSegmentIndex = 0;
1835
+ this.readyFired = false;
1834
1836
  this.resetState();
1835
1837
  if (this.prefetcher) {
1836
1838
  this.prefetcher.reset();
@@ -1967,6 +1969,10 @@ class HLSPlayer extends BasePlayer {
1967
1969
  if (frame) {
1968
1970
  this.frameBuffer.push(frame);
1969
1971
  decodedInBatch++;
1972
+ if (!this.readyFired) {
1973
+ this.readyFired = true;
1974
+ this.callbacks.onReady?.();
1975
+ }
1970
1976
  if (this.config.isLive) {
1971
1977
  while (this.frameBuffer.length > this.config.targetBufferSize) {
1972
1978
  this.frameBuffer.shift();
@@ -1990,6 +1996,10 @@ class HLSPlayer extends BasePlayer {
1990
1996
  if (frame) {
1991
1997
  this.frameBuffer.push(frame);
1992
1998
  decodedInBatch++;
1999
+ if (!this.readyFired) {
2000
+ this.readyFired = true;
2001
+ this.callbacks.onReady?.();
2002
+ }
1993
2003
  if (this.config.isLive) {
1994
2004
  while (this.frameBuffer.length > this.config.targetBufferSize) {
1995
2005
  this.frameBuffer.shift();
@@ -3079,6 +3089,7 @@ class FLVPlayer extends BasePlayer {
3079
3089
  this.liveDownloadAbort = false;
3080
3090
  this._lastQueuedTimestamp = -1;
3081
3091
  this.abortController = null;
3092
+ this.readyFired = false;
3082
3093
  this._currentDownloadSpeed = 0;
3083
3094
  this.renderedFrames = 0;
3084
3095
  this.lastRenderLogTime = 0;
@@ -3222,6 +3233,7 @@ class FLVPlayer extends BasePlayer {
3222
3233
  this._timedFrameBuffer = [];
3223
3234
  this._videoTagQueue = [];
3224
3235
  this.liveDownloadAbort = false;
3236
+ this.readyFired = false;
3225
3237
  this.resetState();
3226
3238
  this.playStartTime = 0;
3227
3239
  this.firstFrameDts = -1;
@@ -3328,6 +3340,10 @@ class FLVPlayer extends BasePlayer {
3328
3340
  const dts = queuedTag.tag.timestamp;
3329
3341
  const pts = dts + queuedTag.tag.compositionTimeOffset;
3330
3342
  this._timedFrameBuffer.push({ frame, dts, pts });
3343
+ if (!this.readyFired) {
3344
+ this.readyFired = true;
3345
+ this.callbacks.onReady?.();
3346
+ }
3331
3347
  if (this.videoWidth === 0 || this.videoHeight === 0) {
3332
3348
  this.adjustBufferForResolution(frame.width, frame.height);
3333
3349
  }
@@ -3473,6 +3489,10 @@ class FLVPlayer extends BasePlayer {
3473
3489
  const pts = dts + queuedTag.tag.compositionTimeOffset;
3474
3490
  this._timedFrameBuffer.push({ frame, dts, pts });
3475
3491
  decodedInBatch++;
3492
+ if (!this.readyFired) {
3493
+ this.readyFired = true;
3494
+ this.callbacks.onReady?.();
3495
+ }
3476
3496
  if (this.videoWidth === 0 || this.videoHeight === 0) {
3477
3497
  this.adjustBufferForResolution(frame.width, frame.height);
3478
3498
  }