@missing-elements/h5p-offline-player 0.1.0 → 0.1.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.
@@ -1,6 +1,6 @@
1
1
  import { type FileEntry } from '@zip.js/zip.js';
2
2
  import { type MissingLibraries, type PrefetchEntry } from '../shared/protocol';
3
- import { type SourceHandle } from '../shared/source';
3
+ import type { SourceHandle } from '../shared/source';
4
4
  import type { ByteRange } from '../shared/range';
5
5
  import type { ForwardIndexSnapshot } from '../shared/forward-index';
6
6
  /**
@@ -21,6 +21,9 @@ export type Strategy =
21
21
  | {
22
22
  kind: 'chunked';
23
23
  };
24
+ /** Zip compression methods: the only two an H5P package is served with. */
25
+ export declare const STORED = 0;
26
+ export declare const DEFLATE = 8;
24
27
  /** The parts of `h5p.json` the player needs. Everything in it comes from an untrusted archive. */
25
28
  export interface PackageManifest {
26
29
  title?: string;
@@ -54,7 +57,8 @@ export interface LocatedEntry {
54
57
  entry: IndexedEntry;
55
58
  }
56
59
  export declare class PackageReader {
57
- private readonly handle;
60
+ /** The archive this reader reads. Exposed for the Jobs worker's liveness reports. */
61
+ readonly handle: SourceHandle;
58
62
  readonly pkgId: string;
59
63
  readonly entries: Map<string, IndexedEntry>;
60
64
  readonly rejected: string[];
@@ -0,0 +1,21 @@
1
+ import { type ChunkMeta, type ChunkStore } from '../shared/chunk-store';
2
+ /**
3
+ * Waits until the entry has at least `needed` bytes, is complete, or carries a recorded failure.
4
+ *
5
+ * The bound is a stall, not a wall clock: extraction of a large entry legitimately takes minutes,
6
+ * and a request for the tail of a 220 MB video cannot be answered until it finishes. What must
7
+ * not happen is waiting on a job that has died with the tab that owned it, so the job is expected
8
+ * to keep showing progress — when it stops, the job is asked for again, and only a second silent
9
+ * stretch gives up.
10
+ *
11
+ * Progress is two things. The watermark moving is the obvious one. The other is input: the Jobs
12
+ * worker announces the bytes it has taken from the network, and those count too, because on a
13
+ * slow or erratic host the inflate can be starved for longer than the stall bound before it has
14
+ * produced its first flush, while the job is perfectly alive. Measured against a 93 MB deflated
15
+ * video on a host with half-second latency, the first byte of output took 8.6 s on a fast link
16
+ * and past 30 s on a 4 Mbit/s one — and the old bound read the second as a dead job.
17
+ */
18
+ export declare function waitForWatermark(store: ChunkStore, entry: string, needed: number, options?: {
19
+ stallMs?: number;
20
+ onStall?: () => Promise<void>;
21
+ }): Promise<ChunkMeta | null>;