dsh-vidi 0.3.0 → 0.3.1

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/lib/client.js CHANGED
@@ -33974,7 +33974,7 @@ function RestreamPanel(props) {
33974
33974
  return () => clearInterval(id);
33975
33975
  }, [running]);
33976
33976
  /** Known notes from the host, in the page's language. */
33977
- const note = (m) => m === "ended" ? t("rs.m.ended") : m === "no-burn" ? t("rs.m.noBurn") : m;
33977
+ const note = (m) => m === "ended" ? t("rs.m.ended") : m === "no-burn" ? t("rs.m.noBurn") : m === "stalled" ? t("rs.m.stalled") : m;
33978
33978
  const pname = (p) => t(`rs.p.${p}`);
33979
33979
  const save = async () => {
33980
33980
  if (!editing) return;
@@ -36091,6 +36091,7 @@ const en = {
36091
36091
  "rs.stopOne": "Stop this one",
36092
36092
  "rs.join": "Add",
36093
36093
  "rs.m.ended": "The video ended, so restreaming stopped.",
36094
+ "rs.m.stalled": "Nothing more to send (the recording stopped), so restreaming stopped.",
36094
36095
  "rs.m.noBurn": "Subtitles could not be drawn on this computer; streaming without them.",
36095
36096
  "rs.note": "Starts from where you are watching, with the subtitles you see. Keys stay on this computer.",
36096
36097
  "rs.s.connecting": "Connecting",
@@ -36406,6 +36407,7 @@ const zh = {
36406
36407
  "rs.stopOne": "停止这一路",
36407
36408
  "rs.join": "加入",
36408
36409
  "rs.m.ended": "视频播完了,转播已停止。",
36410
+ "rs.m.stalled": "没有新画面可推了(录制已停),转播已停止。",
36409
36411
  "rs.m.noBurn": "这台电脑画不了字幕,先不带字幕推流。",
36410
36412
  "rs.note": "从你正在看的位置开始,带着你看到的字幕。推流码只存在这台电脑上。",
36411
36413
  "rs.s.connecting": "连接中",
package/lib/index.mjs CHANGED
@@ -1272,6 +1272,9 @@ var Restream = class extends EventEmitter {
1272
1272
  blank;
1273
1273
  startAt = 0;
1274
1274
  spawnedAt = 0;
1275
+ watchdog;
1276
+ lastOut = 0;
1277
+ stuckSince = Date.now();
1275
1278
  constructor(source, opts, targets, log) {
1276
1279
  super();
1277
1280
  this.source = source;
@@ -1415,6 +1418,18 @@ var Restream = class extends EventEmitter {
1415
1418
  });
1416
1419
  if (burn) this.feedSubtitles(w, h);
1417
1420
  for (const p of this.pushes.values()) this.connect(p.target.id);
1421
+ this.watchdog = setInterval(() => {
1422
+ if (this.stopped) return;
1423
+ if (this.outTime > this.lastOut) {
1424
+ this.lastOut = this.outTime;
1425
+ this.stuckSince = Date.now();
1426
+ return;
1427
+ }
1428
+ if (Date.now() - this.stuckSince > 25e3) {
1429
+ this.log("restream: the encoder stopped producing");
1430
+ this.stop("stalled");
1431
+ }
1432
+ }, 5e3);
1418
1433
  this.changed();
1419
1434
  }
1420
1435
  /** Subtitle pictures for media times from the start on, kept about a second ahead of the encoder. */
@@ -1562,6 +1577,7 @@ var Restream = class extends EventEmitter {
1562
1577
  async stop(message) {
1563
1578
  if (this.stopped) return;
1564
1579
  this.stopped = true;
1580
+ clearInterval(this.watchdog);
1565
1581
  process.off("exit", this.killAll);
1566
1582
  clearInterval(this.subsTimer);
1567
1583
  for (const p of this.pushes.values()) {
@@ -2409,6 +2425,10 @@ var LiveJob = class LiveJob extends EventEmitter {
2409
2425
  return;
2410
2426
  }
2411
2427
  if (!this.segments().length) throw new Error("nothing recorded yet");
2428
+ if (this.vod && this.duration && opts.from >= this.duration - 1.5) opts = {
2429
+ ...opts,
2430
+ from: 0
2431
+ };
2412
2432
  const r = new Restream({
2413
2433
  input: (from) => this.restreamInput(from),
2414
2434
  rowsAt: (t) => this.rowsAt(t, opts.style)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-vidi",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "A video tool for DeepSeek Harness: watch live streams, videos and podcasts with real-time subtitles in any language, then clip and download",
5
5
  "type": "module",
6
6
  "license": "PolyForm-Noncommercial-1.0.0",