@mebius-io/web 0.5.0 → 0.5.2
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 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.global.js +18 -1
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +18 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -429,6 +429,7 @@ var LIVE_FLV_CONFIG = {
|
|
|
429
429
|
var MAX_DRIFT_S = 2;
|
|
430
430
|
var EDGE_MARGIN_S = 0.4;
|
|
431
431
|
var AUDIO_RETRY_MS = 2500;
|
|
432
|
+
var ESTIMATED_LATENCY_MS = 3e3;
|
|
432
433
|
function stalledWithData(video, ms) {
|
|
433
434
|
if (video.currentTime > 0) return Promise.resolve(false);
|
|
434
435
|
return new Promise((resolve) => {
|
|
@@ -557,6 +558,15 @@ var FlvViewTransport = class {
|
|
|
557
558
|
}
|
|
558
559
|
return { bitrateKbps, framesPerSecond, latencyMs: void 0 };
|
|
559
560
|
}
|
|
561
|
+
/**
|
|
562
|
+
* Estimate only — see {@link ESTIMATED_LATENCY_MS}. Without this, captions
|
|
563
|
+
* never render on the FLV route at all: {@link MebiusCaptions} withholds
|
|
564
|
+
* every segment until the playhead reaches its `epochMs`, and a transport
|
|
565
|
+
* returning `null` here means the playhead comparison never runs.
|
|
566
|
+
*/
|
|
567
|
+
playheadEpochMs() {
|
|
568
|
+
return Date.now() - ESTIMATED_LATENCY_MS;
|
|
569
|
+
}
|
|
560
570
|
};
|
|
561
571
|
|
|
562
572
|
// src/internal/transport.ts
|
|
@@ -1141,10 +1151,17 @@ var SignalingClient = class {
|
|
|
1141
1151
|
* Realtime captions SSE URL. Same play token as media — the engine's
|
|
1142
1152
|
* `PlayVerifier` gates both, so a viewer who can watch the stream can already
|
|
1143
1153
|
* read its captions with zero extra credential.
|
|
1154
|
+
*
|
|
1155
|
+
* `/api/v1/live/...`, NOT `/live/...`: unlike {@link scalePlaylistUrl}, which
|
|
1156
|
+
* hits the engine's bare `/live/*` media-edge catch-all, captions are mounted
|
|
1157
|
+
* under the versioned control-API group (mebius-stream-engine
|
|
1158
|
+
* internal/api/routes.go) with the play-token middleware, not the proxy.
|
|
1159
|
+
* Copying the media-edge prefix here 401s every request — the catch-all
|
|
1160
|
+
* doesn't recognise the path and never reaches the captions handler at all.
|
|
1144
1161
|
*/
|
|
1145
1162
|
captionsUrl(streamId, lang) {
|
|
1146
1163
|
return this.withToken(
|
|
1147
|
-
`${this.base()}/live/${encodeURIComponent(streamId)}/captions?lang=${encodeURIComponent(lang)}`
|
|
1164
|
+
`${this.base()}/api/v1/live/${encodeURIComponent(streamId)}/captions?lang=${encodeURIComponent(lang)}`
|
|
1148
1165
|
);
|
|
1149
1166
|
}
|
|
1150
1167
|
// Maps a neutral session kind to the concrete signaling path segment. This
|