@vestra-player/sdk 1.7.6 → 1.7.8

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/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.7.8
4
+
5
+ **Who must change: nobody; additions only.** A plugin that uses them declares the new capability `media.sources` (exports of its files also `media.read` and `media.control`, as any export; `media.sources.open` also `playback.control`, as any open) and needs the player that serves them (`minPlayerVersion` of the first player release after 0.7.6). `apiVersion` stays `vestra/1`; the API surface snapshot gains the new members. Snapshot exports are unchanged.
6
+
7
+ **API design rule (user, 2026-11-10)**: a new API names uses by two or three different plugins, otherwise an existing one is extended. Applied here: `media.sources` is new because several plugins need files the user opened, named without paths and found again after a move: Clip Export (its Collection page), a bookmarks or history plugin (reopen what was watched, at its position), a resume plugin (follow a file across renames with Locate…), a compare plugin (switch between two remembered files) and a chapters plugin (marks per file without storing paths). Exporting several ranges is not a new API: it extends the export of a clip, whose input can now be parts of remembered files instead of a snapshot (one part is a clip of one file).
8
+
9
+ - **`plugin.media.sources`** (`MediaSources`): tokens for local files the user opened, kept by the player across restarts. `remember(options?)` gives a token for the file playing now (a stream, an address or a plugin's picture fails `unsupported`; `ifCurrent` as for a capture), with the file's name, duration and stream facts (`SourceReference`), never its path or content. `get(token)` looks at the file again (`status`: `ok`, `missing`, `changed`), `locate(token)` shows the player's own file dialog and rebinds the token to the user's choice (`null` when cancelled), `forget(token)`, `list()`. A token belongs to the plugin that got it; at most 500 per plugin (`limit`); the player deletes them when the plugin is uninstalled. An unknown token fails `missing`.
10
+ - **`plugin.media.sources.open(token, { start? })`**: the player opens the remembered file and plays it from `start` (Clip Export's "preview this part", a bookmark's "go there"), an ordinary open like `player.open` of that file (the playlist treats it as any open), so it needs `playback.control` as well as `media.sources` (`capability` without either; the player's table has an `ifDeclared` rule for `media.sources.open`); followed until loaded like `player.open` (with `playback.read`). The plugin names the file by its token instead of keeping its path; once it plays, `player.state.source` shows the path as for any open. A missing or changed file rejects with `source-missing` / `source-changed` before anything opens.
11
+ - **`plugin.media.export(options)`** (`PartsExportOptions`): a clip whose input is 1 to 100 parts `{ source: token, start, end }` of remembered files instead of a snapshot, in the formats of a snapshot's clip: `format: "copy"` copies the parts as they are, each from the keyframe at or before its start; `format: "mp4"` re-encodes them to H.264 + AAC at the first part's size and frame rate under the `encoding` ceilings, letterboxed, the sound at 48 kHz stereo. The same `ExportJob` as `Snapshot.export` (the same queue, `done`, `cancel`, `outcome`); on the wire the same `jobs.start`, with `parts` in place of `snapshotId`. `progress` gains `part` and `parts`; `facts.join` says how each part was written; a part whose file is gone ends the job `source-missing`, a changed one `source-changed`.
12
+ - **`plugin.media.exportCheck(parts, options?)`** (`ExportCheck`, wire `jobs.check`): what blocks an export of the parts (`missing`, `changed`, `unknown`, `noVideo`, `range`), whether `copy` can write them (else each difference from the first part: `videoCodec`, `videoParams`, `size`, `fps`, `pixelFormat`, `audio`, with both values) and what `mp4` writes. Cheap (nothing is decoded): run it on every change of a list.
13
+ - **Bounds and safety** (security review): an export's parts are at most 24 hours in all (`invalid`); before writing, the player compares the free space with an estimate for the intermediate parts (kept in its own temporary folder, emptied at its next start, so a crash leaves nothing beside the user's videos) and for the output, and ends the job `failed` with `no-space` when there is too little; every join of a copy is decode-checked, not only the start. One plugin has at most 4 `remember`/`get`/`list`/check requests running (`busy`), and one `locate` dialog every 2 seconds (`busy`). A development load's tokens end with the run that loaded it. Tokens hiding paths is an API convenience, not a security boundary: `player.state.source` has the path of the playing file and plugin processes are not sandboxed from the file system (said at `MediaSources` and `MediaSources.open`). `MEDIA_SOURCE_LIMITS` in the limits reference; `./runtime` exports it for the player's agreement test, and the SDK's parts check and `TestHost` read their bounds from it.
14
+ - **`exportCheck({ snapshot, end })`**: the check also takes a snapshot's clip (one part; no `media.sources` needed), so any export can be checked first; a processed snapshot cannot be copied (reason `effects`). The wire `jobs.check` takes `parts` or `snapshotId`, one of them (`invalid` otherwise); `end` belongs to the `snapshotId` form only, so `parts` with an `end` is `invalid` (in the SDK, `TestHost` and the player). Both kinds count in the plugin's 4 requests. The player's messages for a missing or mistyped field of `media.sources.*` and `jobs.check` are its parser's (`missing field `token``); the code stays `invalid`.
15
+ - **Thumbnails**: no API. A part's thumbnail is a frame the plugin captures while the file plays (`media.capture`, `snapshot.export` as JPEG into its data directory; `media.read`, `media.control`) and shows with `plugin.ui.image(path, { maxSide })` (the example at `MediaSources.remember`).
16
+ - **`TestHost`**: `mediaFiles` (the facts, status and `version` of local files by path; a new version reads `changed` and gets a new token, as the player's size and time), parts exports that end `source-missing` / `source-changed` when their files went or changed, the player's bounds in `jobs.check`, and the SDK refuses parts exports and `media.sources` members without `media.sources`, and `open` without `playback.control` (`capability`), as the player does; `sourceReferences` (token → path) and `sourceOpens`; `exports` also records exports of parts (with `parts`); `locate` takes its answer from `dialogAnswers`. An export of parts advances like a clip's, reporting its middle part while running.
17
+ - Capability table synced from the player (`media.sources`: `media.sources.*`, and `media.sources.open` asks for `playback.control` until it is declared, then for `media.sources`; `jobs.start` with `parts` and `jobs.check` are `media.control`'s, and the player also checks `media.sources` for them); the generated Capabilities, Errors, Limits ("Remembered files and exports of their parts"), Messages and Testing tables follow. Tests: `test/media-sources.test.ts`.
18
+ - **Capability checker** (`vestra-plugin check`, the TypeScript plugin): a member whose `ifDeclared` rules read each other's answers is worked out again until its needs stop changing, so `MediaSources.open` reports both `media.sources` and `playback.control` (before, a rule was decided once). Members whose needs settled at once (`Player.seek`, `Player.open`) are unchanged.
19
+ - **Docs**: `BUILTIN_COMMANDS`, `BUILTIN_SUBMENUS` and the built-in tables of the Commands reference say they are a snapshot of the player's built-ins at this SDK release, which the player may change between SDK releases; a test pins `plugin.appearance`'s list of themes to `THEME_PALETTES`. `PartsExportOptions` says its fields are a snapshot clip's; `ExportPart.source` says it is a token, not a path. `startPlugin` says which capability checks the test host makes (those on the plugin's side) and that `vestra-plugin check` finds the rest.
20
+
21
+ ## 1.7.7
22
+
23
+ **Who must change: nobody; the table follows player #235** (the built-in capture plugin keeps snapshots only; clip export moves to a store plugin). A data refresh of `BUILTIN_COMMANDS`: no API change, `apiVersion` stays `vestra/1`, the API surface snapshot is unchanged. A plugin whose tests compare a key against the table sees the player's current one: Alt+S, Ctrl+Shift+E and Ctrl+Shift+R are no longer held by a built-in.
24
+
25
+ - **Removed rows** (`vestra.capture`): `capture.clip` (Snapshot ▸ Export Clip…), `capture.panel` (Snapshot ▸ Capture…, Alt+S), and the palette-only `capture.clipExport` (Export Clip Range, Ctrl+Shift+E), `capture.tasks` (Export Tasks…), `capture.clipStart` (Set Clip Start), `capture.clipEnd` (Set Clip End), `capture.last30` (Export Last 30 Seconds, Ctrl+Shift+R).
26
+ - **Changed row**: `capture.burst` is Snapshot ▸ Burst (no ellipsis: it runs at once), still Ctrl+G. `capture.settings` (Snapshot Settings…) stays palette-only, as before. `BUILTIN_SUBMENUS` is unchanged (the Snapshot submenu stays, owned by `vestra.capture`). The table in [Reference: commands](docs/reference/commands.md#built-in-commands) follows.
27
+
3
28
  ## 1.7.6
4
29
 
5
30
  **Who must change: plugins that call one of the five removed members — none of the player's built-ins, the plugins repository or the examples does.** `apiVersion` stays `vestra/1`; the API surface snapshot loses the five members.
@@ -129,6 +129,21 @@ export const API_REQUESTS = Object.freeze({
129
129
  { method: "snapshot.capture" },
130
130
  ],
131
131
  "Snapshot.export": [{ method: "jobs.state" }, { method: "jobs.start" }],
132
+ // Parts of remembered files: also media.sources (documented at the
133
+ // members; the player checks it for jobs.start with parts and jobs.check).
134
+ "MediaCapture.export": [{ method: "jobs.state" }, { method: "jobs.start" }],
135
+ "MediaCapture.exportCheck": [{ method: "jobs.check" }],
136
+ "MediaSources.remember": [{ method: "media.sources.remember" }],
137
+ "MediaSources.get": [{ method: "media.sources.get" }],
138
+ "MediaSources.locate": [{ method: "media.sources.locate" }],
139
+ "MediaSources.forget": [{ method: "media.sources.forget" }],
140
+ "MediaSources.list": [{ method: "media.sources.list" }],
141
+ // An open like Player.open: playback.control (the player's rule for
142
+ // media.sources.open), with which source.operation needs it too.
143
+ "MediaSources.open": [
144
+ { method: "media.sources.open" },
145
+ { method: "source.operation" },
146
+ ],
132
147
  "Osd.show": [{ method: "osd.show" }],
133
148
  "Osd.panel": [{ method: "osd.panel" }],
134
149
  "Clipboard.readText": [{ method: "clipboard.readText" }],
@@ -103,34 +103,59 @@ export function requestsNeed(requests, capabilities, rules = RULES) {
103
103
  // An `ifDeclared` rule is decided last, as if the plugin had declared what
104
104
  // the member's other requests need: `Player.seek` needs `playback.control`
105
105
  // for `source.submit`, and with it `source.operation` needs nothing more.
106
- const declared = (name) => capabilities.includes(name) ||
107
- needs.some((need) => need.capability === name);
106
+ // What a rule answers can change what another rule reads, so the needs are
107
+ // worked out again, as if the plugin had declared everything an earlier
108
+ // round needed, until no round adds a capability: `media.sources.open`
109
+ // asks for `playback.control` until it is declared, then for
110
+ // `media.sources` (and `source.operation` follows the first). The set
111
+ // only grows, so the rounds end.
108
112
  const conditional = (request) => {
109
113
  const rule = hostMethod(request.method, rules.host)?.needs;
110
114
  return typeof rule === "object" && rule !== null && "ifDeclared" in rule;
111
115
  };
112
- const needs = [];
113
- const add = (need) => {
114
- if (needs.some((each) => each.capability === need.capability))
115
- return;
116
- needs.push(need);
117
- const entry = rules.host.capabilities.find((capability) => capability.name === need.capability);
118
- for (const required of entry?.requires ?? [])
119
- add({
120
- capability: required,
121
- method: need.method,
122
- requiredBy: need.capability,
123
- });
124
- };
125
- for (const request of [
116
+ const ordered = [
126
117
  ...requests.filter((request) => !conditional(request)),
127
118
  ...requests.filter(conditional),
128
- ]) {
129
- const capability = requestNeeds(request.method, request.params, declared, rules.host);
130
- if (capability)
131
- add({ capability, method: request.method });
119
+ ];
120
+ const round = (previous) => {
121
+ const needs = [];
122
+ const declared = (name) => capabilities.includes(name) ||
123
+ previous.has(name) ||
124
+ needs.some((need) => need.capability === name);
125
+ const add = (need) => {
126
+ if (needs.some((each) => each.capability === need.capability))
127
+ return;
128
+ needs.push(need);
129
+ const entry = rules.host.capabilities.find((capability) => capability.name === need.capability);
130
+ for (const required of entry?.requires ?? [])
131
+ add({
132
+ capability: required,
133
+ method: need.method,
134
+ requiredBy: need.capability,
135
+ });
136
+ };
137
+ for (const request of ordered) {
138
+ const capability = requestNeeds(request.method, request.params, declared, rules.host);
139
+ if (capability)
140
+ add({ capability, method: request.method });
141
+ }
142
+ return needs;
143
+ };
144
+ // Every capability any round needed; the answer is the last round's needs
145
+ // (read with all of them declared) and then any earlier one it left out.
146
+ const all = new Map();
147
+ for (;;) {
148
+ const needs = round(new Set(all.keys()));
149
+ const before = all.size;
150
+ for (const need of needs)
151
+ if (!all.has(need.capability))
152
+ all.set(need.capability, need);
153
+ if (all.size === before)
154
+ return [
155
+ ...needs,
156
+ ...[...all.values()].filter((need) => !needs.some((each) => each.capability === need.capability)),
157
+ ];
132
158
  }
133
- return needs;
134
159
  }
135
160
  /**
136
161
  * `CAPABILITY_INFO` from the tables: the label, highlight and requirements
@@ -198,8 +198,12 @@ export interface BuiltinSubmenu {
198
198
  * with the same keys appears in the same submenu, whatever the interface
199
199
  * language; the submenu's title is the declaring plugin's translation. The
200
200
  * player's own submenus (`Playback ▸ Speed`, `Playback ▸ Seek`) are not
201
- * listed. The player's tests check that this list agrees with what its
202
- * built-in plugins declare.
201
+ * listed.
202
+ *
203
+ * A snapshot of the player's built-in submenus at this SDK release; the
204
+ * player may differ between SDK releases. The player's tests check that
205
+ * this list agrees with what its built-in plugins declare when the SDK is
206
+ * released.
203
207
  *
204
208
  * @example Add an item to the built-in Snapshot submenu
205
209
  * "Copy Snapshot" appears in Snapshot ▸ next to the built-in capture
@@ -264,8 +268,12 @@ export interface BuiltinCommand {
264
268
  * placeholders (`No Audio Tracks`) are. Items that appear only in a
265
269
  * passing state are not listed either: the Picture Adjustments plugin's
266
270
  * `Video ▸ Restart Player to Apply` (`video.gpu-rendering.restart`), shown
267
- * while a rendering choice waits for the next start. The player's tests check that this
268
- * list agrees with what the player and its built-in plugins register.
271
+ * while a rendering choice waits for the next start.
272
+ *
273
+ * A snapshot of the player's built-in commands at this SDK release; the
274
+ * player may differ between SDK releases. The player's tests check that
275
+ * this list agrees with what the player and its built-in plugins register
276
+ * when the SDK is released, not with the player a user runs later.
269
277
  *
270
278
  * @example Check in a test that a default key is still free
271
279
  * The test fails if the player or a built-in plugin already binds Ctrl+K
package/dist/commands.js CHANGED
@@ -224,8 +224,12 @@ export const BAR_BUTTON_LIMITS = {
224
224
  * with the same keys appears in the same submenu, whatever the interface
225
225
  * language; the submenu's title is the declaring plugin's translation. The
226
226
  * player's own submenus (`Playback ▸ Speed`, `Playback ▸ Seek`) are not
227
- * listed. The player's tests check that this list agrees with what its
228
- * built-in plugins declare.
227
+ * listed.
228
+ *
229
+ * A snapshot of the player's built-in submenus at this SDK release; the
230
+ * player may differ between SDK releases. The player's tests check that
231
+ * this list agrees with what its built-in plugins declare when the SDK is
232
+ * released.
229
233
  *
230
234
  * @example Add an item to the built-in Snapshot submenu
231
235
  * "Copy Snapshot" appears in Snapshot ▸ next to the built-in capture
@@ -278,9 +282,7 @@ vestra.audio | audio.track.none | Audio Track ▸ No Audio Tracks
278
282
  vestra.subtitles | track-off | Subtitle Track ▸ Off
279
283
  vestra.capture | capture.save | Snapshot ▸ Save Current Frame | Ctrl+E
280
284
  vestra.capture | capture.copy | Snapshot ▸ Copy Current Frame | Ctrl+C
281
- vestra.capture | capture.burst | Snapshot ▸ Burst… | Ctrl+G
282
- vestra.capture | capture.clip | Snapshot ▸ Export Clip…
283
- vestra.capture | capture.panel | Snapshot ▸ Capture… | Alt+S
285
+ vestra.capture | capture.burst | Snapshot ▸ Burst | Ctrl+G
284
286
  host | adjust | Adjustments and Effects
285
287
  host | sidebar | Sidebar
286
288
  vestra.marks | marks.list | Chapter and Bookmark List… | H
@@ -423,14 +425,12 @@ vestra.audio | audio.sync.keep.always | (Always Keep)
423
425
  vestra.audio | audio.normalize | (Normalize) | Shift+N
424
426
  vestra.audio | audio.clarity | (Crystalizer) | Shift+C
425
427
  vestra.audio | audio.reset | (Reset)
426
- vestra.capture | capture.clipExport | (Export Clip Range) | Ctrl+Shift+E
427
428
  vestra.capture | capture.saveAs | (Save Current Frame As…)
428
429
  vestra.capture | capture.saveScreen | (Save Rendered Frame) | Ctrl+Alt+E
429
430
  vestra.capture | capture.saveScreenAs | (Save Rendered Frame As…)
430
431
  vestra.capture | capture.copyScreen | (Copy Rendered Frame) | Ctrl+Alt+C
431
432
  vestra.capture | capture.saveVideo | (Save Video Frame Only)
432
433
  vestra.capture | capture.copyVideo | (Copy Video Frame Only)
433
- vestra.capture | capture.tasks | (Export Tasks…)
434
434
  vestra.capture | capture.format.png | (Capture as PNG)
435
435
  vestra.capture | capture.format.jpeg | (Capture as JPEG)
436
436
  vestra.capture | capture.format.bmp | (Capture as BMP)
@@ -440,9 +440,6 @@ vestra.capture | capture.folder | (Snapshot Folder…)
440
440
  vestra.capture | capture.openFolder | (Open Snapshot Folder)
441
441
  vestra.capture | capture.revealLast | (Show Last Capture in Folder)
442
442
  vestra.capture | capture.copyLast | (Copy Last Snapshot)
443
- vestra.capture | capture.clipStart | (Set Clip Start)
444
- vestra.capture | capture.clipEnd | (Set Clip End)
445
- vestra.capture | capture.last30 | (Export Last 30 Seconds) | Ctrl+Shift+R
446
443
  vestra.info | info.brief | (Brief Info) | Shift+Tab
447
444
  vestra.playback | keyframe-back | (Previous Keyframe) | Ctrl+Shift+ArrowLeft
448
445
  vestra.playback | keyframe-forward | (Next Keyframe) | Ctrl+Shift+ArrowRight
@@ -610,8 +607,12 @@ vestra.video | video.upscaling | (AI Upscaling)
610
607
  * placeholders (`No Audio Tracks`) are. Items that appear only in a
611
608
  * passing state are not listed either: the Picture Adjustments plugin's
612
609
  * `Video ▸ Restart Player to Apply` (`video.gpu-rendering.restart`), shown
613
- * while a rendering choice waits for the next start. The player's tests check that this
614
- * list agrees with what the player and its built-in plugins register.
610
+ * while a rendering choice waits for the next start.
611
+ *
612
+ * A snapshot of the player's built-in commands at this SDK release; the
613
+ * player may differ between SDK releases. The player's tests check that
614
+ * this list agrees with what the player and its built-in plugins register
615
+ * when the SDK is released, not with the player a user runs later.
615
616
  *
616
617
  * @example Check in a test that a default key is still free
617
618
  * The test fails if the player or a built-in plugin already binds Ctrl+K
Binary file
@@ -250,6 +250,24 @@ export const HOST_CAPABILITIES = {
250
250
  residency: "live",
251
251
  risky: false,
252
252
  },
253
+ {
254
+ label: "Remember videos you add and export from them later",
255
+ methods: [
256
+ {
257
+ name: "media.sources.open",
258
+ needs: {
259
+ ifDeclared: "playback.control",
260
+ otherwise: "playback.control",
261
+ then: "media.sources",
262
+ },
263
+ },
264
+ { name: "media.sources.*", needs: "media.sources" },
265
+ ],
266
+ name: "media.sources",
267
+ requires: [],
268
+ residency: "none",
269
+ risky: false,
270
+ },
253
271
  {
254
272
  label: "Show messages on the video",
255
273
  methods: [
package/dist/media.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /** Finite media jobs. Native-subtitle freezing remains pending. */
2
2
  import type { Transport } from "./wire.ts";
3
- import type { SourceStamp, SourceAudioTrack } from "./source.ts";
3
+ import type { SourceStamp, SourceAudioTrack, SourceOperation } from "./source.ts";
4
4
  import type { VideoNode, AudioNode } from "./processing.ts";
5
5
  import type { SubtitleStamp, SubtitleStyle, SubtitleTrack } from "./subtitles.ts";
6
6
  export type RawSnapshot = {
@@ -174,6 +174,22 @@ export type MediaJob = {
174
174
  end: number;
175
175
  };
176
176
  };
177
+ /** An export of parts (`jobs.start { parts }`): how it was written. */
178
+ join?: {
179
+ mode: "copy" | "mp4";
180
+ container: "mp4" | "mkv";
181
+ /** Each part as written, in seconds of its own file. */
182
+ parts: {
183
+ start: number;
184
+ end: number;
185
+ }[];
186
+ /** A re-encode: the output size and frame rate. */
187
+ target: {
188
+ width: number;
189
+ height: number;
190
+ fps: number;
191
+ } | null;
192
+ };
177
193
  };
178
194
  outcome: null | {
179
195
  destination: string;
@@ -196,6 +212,10 @@ export type MediaJob = {
196
212
  progress?: {
197
213
  done: number;
198
214
  total: number;
215
+ /** An export of parts: the part being written, from 1. */
216
+ part?: number;
217
+ /** An export of parts: how many parts. */
218
+ parts?: number;
199
219
  } | null;
200
220
  };
201
221
  /** The wire form of `ExportEncoding` (`jobs.start`). */
@@ -208,6 +228,62 @@ export type WireEncoding = {
208
228
  threads?: "single" | "auto";
209
229
  videoBitrate?: "source";
210
230
  };
231
+ /** A source reference as the player describes it (`media.sources.*`). */
232
+ export type WireSourceReference = {
233
+ token: string;
234
+ name: string;
235
+ duration: number;
236
+ status: "ok" | "missing" | "changed";
237
+ video: {
238
+ codec: string;
239
+ width: number;
240
+ height: number;
241
+ fps: number;
242
+ pixelFormat: string | null;
243
+ } | null;
244
+ audio: {
245
+ codec: string;
246
+ sampleRate: number;
247
+ channels: number;
248
+ } | null;
249
+ };
250
+ /** One part of an export (`jobs.start { parts }`, `jobs.check`). */
251
+ export type WireExportPart = {
252
+ source: string;
253
+ start: number;
254
+ end: number;
255
+ };
256
+ /** The answer of `jobs.check`. */
257
+ export type WireExportCheck = {
258
+ blocking: {
259
+ part: number;
260
+ problem: "unknown" | "missing" | "changed" | "noVideo" | "range";
261
+ /** `range`: the file's duration. */
262
+ duration?: number;
263
+ }[];
264
+ copy: {
265
+ ok: true;
266
+ container: "mp4" | "mkv";
267
+ } | {
268
+ ok: false;
269
+ reasons: {
270
+ part: number;
271
+ field: "videoCodec" | "videoParams" | "size" | "fps" | "pixelFormat" | "audio" | "effects";
272
+ value: string | number | null;
273
+ expected: string | number | null;
274
+ }[];
275
+ };
276
+ encode: {
277
+ width: number;
278
+ height: number;
279
+ fps: number;
280
+ audio: {
281
+ sampleRate: 48000;
282
+ channels: 2;
283
+ } | null;
284
+ } | null;
285
+ duration: number;
286
+ };
211
287
  export type MediaOperation = {
212
288
  status: "pending" | "unknown" | "unknownExpired";
213
289
  } | {
@@ -264,5 +340,36 @@ export declare function mediaClients(transport: Transport): {
264
340
  cancel: "requested" | "tooLate" | "terminal";
265
341
  }>;
266
342
  operation: (operationId: number) => Promise<MediaOperation>;
343
+ /** `jobs.start` with parts of remembered files instead of a snapshot. */
344
+ startParts: (options: {
345
+ operationId: number;
346
+ parts: WireExportPart[];
347
+ destination: string;
348
+ } & ({
349
+ kind: "rawCopy";
350
+ container?: "auto" | "mp4" | "mkv";
351
+ } | {
352
+ kind: "rawMp4";
353
+ encoding?: WireEncoding;
354
+ })) => Promise<{
355
+ jobId: number;
356
+ status: "queued";
357
+ }>;
358
+ check: (parts: WireExportPart[], encoding?: WireEncoding) => Promise<WireExportCheck>;
359
+ /** `jobs.check` of a snapshot's clip (to `end`) instead of parts. */
360
+ checkSnapshot: (snapshotId: number, end: number, encoding?: WireEncoding) => Promise<WireExportCheck>;
361
+ };
362
+ mediaSources: {
363
+ remember: (expected?: SourceStamp) => Promise<WireSourceReference>;
364
+ get: (token: string) => Promise<WireSourceReference>;
365
+ locate: (token: string) => Promise<WireSourceReference | null>;
366
+ forget: (token: string) => Promise<void>;
367
+ list: () => Promise<WireSourceReference[]>;
368
+ /** An `open` submit of the file, under the player service's operation id. */
369
+ open: (options: {
370
+ token: string;
371
+ operationId: number;
372
+ start?: number;
373
+ }) => Promise<SourceOperation>;
267
374
  };
268
375
  };
package/dist/media.js CHANGED
@@ -16,6 +16,26 @@ export function mediaClients(transport) {
16
16
  state: (jobId) => transport.request("jobs.state", { jobId }),
17
17
  cancel: (jobId, operationId) => transport.request("jobs.cancel", { jobId, operationId }),
18
18
  operation: (operationId) => transport.request("jobs.operation", { operationId }),
19
+ /** `jobs.start` with parts of remembered files instead of a snapshot. */
20
+ startParts: (options) => transport.request("jobs.start", options),
21
+ check: (parts, encoding) => transport.request("jobs.check", encoding === undefined ? { parts } : { parts, encoding }),
22
+ /** `jobs.check` of a snapshot's clip (to `end`) instead of parts. */
23
+ checkSnapshot: (snapshotId, end, encoding) => transport.request("jobs.check", encoding === undefined
24
+ ? { snapshotId, end }
25
+ : { snapshotId, end, encoding }),
26
+ },
27
+ mediaSources: {
28
+ remember: (expected) => transport.request("media.sources.remember", expected === undefined ? {} : { expected }),
29
+ get: (token) => transport.request("media.sources.get", {
30
+ token,
31
+ }),
32
+ locate: (token) => transport.request("media.sources.locate", {
33
+ token,
34
+ }),
35
+ forget: (token) => transport.request("media.sources.forget", { token }),
36
+ list: () => transport.request("media.sources.list", {}),
37
+ /** An `open` submit of the file, under the player service's operation id. */
38
+ open: (options) => transport.request("media.sources.open", options),
19
39
  },
20
40
  };
21
41
  }
@@ -15,6 +15,7 @@ export { API_VERSION, CAPABILITIES, CAPABILITY_INFO, MESSAGE_LIMIT, } from "./ca
15
15
  export { HOST_CAPABILITIES } from "./host-capabilities.ts";
16
16
  export { BAR_BUTTON_ICONS, BAR_BUTTON_LIMITS, BUILTIN_COMMANDS, BUILTIN_SUBMENUS, COMMAND_LIMITS, MENU_IDS, } from "./commands.ts";
17
17
  export { BINDING_INPUTS } from "./plugin/bindings.ts";
18
+ export { MEDIA_SOURCE_LIMITS } from "./plugin/media.ts";
18
19
  export { OSD_LIMITS } from "./plugin/osd.ts";
19
20
  export { TIMELINE_LIMITS } from "./plugin/timeline.ts";
20
21
  export { SECRET_LIMITS, SESSION_STORAGE_LIMITS } from "./plugin/services.ts";
@@ -13,6 +13,7 @@ export { API_VERSION, CAPABILITIES, CAPABILITY_INFO, MESSAGE_LIMIT, } from "./ca
13
13
  export { HOST_CAPABILITIES } from "./host-capabilities.js";
14
14
  export { BAR_BUTTON_ICONS, BAR_BUTTON_LIMITS, BUILTIN_COMMANDS, BUILTIN_SUBMENUS, COMMAND_LIMITS, MENU_IDS, } from "./commands.js";
15
15
  export { BINDING_INPUTS } from "./plugin/bindings.js";
16
+ export { MEDIA_SOURCE_LIMITS } from "./plugin/media.js";
16
17
  export { OSD_LIMITS } from "./plugin/osd.js";
17
18
  export { TIMELINE_LIMITS } from "./plugin/timeline.js";
18
19
  export { SECRET_LIMITS, SESSION_STORAGE_LIMITS } from "./plugin/services.js";
@@ -1,3 +1,29 @@
1
1
  import type { ScopeImpl } from "./scope.ts";
2
2
  import type { MediaCapture } from "./types.ts";
3
3
  export declare function mediaCapture(scope: ScopeImpl): MediaCapture;
4
+ /**
5
+ * The player's bounds of remembered files and exports of their parts,
6
+ * documented in the limits reference. Exported from `./runtime` only, for
7
+ * the player's agreement test; TestHost and the SDK's own checks read
8
+ * these figures. The bound on references is a resource limit; tokens are
9
+ * an API convenience, not a security boundary.
10
+ *
11
+ * @internal
12
+ */
13
+ export declare const MEDIA_SOURCE_LIMITS: Readonly<{
14
+ /** References one plugin may hold; one more fails with `limit` (500). */
15
+ readonly references: 500;
16
+ /** Parts of one export or check, at least 1; more fail with `invalid` (100). */
17
+ readonly parts: 100;
18
+ /** Seconds of a part's end in its file (24 hours). */
19
+ readonly partEnd: 86400;
20
+ /** Seconds of all parts of one export together, as one clip (24 hours). */
21
+ readonly totalSeconds: 86400;
22
+ /**
23
+ * `remember`, `get`, `list` and checks one plugin may have the
24
+ * player working on at the same time; one more fails with `busy` (4).
25
+ */
26
+ readonly requests: 4;
27
+ /** Seconds between two `locate` dialogs of one plugin; sooner fails with `busy` (2). */
28
+ readonly locateInterval: 2;
29
+ }>;