@mebius-io/web 0.5.4 → 0.6.0
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 +11 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.global.js +11 -3
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -149,6 +149,13 @@ interface CaptionSegment {
|
|
|
149
149
|
durationMs: number;
|
|
150
150
|
/** Original transcript, in the source language. */
|
|
151
151
|
text: string;
|
|
152
|
+
/**
|
|
153
|
+
* Language `text` is actually in, as the recogniser identified it. With an
|
|
154
|
+
* "auto" source this varies per sentence, so a client showing `text` as a
|
|
155
|
+
* subtitle must check this rather than assume it matches what the viewer
|
|
156
|
+
* asked for.
|
|
157
|
+
*/
|
|
158
|
+
srcLang?: string;
|
|
152
159
|
/** The requested {@link CaptionsOptions.lang} translation, if produced yet. */
|
|
153
160
|
translation?: string;
|
|
154
161
|
/** Always `true`. Render a machine-generated indicator — never as a direct quote. */
|
|
@@ -417,6 +424,12 @@ declare class MebiusCaptions extends TypedEmitter<CaptionsEventMap> {
|
|
|
417
424
|
private es;
|
|
418
425
|
private timer;
|
|
419
426
|
private readonly pending;
|
|
427
|
+
/**
|
|
428
|
+
* segmentId -> the rev already handed to listeners. Not a Set: with interim
|
|
429
|
+
* revisions on, a segment stays pending while it is being corrected, and a
|
|
430
|
+
* plain "have I shown this id" check re-emits the same unchanged text on
|
|
431
|
+
* every 100ms tick. Comparing revs emits exactly once per actual revision.
|
|
432
|
+
*/
|
|
420
433
|
private readonly shown;
|
|
421
434
|
/** @internal */
|
|
422
435
|
constructor(signaling: SignalingClient, player: MebiusPlayer, opts: CaptionsOptions);
|
package/dist/index.d.ts
CHANGED
|
@@ -149,6 +149,13 @@ interface CaptionSegment {
|
|
|
149
149
|
durationMs: number;
|
|
150
150
|
/** Original transcript, in the source language. */
|
|
151
151
|
text: string;
|
|
152
|
+
/**
|
|
153
|
+
* Language `text` is actually in, as the recogniser identified it. With an
|
|
154
|
+
* "auto" source this varies per sentence, so a client showing `text` as a
|
|
155
|
+
* subtitle must check this rather than assume it matches what the viewer
|
|
156
|
+
* asked for.
|
|
157
|
+
*/
|
|
158
|
+
srcLang?: string;
|
|
152
159
|
/** The requested {@link CaptionsOptions.lang} translation, if produced yet. */
|
|
153
160
|
translation?: string;
|
|
154
161
|
/** Always `true`. Render a machine-generated indicator — never as a direct quote. */
|
|
@@ -417,6 +424,12 @@ declare class MebiusCaptions extends TypedEmitter<CaptionsEventMap> {
|
|
|
417
424
|
private es;
|
|
418
425
|
private timer;
|
|
419
426
|
private readonly pending;
|
|
427
|
+
/**
|
|
428
|
+
* segmentId -> the rev already handed to listeners. Not a Set: with interim
|
|
429
|
+
* revisions on, a segment stays pending while it is being corrected, and a
|
|
430
|
+
* plain "have I shown this id" check re-emits the same unchanged text on
|
|
431
|
+
* every 100ms tick. Comparing revs emits exactly once per actual revision.
|
|
432
|
+
*/
|
|
420
433
|
private readonly shown;
|
|
421
434
|
/** @internal */
|
|
422
435
|
constructor(signaling: SignalingClient, player: MebiusPlayer, opts: CaptionsOptions);
|
package/dist/index.global.js
CHANGED
|
@@ -43438,7 +43438,13 @@ Schedule: ${scheduleItems.map((seg) => segmentToString(seg))} pos: ${this.timeli
|
|
|
43438
43438
|
this.es = null;
|
|
43439
43439
|
this.timer = null;
|
|
43440
43440
|
this.pending = /* @__PURE__ */ new Map();
|
|
43441
|
-
|
|
43441
|
+
/**
|
|
43442
|
+
* segmentId -> the rev already handed to listeners. Not a Set: with interim
|
|
43443
|
+
* revisions on, a segment stays pending while it is being corrected, and a
|
|
43444
|
+
* plain "have I shown this id" check re-emits the same unchanged text on
|
|
43445
|
+
* every 100ms tick. Comparing revs emits exactly once per actual revision.
|
|
43446
|
+
*/
|
|
43447
|
+
this.shown = /* @__PURE__ */ new Map();
|
|
43442
43448
|
}
|
|
43443
43449
|
/** Open the SSE connection and begin emitting segments for `streamId`. */
|
|
43444
43450
|
start(streamId) {
|
|
@@ -43487,8 +43493,9 @@ Schedule: ${scheduleItems.map((seg) => segmentToString(seg))} pos: ${this.timeli
|
|
|
43487
43493
|
this.emit("cleared", { segmentId: id });
|
|
43488
43494
|
continue;
|
|
43489
43495
|
}
|
|
43490
|
-
|
|
43491
|
-
this.shown.
|
|
43496
|
+
const rev = frame.rev ?? 0;
|
|
43497
|
+
if (this.shown.get(id) === rev) continue;
|
|
43498
|
+
this.shown.set(id, rev);
|
|
43492
43499
|
this.emit("segment", toSegment(id, frame, this.opts.lang));
|
|
43493
43500
|
}
|
|
43494
43501
|
}
|
|
@@ -43501,6 +43508,7 @@ Schedule: ${scheduleItems.map((seg) => segmentToString(seg))} pos: ${this.timeli
|
|
|
43501
43508
|
epochMs: frame.epochMs ?? 0,
|
|
43502
43509
|
durationMs: frame.durationMs ?? 0,
|
|
43503
43510
|
text: frame.text ?? "",
|
|
43511
|
+
srcLang: frame.srcLang,
|
|
43504
43512
|
translation: frame.translations?.[lang],
|
|
43505
43513
|
machineGenerated: true
|
|
43506
43514
|
};
|