@vestra-player/sdk 1.7.3 → 1.7.5
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 +15 -0
- package/dist/commands.js +1 -0
- package/dist/docs-tree.json.gz +0 -0
- package/dist/plugin/testing/core-actions.d.ts +7 -0
- package/dist/plugin/testing/core-actions.js +66 -8
- package/dist/plugin/testing/index.d.ts +17 -2
- package/dist/plugin/testing/index.js +17 -2
- package/dist/plugin/testing/internals.d.ts +10 -0
- package/dist/plugin/testing/internals.js +10 -0
- package/dist/plugin/testing/media.d.ts +7 -1
- package/dist/plugin/testing/media.js +46 -3
- package/dist/plugin/testing/transport.js +3 -2
- package/dist/plugin/types/commands.d.ts +1 -1
- package/dist/plugin/types/playback.d.ts +4 -2
- package/llms.txt +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.7.5
|
|
4
|
+
|
|
5
|
+
**Who must change: nobody.** The test host follows two player changes (seeking after the end, the playlist's Stop After Current) and reports a temporary directory it could not remove; no API change, `apiVersion` stays `vestra/1`, the API surface snapshot is unchanged.
|
|
6
|
+
|
|
7
|
+
- **`TestHost`: seeking after the end**, as the player now does: the core step seeks (`seek-backward` / `seek-forward`, ← / →, `host.run` with `seconds`) are enabled at `phase: "ended"` as well as `ready`, and there they seek exactly (keyframe step mode applies only at `ready`). Any seek from the end (a core step, `player.seek`, `Scrub.seek`) returns to `phase: "ready"` (`terminalReason: null`) in a new `cycle`, as the player's session does, so an end reached again is a new end (`Media.onEnd` fires again), and plays on (`paused: false`); it stays paused when the end was reached while paused or by a frame step. Previous Frame (`frame-back`, `player.step("frame", "backward")`) after the end now moves as in the player: an exact seek one frame (`stats.video.fps`, else 30) before the position, back to `ready`, paused. A seek from the end to the end or past it (target ≥ the smaller of `position` and `duration`, less 0.5 ms; → at the end, a seek to the duration) goes nowhere: it succeeds, and the source stays `ended`, in the same cycle, and paused (`paused: true`, as keep-open holds the end). `player.step("keyframe", …)` works after the end: backward is a seek to the last `keyframes` entry before the position (none modelled: 1 ms back) that stays paused and returns to `ready`; forward goes nowhere. The pause that decides is the requested one (Play pressed just before the end: a seek from it plays on). Play/Pause at the end still restarts from 0 and plays. Tests: `test/core-actions.test.ts`.
|
|
8
|
+
- **`BUILTIN_COMMANDS`**: the row `vestra.playlist/playlist.repeat-once` (**Stop After Current**, outside the menu, no default key) follows the player's new Repeat mode of that name (the player 0.7.6 build with the playlist's repeat button). The playlist's four move commands stay commands with their keys (Move Up `Ctrl+ArrowUp`, Move Down `Ctrl+ArrowDown`, Move to Bottom `Ctrl+End`, panel focus; Move to Top none); their rows are unchanged. `BUILTIN_SUBMENUS` is unchanged. The table in [Reference: commands](docs/reference/commands.md#built-in-commands) follows.
|
|
9
|
+
- **`TestHost.close` says what it left**: a temporary directory that Windows still refuses to remove after the retries (`ENOTEMPTY`, `EBUSY`, `EPERM`; a file handle still closing) is reported on the console (`# TestHost: left <dir> (<code>)`) instead of being dropped silently; `close()` and `stop()` still never throw for it. The retries (`maxRetries: 5`, 100 ms) date from 1.5.54: an `ENOTEMPTY` at `rmSync` in `stop()` comes from an older SDK (the plugins repository runs 1.5.48). Tests: `test/testhost-close.test.ts` (a failing removal; on Windows a file another process holds open).
|
|
10
|
+
- Doc comments: `Player.seek`, `setStepSeek` and the `HostAction` table say what a seek after the end does.
|
|
11
|
+
|
|
12
|
+
## 1.7.4
|
|
13
|
+
|
|
14
|
+
**Who must change: nobody.** A documentation release: no API change, `apiVersion` stays `vestra/1`, the API surface snapshot is unchanged.
|
|
15
|
+
|
|
16
|
+
- **One general guide restored**: [How a plugin works](docs/guides/how-plugins-work.md) puts on one page the rules the 1.7.2 cut lost: values between TypeScript and Slint, `set` versus `bind`, the window life cycle, commands, what keeps a plugin running, processing layers, and failures. It is listed in the Guides and the Tutorial, and `vestra-plugin docs` finds it under plugins, ui, commands, processing and playback.
|
|
17
|
+
|
|
3
18
|
## 1.7.3
|
|
4
19
|
|
|
5
20
|
**Who must change: plugins whose tests wrote a value of the wrong type — their test now fails the way the player already failed.** No API change, `apiVersion` stays `vestra/1`, the API surface snapshot is unchanged.
|
package/dist/commands.js
CHANGED
|
@@ -361,6 +361,7 @@ vestra.playlist | playlist.add-folder | (Add Folder…)
|
|
|
361
361
|
vestra.playlist | playlist.repeat-none | (Off)
|
|
362
362
|
vestra.playlist | playlist.repeat-all | (All)
|
|
363
363
|
vestra.playlist | playlist.repeat-one | (One)
|
|
364
|
+
vestra.playlist | playlist.repeat-once | (Stop After Current)
|
|
364
365
|
vestra.playlist | playlist.shuffle | (Shuffle)
|
|
365
366
|
vestra.playlist | playlist.open-list | (Open List File…)
|
|
366
367
|
vestra.playlist | playlist.save-list | (Save List…)
|
package/dist/docs-tree.json.gz
CHANGED
|
Binary file
|
|
@@ -10,6 +10,13 @@ export declare function coreFacts(host: TestHost, _inner: Internals): {
|
|
|
10
10
|
};
|
|
11
11
|
/** Why one frame that way is impossible (B07), or null; the player's rules. */
|
|
12
12
|
export declare function frameCheck(host: TestHost, inner: Internals, forward: boolean): string | null;
|
|
13
|
+
/**
|
|
14
|
+
* One frame step that `frameCheck` allowed, as the player runs it: recorded
|
|
15
|
+
* in `steps`; back from the end an exact seek one frame (`stats` fps, else
|
|
16
|
+
* 30) before the position that stays paused; on the first frame nothing
|
|
17
|
+
* moves; any other step marks an end it reaches as keeping the pause.
|
|
18
|
+
*/
|
|
19
|
+
export declare function frameStep(host: TestHost, inner: Internals, forward: boolean): void;
|
|
13
20
|
/** The same enabled rules and reasons as the player's core actions. */
|
|
14
21
|
export declare function coreState(host: TestHost, inner: Internals, action: string): {
|
|
15
22
|
enabled: boolean;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { HostError } from "../../wire.js";
|
|
10
10
|
import { validStep } from "../player/rules.js";
|
|
11
11
|
import { hostText } from "./i18n.js";
|
|
12
|
-
import { sourceIntent, audioCondition } from "./media.js";
|
|
12
|
+
import { atEndAlready, sourceIntent, audioCondition } from "./media.js";
|
|
13
13
|
export function coreFacts(host, _inner) {
|
|
14
14
|
const s = host.source;
|
|
15
15
|
const ready = s.phase === "ready";
|
|
@@ -18,7 +18,9 @@ export function coreFacts(host, _inner) {
|
|
|
18
18
|
ready,
|
|
19
19
|
ended,
|
|
20
20
|
toggle: (s.capabilities.pause && ready) || (ended && s.capabilities.restart),
|
|
21
|
-
|
|
21
|
+
// After the end too: the seek leaves the end and plays on (player
|
|
22
|
+
// 2026-11-09).
|
|
23
|
+
step: s.capabilities.seek && (ready || ended) && s.position !== null,
|
|
22
24
|
rate: s.capabilities.rate && ready,
|
|
23
25
|
close: s.capabilities.close && s.phase !== "empty",
|
|
24
26
|
};
|
|
@@ -40,6 +42,35 @@ export function frameCheck(host, inner, forward) {
|
|
|
40
42
|
return noBack;
|
|
41
43
|
return null;
|
|
42
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* One frame step that `frameCheck` allowed, as the player runs it: recorded
|
|
47
|
+
* in `steps`; back from the end an exact seek one frame (`stats` fps, else
|
|
48
|
+
* 30) before the position that stays paused; on the first frame nothing
|
|
49
|
+
* moves; any other step marks an end it reaches as keeping the pause.
|
|
50
|
+
*/
|
|
51
|
+
export function frameStep(host, inner, forward) {
|
|
52
|
+
host.steps.push({
|
|
53
|
+
unit: "frame",
|
|
54
|
+
direction: forward ? "forward" : "backward",
|
|
55
|
+
});
|
|
56
|
+
const s = host.source;
|
|
57
|
+
if (!forward && s.position !== null && s.position <= 0.001)
|
|
58
|
+
return;
|
|
59
|
+
if (!forward && s.phase === "ended") {
|
|
60
|
+
const fps = host.stats.video?.fps;
|
|
61
|
+
const frame = 1 / (fps && Number.isFinite(fps) && fps > 0 ? fps : 30);
|
|
62
|
+
inner.holdPause = true;
|
|
63
|
+
sourceIntent(host, inner, {
|
|
64
|
+
kind: "control",
|
|
65
|
+
control: {
|
|
66
|
+
kind: "seek",
|
|
67
|
+
seconds: Math.max(0, (s.position ?? 0) - frame),
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
inner.stepped = true;
|
|
73
|
+
}
|
|
43
74
|
/** The same enabled rules and reasons as the player's core actions. */
|
|
44
75
|
export function coreState(host, inner, action) {
|
|
45
76
|
const f = coreFacts(host, inner);
|
|
@@ -217,10 +248,7 @@ export function runCore(host, inner, action, seconds) {
|
|
|
217
248
|
return;
|
|
218
249
|
case "frame-back":
|
|
219
250
|
case "frame-forward":
|
|
220
|
-
host
|
|
221
|
-
unit: "frame",
|
|
222
|
-
direction: action === "frame-back" ? "backward" : "forward",
|
|
223
|
-
});
|
|
251
|
+
frameStep(host, inner, action === "frame-forward");
|
|
224
252
|
return;
|
|
225
253
|
case "seek-backward":
|
|
226
254
|
case "seek-forward": {
|
|
@@ -232,6 +260,7 @@ export function runCore(host, inner, action, seconds) {
|
|
|
232
260
|
// after the target (none: the exact target), backward on the last at
|
|
233
261
|
// or before it; only sources with moving video that can seek.
|
|
234
262
|
const keyframes = host.stepSeekKeyframes &&
|
|
263
|
+
s.phase === "ready" && // after the end: an exact seek
|
|
235
264
|
host.keyframes !== null &&
|
|
236
265
|
s.hasVideo !== false &&
|
|
237
266
|
s.capabilities.seek;
|
|
@@ -318,13 +347,42 @@ export function coreActionsHandlers(host, inner) {
|
|
|
318
347
|
audioCondition(host, inner, p.expected);
|
|
319
348
|
const s = host.source;
|
|
320
349
|
const reason = p.unit === "keyframe"
|
|
321
|
-
? s.phase === "ready"
|
|
350
|
+
? (s.phase === "ready" || s.phase === "ended") &&
|
|
351
|
+
s.capabilities.seek &&
|
|
352
|
+
s.hasVideo !== false
|
|
322
353
|
? null
|
|
323
354
|
: hostText(host, inner, "Not supported by the current source")
|
|
324
355
|
: frameCheck(host, inner, p.direction === "forward");
|
|
325
356
|
if (reason)
|
|
326
357
|
throw new HostError("unsupported", reason);
|
|
327
|
-
|
|
358
|
+
if (p.unit === "frame")
|
|
359
|
+
frameStep(host, inner, p.direction === "forward");
|
|
360
|
+
else {
|
|
361
|
+
host.steps.push({
|
|
362
|
+
unit: String(p.unit),
|
|
363
|
+
direction: String(p.direction),
|
|
364
|
+
});
|
|
365
|
+
// Like the player after the end: Previous Keyframe is a source seek
|
|
366
|
+
// to the last keyframe before the position (1 ms back; the exact
|
|
367
|
+
// target when no keyframes are modelled) that stays paused; Next
|
|
368
|
+
// Keyframe goes nowhere (the plugin says so).
|
|
369
|
+
const target = Math.max(0, (s.position ?? 0) - 0.001);
|
|
370
|
+
// "Already at the end" is decided on the raw target, as the player.
|
|
371
|
+
if (s.phase === "ended" &&
|
|
372
|
+
p.direction === "backward" &&
|
|
373
|
+
!atEndAlready(host, target)) {
|
|
374
|
+
const landed = host.keyframes === null
|
|
375
|
+
? target
|
|
376
|
+
: host.keyframes
|
|
377
|
+
.filter((k) => k <= target)
|
|
378
|
+
.reduce((a, k) => Math.max(a, k), 0);
|
|
379
|
+
inner.holdPause = true;
|
|
380
|
+
sourceIntent(host, inner, {
|
|
381
|
+
kind: "control",
|
|
382
|
+
control: { kind: "seek", seconds: landed, keyframes: true },
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
}
|
|
328
386
|
},
|
|
329
387
|
"sequence.set": (p) => {
|
|
330
388
|
host.sequence = p.flags;
|
|
@@ -2213,7 +2213,14 @@ export declare class TestHost implements Transport {
|
|
|
2213
2213
|
/** `Scrub.seek(seconds, { keyframes: true })`. */
|
|
2214
2214
|
keyframes: boolean;
|
|
2215
2215
|
}[];
|
|
2216
|
-
/**
|
|
2216
|
+
/**
|
|
2217
|
+
* Every `player.step` and core frame step, newest last. The position does
|
|
2218
|
+
* not move, except a step back after the end: like the player, a seek
|
|
2219
|
+
* that stays paused, one frame back (`stats` fps, else 30) for a frame,
|
|
2220
|
+
* to the last {@link TestHost.keyframes | keyframe} before the position
|
|
2221
|
+
* (none modelled: 1 ms back) for a keyframe. A keyframe step forward
|
|
2222
|
+
* after the end goes nowhere.
|
|
2223
|
+
*/
|
|
2217
2224
|
readonly steps: {
|
|
2218
2225
|
/** `"frame"` or `"keyframe"`. */
|
|
2219
2226
|
unit: string;
|
|
@@ -2349,6 +2356,11 @@ export declare class TestHost implements Transport {
|
|
|
2349
2356
|
* changed (the user paused, playback reached the end, a file finished
|
|
2350
2357
|
* loading). Any phase other than `empty` also turns on the source
|
|
2351
2358
|
* capabilities (pause, seek, rate, ...) unless the patch sets them.
|
|
2359
|
+
* After `phase: "ended"`, a seek (a plugin's, a core step seek) returns
|
|
2360
|
+
* to `ready` and plays on (`paused: false`), as in the player; it stays
|
|
2361
|
+
* paused when the end was reached while paused or by a frame step. A
|
|
2362
|
+
* seek at or past the end (the smaller of `position` and `duration`,
|
|
2363
|
+
* 0.5 ms slack) goes nowhere: accepted, still ended and paused.
|
|
2352
2364
|
* `phase: "loading"` makes a mounted backdrop effective, like the player.
|
|
2353
2365
|
*
|
|
2354
2366
|
* @param patch - Wire-level source fields, e.g. `phase`, `position`,
|
|
@@ -2932,7 +2944,10 @@ export declare class TestHost implements Transport {
|
|
|
2932
2944
|
settle(ms?: number): Promise<void>;
|
|
2933
2945
|
/**
|
|
2934
2946
|
* Close the fake stream servers and delete the host's temporary
|
|
2935
|
-
* directories. `stop()` from {@link startPlugin} calls it.
|
|
2947
|
+
* directories. `stop()` from {@link startPlugin} calls it. It never
|
|
2948
|
+
* throws: a directory that a closing file handle still holds (Windows:
|
|
2949
|
+
* `ENOTEMPTY`, `EBUSY`, `EPERM`) is retried for about 1.5 s, then left
|
|
2950
|
+
* for the system to clean, with a warning on the console.
|
|
2936
2951
|
*
|
|
2937
2952
|
* @capability None.
|
|
2938
2953
|
*
|
|
@@ -1767,7 +1767,14 @@ export class TestHost {
|
|
|
1767
1767
|
* keyframe at or before it); the core's step seeks are in `coreSeeks`.
|
|
1768
1768
|
*/
|
|
1769
1769
|
seeks = [];
|
|
1770
|
-
/**
|
|
1770
|
+
/**
|
|
1771
|
+
* Every `player.step` and core frame step, newest last. The position does
|
|
1772
|
+
* not move, except a step back after the end: like the player, a seek
|
|
1773
|
+
* that stays paused, one frame back (`stats` fps, else 30) for a frame,
|
|
1774
|
+
* to the last {@link TestHost.keyframes | keyframe} before the position
|
|
1775
|
+
* (none modelled: 1 ms back) for a keyframe. A keyframe step forward
|
|
1776
|
+
* after the end goes nowhere.
|
|
1777
|
+
*/
|
|
1771
1778
|
steps = [];
|
|
1772
1779
|
/** Every core action run (`host.run`, a core command, a pressed core binding), newest last. */
|
|
1773
1780
|
coreRuns = [];
|
|
@@ -1941,6 +1948,11 @@ export class TestHost {
|
|
|
1941
1948
|
* changed (the user paused, playback reached the end, a file finished
|
|
1942
1949
|
* loading). Any phase other than `empty` also turns on the source
|
|
1943
1950
|
* capabilities (pause, seek, rate, ...) unless the patch sets them.
|
|
1951
|
+
* After `phase: "ended"`, a seek (a plugin's, a core step seek) returns
|
|
1952
|
+
* to `ready` and plays on (`paused: false`), as in the player; it stays
|
|
1953
|
+
* paused when the end was reached while paused or by a frame step. A
|
|
1954
|
+
* seek at or past the end (the smaller of `position` and `duration`,
|
|
1955
|
+
* 0.5 ms slack) goes nowhere: accepted, still ended and paused.
|
|
1944
1956
|
* `phase: "loading"` makes a mounted backdrop effective, like the player.
|
|
1945
1957
|
*
|
|
1946
1958
|
* @param patch - Wire-level source fields, e.g. `phase`, `position`,
|
|
@@ -2544,7 +2556,10 @@ export class TestHost {
|
|
|
2544
2556
|
}
|
|
2545
2557
|
/**
|
|
2546
2558
|
* Close the fake stream servers and delete the host's temporary
|
|
2547
|
-
* directories. `stop()` from {@link startPlugin} calls it.
|
|
2559
|
+
* directories. `stop()` from {@link startPlugin} calls it. It never
|
|
2560
|
+
* throws: a directory that a closing file handle still holds (Windows:
|
|
2561
|
+
* `ENOTEMPTY`, `EBUSY`, `EPERM`) is retried for about 1.5 s, then left
|
|
2562
|
+
* for the system to clean, with a warning on the console.
|
|
2548
2563
|
*
|
|
2549
2564
|
* @capability None.
|
|
2550
2565
|
*
|
|
@@ -71,6 +71,16 @@ export declare class Internals {
|
|
|
71
71
|
keysSent: string;
|
|
72
72
|
/** The binding table revision of `commands.keys` (a counter here). */
|
|
73
73
|
keysRevision: number;
|
|
74
|
+
/**
|
|
75
|
+
* Like the player (2026-11-09): a seek from the end plays on unless the
|
|
76
|
+
* end was reached while paused or by a frame step (set when the phase
|
|
77
|
+
* becomes `ended`).
|
|
78
|
+
*/
|
|
79
|
+
endKeepsPause: boolean;
|
|
80
|
+
/** A frame step since the last source intent (the player's `stepped`). */
|
|
81
|
+
stepped: boolean;
|
|
82
|
+
/** The next source intent is a frame step back from the end: it stays paused. */
|
|
83
|
+
holdPause: boolean;
|
|
74
84
|
/**
|
|
75
85
|
* The resources this plugin loaded into the current source (resource id →
|
|
76
86
|
* bytes), removed ones included: like the player, a removed track frees
|
|
@@ -58,6 +58,16 @@ export class Internals {
|
|
|
58
58
|
keysSent = "";
|
|
59
59
|
/** The binding table revision of `commands.keys` (a counter here). */
|
|
60
60
|
keysRevision = 0;
|
|
61
|
+
/**
|
|
62
|
+
* Like the player (2026-11-09): a seek from the end plays on unless the
|
|
63
|
+
* end was reached while paused or by a frame step (set when the phase
|
|
64
|
+
* becomes `ended`).
|
|
65
|
+
*/
|
|
66
|
+
endKeepsPause = false;
|
|
67
|
+
/** A frame step since the last source intent (the player's `stepped`). */
|
|
68
|
+
stepped = false;
|
|
69
|
+
/** The next source intent is a frame step back from the end: it stays paused. */
|
|
70
|
+
holdPause = false;
|
|
61
71
|
/**
|
|
62
72
|
* The resources this plugin loaded into the current source (resource id →
|
|
63
73
|
* bytes), removed ones included: like the player, a removed track frees
|
|
@@ -14,6 +14,12 @@ export declare const readyCapabilities: {
|
|
|
14
14
|
export declare function sourceIntent(host: TestHost, inner: Internals, intent: Record<string, Json>): {
|
|
15
15
|
ticket: Json;
|
|
16
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* Like the player: after the end, a seek at or past the end (the smaller of
|
|
19
|
+
* the position and the duration, 0.5 ms slack) goes nowhere. It is accepted;
|
|
20
|
+
* the source stays ended and paused.
|
|
21
|
+
*/
|
|
22
|
+
export declare function atEndAlready(host: TestHost, seconds: number): boolean;
|
|
17
23
|
/** The file resolver of this plugin that claims `source`, if any. */
|
|
18
24
|
export declare function fileResolver(host: TestHost, _inner: Internals, source: string): string | null;
|
|
19
25
|
/** Retire the producer that is the player's source, unless it is `keep`. */
|
|
@@ -50,6 +56,6 @@ export declare function loadedSubtitles(host: TestHost, inner: Internals): Map<s
|
|
|
50
56
|
export declare function subtitleRoom(host: TestHost, inner: Internals, resourceId: string): void;
|
|
51
57
|
export declare function subtitleChange(host: TestHost, inner: Internals, expected: Json): void;
|
|
52
58
|
/** Implements `TestHost.setSource`. */
|
|
53
|
-
export declare function setSource(host: TestHost,
|
|
59
|
+
export declare function setSource(host: TestHost, inner: Internals, patch: Partial<SourceState>): void;
|
|
54
60
|
/** The default handlers of this area's wire methods, by method name. */
|
|
55
61
|
export declare function mediaHandlers(host: TestHost, inner: Internals): Record<string, Handler>;
|
|
@@ -49,12 +49,20 @@ export const readyCapabilities = {
|
|
|
49
49
|
snapshotSource: true,
|
|
50
50
|
};
|
|
51
51
|
export function sourceIntent(host, inner, intent) {
|
|
52
|
+
// Both flags cover this intent only, whatever becomes of it (a stale
|
|
53
|
+
// one too, as in the player).
|
|
54
|
+
const hold = inner.holdPause;
|
|
55
|
+
inner.holdPause = false;
|
|
56
|
+
inner.stepped = false;
|
|
52
57
|
const expected = intent.expected;
|
|
53
58
|
const stamp = host.source.stamp;
|
|
54
59
|
if (expected &&
|
|
55
60
|
(expected.generation !== stamp.generation ||
|
|
56
61
|
expected.intentVersion !== stamp.intentVersion))
|
|
57
62
|
throw new HostError("stale", "stale");
|
|
63
|
+
// A new load, a restart or Close: the end that was kept is gone.
|
|
64
|
+
if (intent.kind !== "control")
|
|
65
|
+
inner.endKeepsPause = false;
|
|
58
66
|
const next = {
|
|
59
67
|
...host.source,
|
|
60
68
|
stamp: { ...stamp, intentVersion: stamp.intentVersion + 1 },
|
|
@@ -107,8 +115,25 @@ export function sourceIntent(host, inner, intent) {
|
|
|
107
115
|
const control = intent.control;
|
|
108
116
|
if (control.kind === "pause")
|
|
109
117
|
next.paused = control.paused === true;
|
|
110
|
-
if (control.kind === "seek")
|
|
111
|
-
|
|
118
|
+
if (control.kind === "seek") {
|
|
119
|
+
if (atEndAlready(host, Number(control.seconds))) {
|
|
120
|
+
// Goes nowhere; keep-open holds the end paused.
|
|
121
|
+
next.paused = true;
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
next.position = Number(control.seconds);
|
|
125
|
+
// Like the player (2026-11-09): a seek leaves the end and plays on,
|
|
126
|
+
// except a step back from the end, or after an end reached while
|
|
127
|
+
// paused or by frame stepping. Leaving the end starts a new cycle
|
|
128
|
+
// (session.rs `confirm_seek_from_end`), so the next end is new.
|
|
129
|
+
if (host.source.phase === "ended") {
|
|
130
|
+
next.cycle++;
|
|
131
|
+
next.phase = "ready";
|
|
132
|
+
next.terminalReason = null;
|
|
133
|
+
next.paused = hold || inner.endKeepsPause;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
112
137
|
if (control.kind === "rate")
|
|
113
138
|
next.rate = Number(control.rate);
|
|
114
139
|
}
|
|
@@ -129,6 +154,20 @@ export function sourceIntent(host, inner, intent) {
|
|
|
129
154
|
cancelResolutions(host, inner);
|
|
130
155
|
return { ticket: { stamp: next.stamp, cycle: next.cycle, owner: 1 } };
|
|
131
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Like the player: after the end, a seek at or past the end (the smaller of
|
|
159
|
+
* the position and the duration, 0.5 ms slack) goes nowhere. It is accepted;
|
|
160
|
+
* the source stays ended and paused.
|
|
161
|
+
*/
|
|
162
|
+
export function atEndAlready(host, seconds) {
|
|
163
|
+
const s = host.source;
|
|
164
|
+
if (s.phase !== "ended")
|
|
165
|
+
return false;
|
|
166
|
+
const end = s.position !== null && s.duration !== null
|
|
167
|
+
? Math.min(s.position, s.duration)
|
|
168
|
+
: (s.position ?? s.duration);
|
|
169
|
+
return end !== null && seconds >= end - 0.0005;
|
|
170
|
+
}
|
|
132
171
|
/** The file resolver of this plugin that claims `source`, if any. */
|
|
133
172
|
export function fileResolver(host, _inner, source) {
|
|
134
173
|
if (source.includes("://") || !isAbsolute(source))
|
|
@@ -345,7 +384,11 @@ export function subtitleChange(host, inner, expected) {
|
|
|
345
384
|
};
|
|
346
385
|
}
|
|
347
386
|
/** Implements `TestHost.setSource`. */
|
|
348
|
-
export function setSource(host,
|
|
387
|
+
export function setSource(host, inner, patch) {
|
|
388
|
+
// The end keeps the pause when reached while paused or by a frame step
|
|
389
|
+
// (the player reads this as the end arrives).
|
|
390
|
+
if (patch.phase === "ended" && host.source.phase !== "ended")
|
|
391
|
+
inner.endKeepsPause = inner.stepped || host.source.paused;
|
|
349
392
|
host.source = {
|
|
350
393
|
...host.source,
|
|
351
394
|
...patch,
|
|
@@ -85,8 +85,9 @@ export function close(host, inner) {
|
|
|
85
85
|
retryDelay: 100,
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
-
catch {
|
|
89
|
-
// Left in the temporary directory.
|
|
88
|
+
catch (error) {
|
|
89
|
+
// Left in the temporary directory, and said so.
|
|
90
|
+
console.warn(`# TestHost: left ${inner.scratch} (${error.code ?? String(error)})`);
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
93
|
/** Implements `TestHost.keepsRunning`. */
|
|
@@ -862,7 +862,7 @@ export interface Commands {
|
|
|
862
862
|
* | `play-pause` | Space, a left click on the video | pause / resume, replay after the end |
|
|
863
863
|
* | `previous` / `next` | PageUp, Mouse:X2 / PageDown, Mouse:X1 | ask the sequence provider |
|
|
864
864
|
* | `frame-back` / `frame-forward` | D / F | `player.step("frame", …)` |
|
|
865
|
-
* | `seek-backward` / `seek-forward` | ← / → | relative seek by `setStepSeek` seconds (or `host.run`'s `seconds`), exact or to keyframes as `setStepSeek` says |
|
|
865
|
+
* | `seek-backward` / `seek-forward` | ← / → | relative seek by `setStepSeek` seconds (or `host.run`'s `seconds`), exact or to keyframes as `setStepSeek` says; after the end an exact seek that plays on |
|
|
866
866
|
* | `rate-normal`, `rate-down`, `rate-up` | Z, X, C | 1×, ±0.1 within 0.25–4 |
|
|
867
867
|
* | `volume-up` / `volume-down` | ↑ / ↓, wheel | ±5 (`volume-up` stops at 100) |
|
|
868
868
|
* | `mute` | M | toggle mute |
|
|
@@ -1192,7 +1192,9 @@ export interface Player {
|
|
|
1192
1192
|
*/
|
|
1193
1193
|
setPaused(paused: boolean, options?: Conditional): Promise<void>;
|
|
1194
1194
|
/**
|
|
1195
|
-
* Jump to `seconds`.
|
|
1195
|
+
* Jump to `seconds`. After the end (`phase: "ended"`) the player leaves
|
|
1196
|
+
* the end there and plays on, unless the end was reached while paused or
|
|
1197
|
+
* by a frame step; a seek at or past the end leaves it ended and paused.
|
|
1196
1198
|
*
|
|
1197
1199
|
* @capability playback.control
|
|
1198
1200
|
* @throws `stale` (rejects) The source changed since the state the call is
|
|
@@ -1562,7 +1564,7 @@ export interface Player {
|
|
|
1562
1564
|
* at or after position + step, backward on the last at or before position −
|
|
1563
1565
|
* step, and they always move. Presses during a seek add up and continue from
|
|
1564
1566
|
* where it landed; the on-screen text shows the landed time. Sources without
|
|
1565
|
-
* moving video seek exactly. {@link Player.seek}, chapters, loops and
|
|
1567
|
+
* moving video seek exactly, and so does a step seek after the end. {@link Player.seek}, chapters, loops and
|
|
1566
1568
|
* {@link Player.step} are unaffected, and so is a scrub unless it asks for
|
|
1567
1569
|
* keyframes itself ({@link Scrub.seek} with `keyframes: true`). Omitted or
|
|
1568
1570
|
* `false`: exact seeks, as before. `seconds` and `keyframes` are written as a
|
package/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Vestra Player SDK
|
|
2
2
|
|
|
3
|
-
> @vestra-player/sdk 1.7.
|
|
3
|
+
> @vestra-player/sdk 1.7.5: write plugins for Vestra Player in TypeScript (plugin API `vestra/1`). A plugin is a folder with `manifest.json` and an entry module whose default export `activate(plugin)` the player calls. The documentation is a tree of short pages read by path, like `go doc`: the same pages and API as https://vestrasys.github.io/vestra-player-sdk/.
|
|
4
4
|
|
|
5
5
|
## Read the documentation
|
|
6
6
|
|