@give-tech/ec-player 0.0.1-beta.1 → 0.0.1-beta.3
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 +20 -16
- package/dist/index.js.map +1 -1
- package/dist/player/FLVPlayer.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2555,7 +2555,7 @@ class FLVPlayer extends BasePlayer {
|
|
|
2555
2555
|
const isLive = this.config.isLive;
|
|
2556
2556
|
if (this._timedFrameBuffer.length > 0 && this.renderer) {
|
|
2557
2557
|
this.consecutiveEmptyBuffer = 0;
|
|
2558
|
-
if (this.
|
|
2558
|
+
if (this.playStartTime <= 0) {
|
|
2559
2559
|
this.firstFrameDts = this._timedFrameBuffer[0].dts;
|
|
2560
2560
|
this.playStartTime = now;
|
|
2561
2561
|
this.playStartTimeOffset = 0;
|
|
@@ -2766,6 +2766,12 @@ class FLVPlayer extends BasePlayer {
|
|
|
2766
2766
|
}
|
|
2767
2767
|
console.log("[FLVPlayer] Buffer ready, frames:", this._timedFrameBuffer.length, "queue:", this._videoTagQueue.length);
|
|
2768
2768
|
if (this._timedFrameBuffer.length > 0) {
|
|
2769
|
+
if (this.config.isLive && this._timedFrameBuffer.length > 15) {
|
|
2770
|
+
const droppedCount = this._timedFrameBuffer.length - 5;
|
|
2771
|
+
this._timedFrameBuffer = this._timedFrameBuffer.slice(-5);
|
|
2772
|
+
this.droppedFrames += droppedCount;
|
|
2773
|
+
console.log("[FLVPlayer] Live resume: dropped", droppedCount, "old frames, keeping latest 5");
|
|
2774
|
+
}
|
|
2769
2775
|
this.firstFrameDts = this._timedFrameBuffer[0].dts;
|
|
2770
2776
|
this.playStartTime = performance.now();
|
|
2771
2777
|
console.log("[FLVPlayer] Play time initialized, firstFrameDts:", this.firstFrameDts);
|
|
@@ -2810,24 +2816,22 @@ class FLVPlayer extends BasePlayer {
|
|
|
2810
2816
|
}
|
|
2811
2817
|
let newCount = 0;
|
|
2812
2818
|
for (const tag of result.videoTags) {
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
break;
|
|
2822
|
-
}
|
|
2819
|
+
let annexBData = this.flvDemuxer.videoTagToAnnexB(tag, lengthSize);
|
|
2820
|
+
if (!annexBData) {
|
|
2821
|
+
for (const trySize of [4, 2, 1]) {
|
|
2822
|
+
if (trySize !== lengthSize) {
|
|
2823
|
+
annexBData = this.flvDemuxer.videoTagToAnnexB(tag, trySize);
|
|
2824
|
+
if (annexBData) {
|
|
2825
|
+
lengthSize = trySize;
|
|
2826
|
+
break;
|
|
2823
2827
|
}
|
|
2824
2828
|
}
|
|
2825
2829
|
}
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2830
|
+
}
|
|
2831
|
+
if (annexBData) {
|
|
2832
|
+
this._videoTagQueue.push({ tag, annexBData });
|
|
2833
|
+
this._lastQueuedTimestamp = tag.timestamp;
|
|
2834
|
+
newCount++;
|
|
2831
2835
|
}
|
|
2832
2836
|
}
|
|
2833
2837
|
if (newCount > 0) {
|