@mebius-io/web 0.5.3 → 0.5.4
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.cjs +18 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.global.js +18 -7
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +18 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -471,7 +471,7 @@ var LIVE_FLV_CONFIG = {
|
|
|
471
471
|
var MAX_DRIFT_S = 2;
|
|
472
472
|
var EDGE_MARGIN_S = 0.4;
|
|
473
473
|
var AUDIO_RETRY_MS = 2500;
|
|
474
|
-
var
|
|
474
|
+
var UPSTREAM_LATENCY_MS = 800;
|
|
475
475
|
function stalledWithData(video, ms) {
|
|
476
476
|
if (video.currentTime > 0) return Promise.resolve(false);
|
|
477
477
|
return new Promise((resolve) => {
|
|
@@ -601,13 +601,24 @@ var FlvViewTransport = class {
|
|
|
601
601
|
return { bitrateKbps, framesPerSecond, latencyMs: void 0 };
|
|
602
602
|
}
|
|
603
603
|
/**
|
|
604
|
-
* Estimate
|
|
605
|
-
*
|
|
606
|
-
*
|
|
607
|
-
*
|
|
604
|
+
* Estimate — FLV carries no wall clock, so this is measured where possible
|
|
605
|
+
* and assumed where not (see {@link UPSTREAM_LATENCY_MS}).
|
|
606
|
+
*
|
|
607
|
+
* The measurable half is the decoded media queued ahead of the playhead:
|
|
608
|
+
* whatever is buffered but not yet shown is, by definition, how far behind
|
|
609
|
+
* the newest received frame this viewer is watching. A flat guess for the
|
|
610
|
+
* whole delay was previously used, and being too generous costs real time —
|
|
611
|
+
* every millisecond of over-estimate is a caption withheld for no reason,
|
|
612
|
+
* on top of the STT latency the viewer already pays.
|
|
608
613
|
*/
|
|
609
614
|
playheadEpochMs() {
|
|
610
|
-
|
|
615
|
+
let bufferedAheadMs = 0;
|
|
616
|
+
const ranges = this.video?.buffered;
|
|
617
|
+
if (ranges && ranges.length > 0 && this.video) {
|
|
618
|
+
const ahead = ranges.end(ranges.length - 1) - this.video.currentTime;
|
|
619
|
+
if (Number.isFinite(ahead) && ahead > 0) bufferedAheadMs = ahead * 1e3;
|
|
620
|
+
}
|
|
621
|
+
return Date.now() - UPSTREAM_LATENCY_MS - bufferedAheadMs;
|
|
611
622
|
}
|
|
612
623
|
};
|
|
613
624
|
|
|
@@ -840,7 +851,7 @@ function normalize(c, fallback) {
|
|
|
840
851
|
// src/captions.ts
|
|
841
852
|
var TICK_MS = 100;
|
|
842
853
|
var STALE_MS = 5e3;
|
|
843
|
-
var MAX_QUEUE_MS =
|
|
854
|
+
var MAX_QUEUE_MS = 1500;
|
|
844
855
|
var MebiusCaptions = class extends TypedEmitter {
|
|
845
856
|
/** @internal */
|
|
846
857
|
constructor(signaling, player, opts) {
|