@vestra-player/sdk 1.7.20 → 1.9.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/CHANGELOG.md +72 -0
- package/README.md +2 -2
- package/bin/vestra-plugin.mjs +139 -100
- package/capability-scan.json +369 -0
- package/dist/api-requests.d.ts +11 -36
- package/dist/api-requests.js +22 -47
- package/dist/capability-scan.d.ts +95 -0
- package/dist/capability-scan.js +249 -0
- package/dist/commands.d.ts +35 -0
- package/dist/commands.js +42 -1
- package/dist/docs-tree.json.gz +0 -0
- package/dist/docs.d.ts +1 -1
- package/dist/docs.js +1 -1
- package/dist/index.d.ts +4 -5
- package/dist/manifest.d.ts +5 -0
- package/dist/manifest.js +9 -24
- package/dist/member-uses.d.ts +61 -0
- package/dist/member-uses.js +160 -0
- package/dist/mpv.d.ts +139 -0
- package/dist/mpv.js +496 -0
- package/dist/player-runtime.d.ts +3 -3
- package/dist/player-runtime.js +3 -3
- package/dist/plugin/appearance.d.ts +1 -1
- package/dist/plugin/appearance.js +2 -2
- package/dist/plugin/bindings.d.ts +1 -1
- package/dist/plugin/bindings.js +2 -2
- package/dist/plugin/commands.js +6 -14
- package/dist/plugin/connection.d.ts +26 -7
- package/dist/plugin/connection.js +68 -36
- package/dist/plugin/drops.js +1 -1
- package/dist/plugin/index.js +9 -15
- package/dist/plugin/media.js +0 -12
- package/dist/plugin/mpv.d.ts +3 -0
- package/dist/plugin/mpv.js +91 -0
- package/dist/plugin/packages.js +1 -2
- package/dist/plugin/player/events.d.ts +4 -3
- package/dist/plugin/player/events.js +7 -6
- package/dist/plugin/player.d.ts +21 -13
- package/dist/plugin/player.js +56 -21
- package/dist/plugin/scope.d.ts +1 -0
- package/dist/plugin/scope.js +2 -0
- package/dist/plugin/services.d.ts +4 -4
- package/dist/plugin/services.js +7 -29
- package/dist/plugin/settings.js +1 -1
- package/dist/plugin/shaders.js +0 -2
- package/dist/plugin/stream.d.ts +2 -1
- package/dist/plugin/stream.js +2 -2
- package/dist/plugin/testing/commands.d.ts +3 -10
- package/dist/plugin/testing/commands.js +43 -24
- package/dist/plugin/testing/index.d.ts +75 -114
- package/dist/plugin/testing/index.js +83 -102
- package/dist/plugin/testing/mpv.d.ts +7 -0
- package/dist/plugin/testing/mpv.js +90 -0
- package/dist/plugin/testing/processing.js +1 -1
- package/dist/plugin/testing/services.js +0 -1
- package/dist/plugin/timeline.d.ts +2 -3
- package/dist/plugin/timeline.js +4 -8
- package/dist/plugin/types/base.d.ts +49 -88
- package/dist/plugin/types/commands.d.ts +44 -77
- package/dist/plugin/types/packages.d.ts +17 -55
- package/dist/plugin/types/playback.d.ts +302 -135
- package/dist/plugin/types/plugin-wire.d.ts +6 -36
- package/dist/plugin/types/processing.d.ts +10 -49
- package/dist/plugin/types/services.d.ts +11 -70
- package/dist/plugin/types/snapshots.d.ts +7 -60
- package/dist/plugin/types/sources.d.ts +2 -11
- package/dist/plugin/types/subtitles.d.ts +5 -26
- package/dist/plugin/types/ui-content.d.ts +1 -16
- package/dist/plugin/types/ui-layout.d.ts +53 -79
- package/dist/plugin/types/ui-locale.d.ts +5 -23
- package/dist/plugin/types/ui-shell.d.ts +13 -59
- package/dist/plugin/view/layout.js +1 -1
- package/dist/plugin/view.js +0 -2
- package/dist/plugin/window.d.ts +1 -1
- package/dist/plugin/window.js +1 -1
- package/dist/plugin/wire-facade.js +1 -2
- package/dist/processing.d.ts +2 -3
- package/dist/protocol.d.ts +14 -0
- package/dist/protocol.js +14 -0
- package/dist/request-queue.js +1 -1
- package/dist/subtitles.d.ts +1 -1
- package/dist/ts-plugin.d.ts +8 -15
- package/dist/ts-plugin.js +3 -141
- package/dist/wire.d.ts +22 -12
- package/dist/wire.js +17 -8
- package/llms.txt +5 -5
- package/package.json +4 -3
- package/slint/vestra/widgets.slint +12 -4
- package/dist/capabilities.d.ts +0 -107
- package/dist/capabilities.js +0 -69
- package/dist/capability-check.d.ts +0 -133
- package/dist/capability-check.js +0 -371
- package/dist/capability-rules.d.ts +0 -125
- package/dist/capability-rules.js +0 -192
- package/dist/host-capabilities.d.ts +0 -10
- package/dist/host-capabilities.js +0 -477
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The mpv pass-through (`mpv.command`, `mpv.get`, `mpv.set`,
|
|
3
|
+
* `mpv.observe`, `mpv.unobserve`): the player's refusals from the shared
|
|
4
|
+
* table (`src/mpv.ts`), a record of what was sent, a store of property
|
|
5
|
+
* values and the owners of filter labels. No mpv: a command does nothing
|
|
6
|
+
* but be recorded.
|
|
7
|
+
*
|
|
8
|
+
* Part of `TestHost` (`./index.ts`): functions over the host and its private
|
|
9
|
+
* state (`Internals`, `./internals.ts`) that the class delegates to.
|
|
10
|
+
* Internal to the SDK; not exported from `@vestra-player/sdk/testing`.
|
|
11
|
+
*/
|
|
12
|
+
import { MPV_LIMITS, mpvCommandProblem, mpvCommandRefusal, mpvFilterChange, mpvNameProblem, mpvPropertyRefusal, } from "../../mpv.js";
|
|
13
|
+
import { HostError } from "../../wire.js";
|
|
14
|
+
/** The property a request names, checked as the player checks it. */
|
|
15
|
+
function property(name, write) {
|
|
16
|
+
const problem = mpvNameProblem(name);
|
|
17
|
+
if (problem)
|
|
18
|
+
throw new HostError("invalid", problem);
|
|
19
|
+
const refused = mpvPropertyRefusal(name, write);
|
|
20
|
+
if (refused)
|
|
21
|
+
throw new HostError("refused", refused);
|
|
22
|
+
return name;
|
|
23
|
+
}
|
|
24
|
+
/** Implements `TestHost.setMpvProperty`. */
|
|
25
|
+
export function setMpvProperty(host, name, value) {
|
|
26
|
+
host.mpv.properties.set(name, value);
|
|
27
|
+
if (host.mpv.observed.has(name))
|
|
28
|
+
host.emit("mpv.property", { name, value });
|
|
29
|
+
}
|
|
30
|
+
/** The default handlers of this area's wire methods, by method name. */
|
|
31
|
+
export function mpvHandlers(host, _inner) {
|
|
32
|
+
return {
|
|
33
|
+
"mpv.command": (p) => {
|
|
34
|
+
const problem = mpvCommandProblem(p.args);
|
|
35
|
+
if (problem)
|
|
36
|
+
throw new HostError("invalid", problem);
|
|
37
|
+
const args = p.args;
|
|
38
|
+
const refused = mpvCommandRefusal(args);
|
|
39
|
+
if (refused)
|
|
40
|
+
throw new HostError("refused", refused);
|
|
41
|
+
// A filter label has one owner; the player removes a stopped
|
|
42
|
+
// plugin's filters, a test host has only the one plugin.
|
|
43
|
+
const change = mpvFilterChange(args);
|
|
44
|
+
if (change) {
|
|
45
|
+
const key = `${change.stage}/${change.label}`;
|
|
46
|
+
const owner = host.mpv.labels.get(key);
|
|
47
|
+
if (owner !== undefined && owner !== host.manifestId)
|
|
48
|
+
throw new HostError("conflict", `the filter label @${change.label} belongs to ${owner}`);
|
|
49
|
+
const remove = change.operation === "remove" ||
|
|
50
|
+
(change.operation === "toggle" && owner !== undefined);
|
|
51
|
+
if (remove)
|
|
52
|
+
host.mpv.labels.delete(key);
|
|
53
|
+
else
|
|
54
|
+
host.mpv.labels.set(key, host.manifestId);
|
|
55
|
+
}
|
|
56
|
+
host.mpv.commands.push([...args]);
|
|
57
|
+
return { result: null };
|
|
58
|
+
},
|
|
59
|
+
"mpv.get": (p) => {
|
|
60
|
+
const name = property(p.name, false);
|
|
61
|
+
if (!host.mpv.properties.has(name))
|
|
62
|
+
throw new HostError("backend", "mpv: property not found");
|
|
63
|
+
return { value: host.mpv.properties.get(name) };
|
|
64
|
+
},
|
|
65
|
+
"mpv.set": (p) => {
|
|
66
|
+
const name = property(p.name, true);
|
|
67
|
+
if (p.value === undefined)
|
|
68
|
+
throw new HostError("invalid", "set takes a value");
|
|
69
|
+
setMpvProperty(host, name, p.value);
|
|
70
|
+
},
|
|
71
|
+
"mpv.observe": (p) => {
|
|
72
|
+
const name = property(p.name, false);
|
|
73
|
+
if (!host.mpv.observed.has(name) &&
|
|
74
|
+
host.mpv.observed.size >= MPV_LIMITS.observed)
|
|
75
|
+
throw new HostError("limit", `a plugin observes at most ${MPV_LIMITS.observed} mpv properties`);
|
|
76
|
+
host.mpv.observed.add(name);
|
|
77
|
+
// The current value first, as mpv sends it (nothing: null).
|
|
78
|
+
queueMicrotask(() => {
|
|
79
|
+
if (host.mpv.observed.has(name))
|
|
80
|
+
host.emit("mpv.property", {
|
|
81
|
+
name,
|
|
82
|
+
value: host.mpv.properties.get(name) ?? null,
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
"mpv.unobserve": (p) => {
|
|
87
|
+
host.mpv.observed.delete(property(p.name, false));
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
@@ -423,7 +423,7 @@ export function processingHandlers(host, inner) {
|
|
|
423
423
|
host.setVideoRenderOwner(null);
|
|
424
424
|
return null;
|
|
425
425
|
},
|
|
426
|
-
// The player's
|
|
426
|
+
// The player's request layer and `video_shaders.rs`.
|
|
427
427
|
"video.shaders.set": (p) => {
|
|
428
428
|
const idProblem = shaderIdProblem(p.id);
|
|
429
429
|
if (idProblem)
|
|
@@ -436,7 +436,6 @@ export function servicesHandlers(host, inner) {
|
|
|
436
436
|
origin: "installed",
|
|
437
437
|
state: enabled ? "running" : "disabled",
|
|
438
438
|
error: null,
|
|
439
|
-
capabilities: [...manifest.capabilities],
|
|
440
439
|
directory: `/test-host/packages/${manifest.id}`,
|
|
441
440
|
builtin: false,
|
|
442
441
|
source,
|
|
@@ -39,8 +39,8 @@ export declare const TIMELINE_LIMITS: Readonly<{
|
|
|
39
39
|
readonly titleChars: 100;
|
|
40
40
|
}>;
|
|
41
41
|
/**
|
|
42
|
-
* One per plugin: read
|
|
43
|
-
* current from `timeline.changed` (
|
|
42
|
+
* One per plugin: read by `plugin.player.read()`, then kept
|
|
43
|
+
* current from `timeline.changed` (after `plugin.player.subscribe()`) once the plugin uses it
|
|
44
44
|
* (or listens to that event with `player.on`).
|
|
45
45
|
*/
|
|
46
46
|
export declare class TimelineService {
|
|
@@ -49,7 +49,6 @@ export declare class TimelineService {
|
|
|
49
49
|
ranges: readonly TimelineRange[];
|
|
50
50
|
layer: boolean;
|
|
51
51
|
constructor(runtime: Runtime);
|
|
52
|
-
init(): Promise<void>;
|
|
53
52
|
start(): void;
|
|
54
53
|
accept(lists: WireTimeline): void;
|
|
55
54
|
read(): Promise<void>;
|
package/dist/plugin/timeline.js
CHANGED
|
@@ -51,8 +51,8 @@ const viewRanges = (ranges) => Object.freeze(ranges.map((range) => Object.freeze
|
|
|
51
51
|
plugin: range.plugin,
|
|
52
52
|
})));
|
|
53
53
|
/**
|
|
54
|
-
* One per plugin: read
|
|
55
|
-
* current from `timeline.changed` (
|
|
54
|
+
* One per plugin: read by `plugin.player.read()`, then kept
|
|
55
|
+
* current from `timeline.changed` (after `plugin.player.subscribe()`) once the plugin uses it
|
|
56
56
|
* (or listens to that event with `player.on`).
|
|
57
57
|
*/
|
|
58
58
|
export class TimelineService {
|
|
@@ -63,10 +63,8 @@ export class TimelineService {
|
|
|
63
63
|
layer = false;
|
|
64
64
|
constructor(runtime) {
|
|
65
65
|
this.#runtime = runtime;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (this.#runtime.can("playback.read"))
|
|
69
|
-
await this.read();
|
|
66
|
+
// `plugin.player.read()` reads the lists through the connection.
|
|
67
|
+
runtime.rereads.set("timeline.changed", () => this.read());
|
|
70
68
|
}
|
|
71
69
|
start() {
|
|
72
70
|
if (this.#started)
|
|
@@ -119,8 +117,6 @@ export function timeline(scope) {
|
|
|
119
117
|
layer() {
|
|
120
118
|
if (service().layer)
|
|
121
119
|
throw new Error("a plugin has one timeline layer; reuse it");
|
|
122
|
-
if (!scope.runtime.can("timeline.marks"))
|
|
123
|
-
throw failure("capability", "timeline.marks must be declared in manifest");
|
|
124
120
|
service().layer = true;
|
|
125
121
|
return new Layer(scope);
|
|
126
122
|
},
|
|
@@ -12,7 +12,7 @@ import type { PropValue, View } from "./ui-content.ts";
|
|
|
12
12
|
import type { Panel, Window } from "./ui-layout.ts";
|
|
13
13
|
import type { Bindings, Commands, Host, Palette, When } from "./commands.ts";
|
|
14
14
|
import type { Packages } from "./packages.ts";
|
|
15
|
-
import type { Player, Timeline } from "./playback.ts";
|
|
15
|
+
import type { Mpv, Player, Timeline } from "./playback.ts";
|
|
16
16
|
import type { AudioFilter, RenderOptions, VideoFilter, MotionEngine, VideoMotion, VideoShaders, VideoUpscaling, VideoView } from "./processing.ts";
|
|
17
17
|
import type { Clipboard, Power, Rendering, RenderingReason, Secrets, Storage, System, Tools } from "./services.ts";
|
|
18
18
|
import type { MediaCapture } from "./snapshots.ts";
|
|
@@ -58,7 +58,6 @@ import type { Wire } from "./plugin-wire.ts";
|
|
|
58
58
|
* created it; disposing the scope (or stopping the plugin) disposes them in
|
|
59
59
|
* reverse creation order, so a plugin rarely calls `dispose` itself.
|
|
60
60
|
*
|
|
61
|
-
* @capability None of its own: that of the handle.
|
|
62
61
|
* @since 1.0.0
|
|
63
62
|
* @category Plugin
|
|
64
63
|
*/
|
|
@@ -67,7 +66,6 @@ export interface Disposable {
|
|
|
67
66
|
* Release the resource. Resolves once the player confirmed the release
|
|
68
67
|
* (or immediately for purely local resources). Never rejects.
|
|
69
68
|
*
|
|
70
|
-
* @capability None of its own: that of the handle.
|
|
71
69
|
* @throws Never.
|
|
72
70
|
*
|
|
73
71
|
* @example Remove a command when its feature is turned off
|
|
@@ -96,14 +94,15 @@ export interface Disposable {
|
|
|
96
94
|
* | code | meaning |
|
|
97
95
|
* | --- | --- |
|
|
98
96
|
* | `stale` | A condition no longer held (the source or the subtitle selection changed); nothing was done. See {@link Conditional}. |
|
|
99
|
-
* | `capability` | The
|
|
97
|
+
* | `capability` | The call is for the player's built-in plugins only (`commands.list`, `commands.run`, `palette.lead`) and this plugin is not one. |
|
|
100
98
|
* | `invalid` | A bad argument (out of range, malformed, unknown id). |
|
|
101
99
|
* | `missing` | The target does not exist (an empty panel position, a missing file, an unknown command). |
|
|
102
100
|
* | `busy` | The player is still doing a previous call of the same kind (a dialog is open, a step is in flight). |
|
|
103
101
|
* | `conflict` | Another plugin owns the resource (the sequence provider, the display layer, the backdrop, a menu path, the command palette's lead row), or this plugin already uses the id (a window or command id). |
|
|
104
102
|
* | `unavailable` | Not possible right now (no ready media, no user interface, fullscreen, a disabled core action). |
|
|
105
103
|
* | `unsupported` | Not possible on this system, build or source (a platform gap, software rendering, a source that cannot seek, a filter on a generated stream, an export the player cannot make as asked: a stream copy, a source bitrate it cannot tell). |
|
|
106
|
-
* | `backend` | Loading or resolving failed; `message` is the backend's reason. |
|
|
104
|
+
* | `backend` | Loading or resolving failed, or mpv failed a command or a property of {@link Mpv}; `message` is the backend's reason. |
|
|
105
|
+
* | `refused` | {@link Mpv}: a command or a property the pass-through does not carry (it would start a program, load code, write files, end the player, or change what the player manages); `message` names it and why. |
|
|
107
106
|
* | `failed` | The operation ran and failed (`media.ready()` load error, a non-zero `tools.run` exit, the system refused). |
|
|
108
107
|
* | `replaced` | Accepted, but another source replaced it before it finished. |
|
|
109
108
|
* | `ended` | {@link Media.ready}: the media already played to the end. |
|
|
@@ -116,7 +115,7 @@ export interface Disposable {
|
|
|
116
115
|
* | `limit` | A player-wide limit was reached (for example the number of commands), a property value is over the limits of {@link PropValue}, a request is longer than the player's 1 MiB message, {@link Commands.run} ran too often, or a client that bypasses the SDK left more than 320 requests or 4 MiB of them unanswered (the player's backstop; the SDK keeps a plugin under it). |
|
|
117
116
|
* | `reserved` | {@link Packages.validate}, {@link PackageCandidate.install}: the id is `vestra` or starts with `vestra.` (any case), which only the player's built-in plugins use. |
|
|
118
117
|
* | `versionMismatch` | The package needs a newer player (`minPlayerVersion`). |
|
|
119
|
-
* | `ui-prepare` | The player could not prepare a mounted panel or a settings page (its Slint file does not compile, a bound property is not declared
|
|
118
|
+
* | `ui-prepare` | The player could not prepare a mounted panel or a settings page (its Slint file does not compile, or a bound property is not declared); `message` has the diagnostics. A panel shown at once rejects its `ready`; a tab mounted in the background is compiled when it is first shown, and its failure goes to {@link Scope.onError} without a request (see {@link Panel.ready}). |
|
|
120
119
|
* | `ui` | The player could not apply a property to a tool window or a settings page, or could not build the Options window (a property the Slint file does not declare, a value of the wrong type); `message` has Slint's reason. Also reported to {@link Scope.onError} without a request: a callback whose arguments the player could not convert, a property it could not show again when it rebuilt a view (an image file removed since). |
|
|
121
120
|
* | `host` | Any other failure inside the player; `message` is the player's reason. |
|
|
122
121
|
* | `disabled` | The plugin is being stopped; pending requests fail with it. {@link Commands.run}: the command is disabled; `message` has its reason. |
|
|
@@ -174,7 +173,6 @@ export type PluginError = Error & {
|
|
|
174
173
|
* `child.dispose()` releases its handles and deeper children in reverse
|
|
175
174
|
* creation order.
|
|
176
175
|
*
|
|
177
|
-
* Capabilities: each module documents the manifest capability it needs.
|
|
178
176
|
* Reading {@link Scope.window}, {@link Scope.app}, {@link Scope.appearance}
|
|
179
177
|
* `.theme`, {@link Scope.ui}, {@link Scope.tools}, {@link Scope.storage} and
|
|
180
178
|
* {@link Scope.system} needs none.
|
|
@@ -209,7 +207,6 @@ export type PluginError = Error & {
|
|
|
209
207
|
* go: dispose the child and everything it created is released, while the
|
|
210
208
|
* rest of the plugin keeps running.
|
|
211
209
|
*
|
|
212
|
-
* @capability That of each module (see the modules).
|
|
213
210
|
* @since 1.0.0
|
|
214
211
|
* @category Plugin
|
|
215
212
|
*/
|
|
@@ -222,22 +219,20 @@ export interface Scope extends Disposable {
|
|
|
222
219
|
* while the plugin is stopped. See {@link When}.
|
|
223
220
|
*/
|
|
224
221
|
readonly when: When;
|
|
225
|
-
/** Tool windows from `.slint` files
|
|
222
|
+
/** Tool windows from `.slint` files. */
|
|
226
223
|
readonly windows: Windows;
|
|
227
|
-
/** Docked panels: bottom bar, sidebar and backdrop
|
|
224
|
+
/** Docked panels: bottom bar, sidebar and backdrop. */
|
|
228
225
|
readonly panels: Panels;
|
|
229
|
-
/** Native file dialogs and confirmation alerts
|
|
226
|
+
/** Native file dialogs and confirmation alerts. */
|
|
230
227
|
readonly dialogs: Dialogs;
|
|
231
|
-
/** Playback state and controls
|
|
228
|
+
/** Playback state and controls. */
|
|
232
229
|
readonly player: Player;
|
|
233
230
|
/**
|
|
234
231
|
* Video processing: this plugin's filter chain, the display layer, the
|
|
235
232
|
* GPU render options, this plugin's shaders, the GPU's video upscaler and
|
|
236
|
-
* motion smoothing. The
|
|
237
|
-
* `
|
|
238
|
-
*
|
|
239
|
-
* The upscaler needs `video.upscaling` only, motion smoothing
|
|
240
|
-
* `video.motion` only.
|
|
233
|
+
* motion smoothing. The filter chain follows the player: call
|
|
234
|
+
* `plugin.player.subscribe()` and `plugin.player.read()` first (without `subscribe()` the SDK never sees
|
|
235
|
+
* the media become ready and the chain stays `waiting`).
|
|
241
236
|
*/
|
|
242
237
|
readonly video: {
|
|
243
238
|
/**
|
|
@@ -249,38 +244,31 @@ export interface Scope extends Disposable {
|
|
|
249
244
|
*/
|
|
250
245
|
filter(id: string): VideoFilter;
|
|
251
246
|
/**
|
|
252
|
-
* The display layer
|
|
247
|
+
* The display layer. The first plugin to call
|
|
253
248
|
* it owns the layer; another plugin's view fails with `conflict` until the
|
|
254
249
|
* owner disposes or stops.
|
|
255
250
|
*
|
|
256
|
-
* @throws `capability` (throws) The manifest does not declare
|
|
257
|
-
* `processing.video`.
|
|
258
251
|
* @throws `Error` without a code (throws) A second call in the same plugin
|
|
259
252
|
* while the first view is not disposed.
|
|
260
253
|
*/
|
|
261
254
|
view(): VideoView;
|
|
262
255
|
/**
|
|
263
|
-
* The GPU renderer's options
|
|
256
|
+
* The GPU renderer's options, owned like the
|
|
264
257
|
* display layer. Under software rendering the handle is `failed` with
|
|
265
258
|
* `unsupported` after the player's first answer, and `onError` hears it.
|
|
266
259
|
*
|
|
267
|
-
* @throws `capability` (throws) The manifest does not declare
|
|
268
|
-
* `processing.video`.
|
|
269
260
|
* @throws `Error` without a code (throws) A second call in the same plugin
|
|
270
261
|
* while the first handle is not disposed.
|
|
271
262
|
*/
|
|
272
263
|
render(): RenderOptions;
|
|
273
264
|
/**
|
|
274
|
-
* This plugin's own GPU shaders named `id` (default `"shaders"
|
|
275
|
-
* `processing.video`). Unlike {@link Scope.video | render()}, every plugin
|
|
265
|
+
* This plugin's own GPU shaders named `id` (default `"shaders"`). Unlike {@link Scope.video | render()}, every plugin
|
|
276
266
|
* may hold shader handles at the same time; the player joins their lists.
|
|
277
267
|
* Nothing is sent until the first `set()`.
|
|
278
268
|
*
|
|
279
269
|
* @param id - Local name of the handle, 1–128 bytes, unique within
|
|
280
270
|
* the plugin.
|
|
281
271
|
* @returns A {@link VideoShaders} owned by this scope.
|
|
282
|
-
* @throws `capability` (throws) The manifest does not declare
|
|
283
|
-
* `processing.video`.
|
|
284
272
|
* @throws `invalid` (throws) `id` is empty, longer than 128 bytes or
|
|
285
273
|
* has control characters.
|
|
286
274
|
* @throws `Error` without a code (throws) A second handle with the
|
|
@@ -288,14 +276,13 @@ export interface Scope extends Disposable {
|
|
|
288
276
|
*/
|
|
289
277
|
shaders(id?: string): VideoShaders;
|
|
290
278
|
/**
|
|
291
|
-
* The GPU's video upscaler (NVIDIA RTX Video Super Resolution on
|
|
292
|
-
*
|
|
279
|
+
* The GPU's video upscaler (NVIDIA RTX Video Super Resolution on
|
|
280
|
+
* Windows): whether it works here and why not, and turning
|
|
293
281
|
* it on or off for this plugin.
|
|
294
282
|
*/
|
|
295
283
|
readonly upscaling: VideoUpscaling;
|
|
296
284
|
/**
|
|
297
|
-
* Motion smoothing with one GPU vendor's frame-rate converter
|
|
298
|
-
* `video.motion`): whether it works here and why not, and this
|
|
285
|
+
* Motion smoothing with one GPU vendor's frame-rate converter: whether it works here and why not, and this
|
|
299
286
|
* plugin's mode. `amd` is AMD AMF's on Windows; `nvidia` is reserved
|
|
300
287
|
* (every mode reports `engine` until a player has it).
|
|
301
288
|
*
|
|
@@ -308,9 +295,8 @@ export interface Scope extends Disposable {
|
|
|
308
295
|
motion(engine: MotionEngine): VideoMotion;
|
|
309
296
|
};
|
|
310
297
|
/**
|
|
311
|
-
* Audio processing: this plugin's filter chain and delay
|
|
312
|
-
*
|
|
313
|
-
* {@link VideoFilter}).
|
|
298
|
+
* Audio processing: this plugin's filter chain and delay (it follows the
|
|
299
|
+
* player as {@link VideoFilter} does).
|
|
314
300
|
*/
|
|
315
301
|
readonly audio: {
|
|
316
302
|
/**
|
|
@@ -322,15 +308,15 @@ export interface Scope extends Disposable {
|
|
|
322
308
|
*/
|
|
323
309
|
filter(id: string): AudioFilter;
|
|
324
310
|
};
|
|
325
|
-
/** Subtitle tracks, uploads and style
|
|
311
|
+
/** Subtitle tracks, uploads and style. */
|
|
326
312
|
readonly subtitles: Subtitles;
|
|
327
|
-
/** Frozen snapshots and offline exports
|
|
313
|
+
/** Frozen snapshots and offline exports. */
|
|
328
314
|
readonly media: MediaCapture;
|
|
329
|
-
/** Page-URL to stream-URL resolvers
|
|
315
|
+
/** Page-URL to stream-URL resolvers. */
|
|
330
316
|
readonly resolvers: Resolvers;
|
|
331
|
-
/** The installed plugins; validation, installs
|
|
317
|
+
/** The installed plugins; validation, installs. */
|
|
332
318
|
readonly packages: Packages;
|
|
333
|
-
/** On-screen messages over the video
|
|
319
|
+
/** On-screen messages over the video. */
|
|
334
320
|
readonly osd: Osd;
|
|
335
321
|
/** The command palette's lead row (`palette.lead`, built-in plugins only). */
|
|
336
322
|
readonly palette: Palette;
|
|
@@ -338,7 +324,7 @@ export interface Scope extends Disposable {
|
|
|
338
324
|
readonly host: Host;
|
|
339
325
|
/** The system clipboard (`clipboard`). */
|
|
340
326
|
readonly clipboard: Clipboard;
|
|
341
|
-
/** Keeping the computer awake while playing
|
|
327
|
+
/** Keeping the computer awake while playing. */
|
|
342
328
|
readonly power: Power;
|
|
343
329
|
/** ffmpeg / ffprobe, run by this plugin's process. */
|
|
344
330
|
readonly tools: Tools;
|
|
@@ -348,25 +334,31 @@ export interface Scope extends Disposable {
|
|
|
348
334
|
readonly system: System;
|
|
349
335
|
/** Small secrets in the system's secret store (`secrets`). */
|
|
350
336
|
readonly secrets: Secrets;
|
|
337
|
+
/**
|
|
338
|
+
* mpv's own commands and properties, sent as they are (`mpv`).
|
|
339
|
+
*
|
|
340
|
+
* @since 1.8.0
|
|
341
|
+
*/
|
|
342
|
+
readonly mpv: Mpv;
|
|
351
343
|
/** The main window: fullscreen, video area, size, level, pointer hiding. */
|
|
352
344
|
readonly window: MainWindow;
|
|
353
345
|
/** The player's version and components, and the system it runs on. */
|
|
354
346
|
readonly app: App;
|
|
355
|
-
/** GPU or software rendering: read the choice, change it
|
|
347
|
+
/** GPU or software rendering: read the choice, change it. */
|
|
356
348
|
readonly rendering: Rendering;
|
|
357
|
-
/** Every command's bindings and the user's overrides
|
|
349
|
+
/** Every command's bindings and the user's overrides. */
|
|
358
350
|
readonly bindings: Bindings;
|
|
359
351
|
/** Runtime images for Slint `image` properties. */
|
|
360
352
|
readonly ui: Ui;
|
|
361
353
|
/** Marks on the seek bar, merged from every plugin's layer. */
|
|
362
354
|
readonly timeline: Timeline;
|
|
363
|
-
/** Files dropped on the video area, by extension
|
|
355
|
+
/** Files dropped on the video area, by extension. */
|
|
364
356
|
readonly drops: Drops;
|
|
365
357
|
/** The player's palette and the saved interface language. */
|
|
366
358
|
readonly appearance: Appearance;
|
|
367
359
|
/** The interface language of this run (read-only). */
|
|
368
360
|
readonly i18n: I18n;
|
|
369
|
-
/** Pages in the player's options window
|
|
361
|
+
/** Pages in the player's options window. */
|
|
370
362
|
readonly settings: Settings;
|
|
371
363
|
/**
|
|
372
364
|
* Direct messages to the player: requests by method name, raw events, direct
|
|
@@ -382,8 +374,6 @@ export interface Scope extends Disposable {
|
|
|
382
374
|
* A child scope; disposing it releases only what was created through it.
|
|
383
375
|
* The child is itself owned by this scope.
|
|
384
376
|
*
|
|
385
|
-
* @capability None.
|
|
386
|
-
*
|
|
387
377
|
* @example Tie a temporary window and its timer to one feature
|
|
388
378
|
* A "Live stats" feature opens a window and starts a timer; turning it off
|
|
389
379
|
* releases both together. Everything made through the child scope, and
|
|
@@ -420,8 +410,6 @@ export interface Scope extends Disposable {
|
|
|
420
410
|
* through another scope.
|
|
421
411
|
* @returns `item` itself, for chaining.
|
|
422
412
|
*
|
|
423
|
-
* @capability None.
|
|
424
|
-
*
|
|
425
413
|
* @example Dispose a handle from another scope together with this one
|
|
426
414
|
* A filter made through the root scope is withdrawn when a child feature
|
|
427
415
|
* ends. `add` hands an existing disposable to this scope, which then
|
|
@@ -475,7 +463,6 @@ export interface Scope extends Disposable {
|
|
|
475
463
|
* `DisposeInfo` as its first argument: wrap it (`() => controller.abort()`)
|
|
476
464
|
* when that matters.
|
|
477
465
|
*
|
|
478
|
-
* @capability None.
|
|
479
466
|
* @since 1.0.0
|
|
480
467
|
*/
|
|
481
468
|
onDispose(cleanup: ((info?: DisposeInfo) => void | Promise<void>) | (() => void | Promise<void>)): Disposable;
|
|
@@ -499,7 +486,6 @@ export interface Scope extends Disposable {
|
|
|
499
486
|
* });
|
|
500
487
|
* ```
|
|
501
488
|
*
|
|
502
|
-
* @capability None.
|
|
503
489
|
* @since 1.0.0
|
|
504
490
|
*/
|
|
505
491
|
onError(listener: (error: PluginError) => void): Disposable;
|
|
@@ -511,8 +497,6 @@ export interface Scope extends Disposable {
|
|
|
511
497
|
*
|
|
512
498
|
* Several calls within one microtask are merged into one pass.
|
|
513
499
|
*
|
|
514
|
-
* @capability None.
|
|
515
|
-
*
|
|
516
500
|
* @example Show progress from a long task between awaits
|
|
517
501
|
* A progress label moves while a long download runs, not only when it
|
|
518
502
|
* ends. The SDK re-evaluates bound values after each handler and when its
|
|
@@ -579,8 +563,6 @@ export interface Scope extends Disposable {
|
|
|
579
563
|
* @throws `invalid` (throws) `initial` is not a plain object (`null`, an
|
|
580
564
|
* array, a class instance).
|
|
581
565
|
*
|
|
582
|
-
* @capability None.
|
|
583
|
-
*
|
|
584
566
|
* @example Show a check's answer without a manual update
|
|
585
567
|
* A panel shows whether the current file has video once an asynchronous
|
|
586
568
|
* check answers. The answer is written to a tracked field; only the
|
|
@@ -631,7 +613,7 @@ export interface Scope extends Disposable {
|
|
|
631
613
|
* Tools ▸ Say hello, or Ctrl+H, shows "Hello from" and the plugin's id.
|
|
632
614
|
* The player imports `main.ts`, calls its default export with the
|
|
633
615
|
* `Plugin` object, and keeps the registrations made during activation;
|
|
634
|
-
* the manifest
|
|
616
|
+
* the manifest says only who the plugin is.
|
|
635
617
|
* ```ts
|
|
636
618
|
* import type { Plugin } from "@vestra-player/sdk";
|
|
637
619
|
*
|
|
@@ -650,7 +632,6 @@ export interface Scope extends Disposable {
|
|
|
650
632
|
* the modules of {@link Scope}, it carries the plugin's `id` and its
|
|
651
633
|
* `dataDirectory`.
|
|
652
634
|
*
|
|
653
|
-
* @capability That of each module (see the modules).
|
|
654
635
|
* @see [Tutorial](../../../docs/tutorial/index.md)
|
|
655
636
|
* @since 1.0.0
|
|
656
637
|
* @category Plugin
|
|
@@ -664,7 +645,7 @@ export interface Plugin extends Scope {
|
|
|
664
645
|
* Each installation has its own directory: it is kept across restarts,
|
|
665
646
|
* disabling and upgrades, and a reinstall of the same id from a different
|
|
666
647
|
* source gets a new, empty one. It is deleted only by
|
|
667
|
-
* `packages.uninstall(id, { removeData: true })`.
|
|
648
|
+
* `packages.uninstall(id, { removeData: true })`.
|
|
668
649
|
*
|
|
669
650
|
* The path's format is not part of the API: do not derive another
|
|
670
651
|
* plugin's directory from it (a plugin manager reads
|
|
@@ -687,7 +668,7 @@ export interface Plugin extends Scope {
|
|
|
687
668
|
* - `quit`: the player quits (or restarts after a lost GPU device). Every
|
|
688
669
|
* plugin is stopped at the same time, with 1 s in all (300 ms after a lost
|
|
689
670
|
* device).
|
|
690
|
-
* - `disable`: the user, or a plugin
|
|
671
|
+
* - `disable`: the user, or a plugin that manages plugins, switched the
|
|
691
672
|
* plugin off. Its session storage is cleared.
|
|
692
673
|
* - `uninstall`: the user uninstalls it.
|
|
693
674
|
* - `reload`: it is reloaded (from the plugin manager, or a development
|
|
@@ -800,9 +781,9 @@ export interface WindowState {
|
|
|
800
781
|
};
|
|
801
782
|
}
|
|
802
783
|
/**
|
|
803
|
-
* The player's main window
|
|
784
|
+
* The player's main window: read it, change it.
|
|
804
785
|
*
|
|
805
|
-
*
|
|
786
|
+
* After `plugin.player.subscribe()`, `state` follows the window from the first read or
|
|
806
787
|
* `onChange`; without it, it updates only at start and after this plugin's
|
|
807
788
|
* `setVideoArea`.
|
|
808
789
|
*
|
|
@@ -829,12 +810,9 @@ export interface WindowState {
|
|
|
829
810
|
*
|
|
830
811
|
* @remarks
|
|
831
812
|
* `plugin.window` is the player's main window: its size, whether it is
|
|
832
|
-
* maximized or fullscreen, picture-in-picture and the video area.
|
|
833
|
-
* changing it needs `window.control`. Changes that last only while the
|
|
813
|
+
* maximized or fullscreen, picture-in-picture and the video area. Changes that last only while the
|
|
834
814
|
* plugin runs (always on top, pointer auto-hide) revert when it stops.
|
|
835
815
|
*
|
|
836
|
-
* @capability None to read; window.control to change; events to follow
|
|
837
|
-
* outside changes.
|
|
838
816
|
* @since 1.0.0
|
|
839
817
|
* @category Plugin
|
|
840
818
|
*/
|
|
@@ -842,14 +820,12 @@ export interface MainWindow {
|
|
|
842
820
|
/** Latest state; zero video area without a native window. */
|
|
843
821
|
readonly state: WindowState;
|
|
844
822
|
/**
|
|
845
|
-
* The window state changed (
|
|
846
|
-
*
|
|
847
|
-
* @capability events (for outside changes)
|
|
823
|
+
* The window state changed (outside changes after `plugin.player.subscribe()`).
|
|
848
824
|
*
|
|
849
825
|
* @example Fit a panel to fullscreen
|
|
850
826
|
* The plugin's panel uses larger text while the player is fullscreen. The
|
|
851
827
|
* listener runs after the SDK updated `state` from the player's events
|
|
852
|
-
* (
|
|
828
|
+
* (after `plugin.player.subscribe()`; without it only after this plugin's own changes).
|
|
853
829
|
* ```ts
|
|
854
830
|
* declare const bar: Panel;
|
|
855
831
|
* // ---cut---
|
|
@@ -870,11 +846,8 @@ export interface MainWindow {
|
|
|
870
846
|
* The visible area excludes the menu bar and Dock on macOS; on Windows it
|
|
871
847
|
* is the whole display. `unavailable` without a user interface too.
|
|
872
848
|
*
|
|
873
|
-
* @capability window.control
|
|
874
849
|
* @throws `unavailable` (rejects) Fullscreen, or no user interface.
|
|
875
850
|
* @throws `invalid` (rejects) A size outside 1–16384 logical points.
|
|
876
|
-
* @throws `capability` (rejects) The manifest does not declare
|
|
877
|
-
* `window.control`.
|
|
878
851
|
*
|
|
879
852
|
* @example Make the video area 1280×720 points
|
|
880
853
|
* The window resizes so that the video column is 1280×720 logical points,
|
|
@@ -902,11 +875,8 @@ export interface MainWindow {
|
|
|
902
875
|
* Float the player's windows above other applications. Newest call wins; reverts when this plugin stops.
|
|
903
876
|
* `unavailable` without a user interface.
|
|
904
877
|
*
|
|
905
|
-
* @capability window.control
|
|
906
878
|
* @throws `unavailable` (rejects) No user interface.
|
|
907
879
|
* @throws `invalid` (rejects) `onTop` is not a boolean.
|
|
908
|
-
* @throws `capability` (rejects) The manifest does not declare
|
|
909
|
-
* `window.control`.
|
|
910
880
|
*
|
|
911
881
|
* @example Keep the player above other windows
|
|
912
882
|
* The player's windows (tool windows too) float above other applications
|
|
@@ -933,11 +903,8 @@ export interface MainWindow {
|
|
|
933
903
|
* playing, in a window too (not only fullscreen). Newest call wins;
|
|
934
904
|
* reverts to `"fullscreen"` when this plugin stops.
|
|
935
905
|
*
|
|
936
|
-
* @capability window.control
|
|
937
906
|
* @throws `invalid` (rejects) A mode other than `"fullscreen"` or
|
|
938
907
|
* `"playing"`.
|
|
939
|
-
* @throws `capability` (rejects) The manifest does not declare
|
|
940
|
-
* `window.control`.
|
|
941
908
|
*
|
|
942
909
|
* @example Hide the pointer over playing video in a window too
|
|
943
910
|
* The pointer disappears after 3 idle seconds over playing video, not only
|
|
@@ -973,15 +940,12 @@ export interface MainWindow {
|
|
|
973
940
|
* await plugin.window.setPictureInPicture(!plugin.window.state.pictureInPicture.active);
|
|
974
941
|
* ```
|
|
975
942
|
*
|
|
976
|
-
* @capability window.control
|
|
977
943
|
* @throws `unsupported` (rejects) The system has no picture-in-picture
|
|
978
944
|
* (`supported` is false).
|
|
979
945
|
* @throws `unavailable` (rejects) No video, or no user interface.
|
|
980
946
|
* @throws `invalid` (rejects) `on` is not a boolean.
|
|
981
947
|
* @throws `busy` (rejects) The previous call is still switching.
|
|
982
948
|
* @throws `failed` (rejects) The system refused.
|
|
983
|
-
* @throws `capability` (rejects) The manifest does not declare
|
|
984
|
-
* `window.control`.
|
|
985
949
|
* @since 1.0.0
|
|
986
950
|
*/
|
|
987
951
|
setPictureInPicture(on: boolean): Promise<void>;
|
|
@@ -1013,8 +977,7 @@ export interface AppInfo {
|
|
|
1013
977
|
};
|
|
1014
978
|
}
|
|
1015
979
|
/**
|
|
1016
|
-
* `plugin.app`: the fixed facts plus the system, read on request.
|
|
1017
|
-
* capability.
|
|
980
|
+
* `plugin.app`: the fixed facts plus the system, read on request.
|
|
1018
981
|
*
|
|
1019
982
|
* @example Describe the player and the system for a bug report
|
|
1020
983
|
* The plugin builds a line such as "Vestra 0.5.10 on macOS 26.2" to copy
|
|
@@ -1033,7 +996,6 @@ export interface AppInfo {
|
|
|
1033
996
|
* the displays at each call; the operating system's name and version are
|
|
1034
997
|
* worked out once, at the first call, and reused.
|
|
1035
998
|
*
|
|
1036
|
-
* @capability None.
|
|
1037
999
|
* @since 1.0.0
|
|
1038
1000
|
* @category Plugin
|
|
1039
1001
|
*/
|
|
@@ -1041,9 +1003,8 @@ export interface App extends AppInfo {
|
|
|
1041
1003
|
/**
|
|
1042
1004
|
* The operating system, the displays and the renderer, read when called
|
|
1043
1005
|
* (displays come and go; the renderer can fall back from GPU to software
|
|
1044
|
-
* once).
|
|
1006
|
+
* once). CPU and memory: Node's `os` module.
|
|
1045
1007
|
*
|
|
1046
|
-
* @capability None.
|
|
1047
1008
|
* @throws `busy` (rejects) The player could not start the request (no
|
|
1048
1009
|
* thread available).
|
|
1049
1010
|
*
|
|
@@ -1105,7 +1066,7 @@ export interface SystemInfo {
|
|
|
1105
1066
|
* The plugin adds its HDR command only when the player renders on the GPU,
|
|
1106
1067
|
* instead of creating the render options just to find out from a failed
|
|
1107
1068
|
* status. `system()` asks the player, which reports the renderer drawing at
|
|
1108
|
-
* that moment
|
|
1069
|
+
* that moment.
|
|
1109
1070
|
* ```ts
|
|
1110
1071
|
* const { rendering } = await plugin.app.system();
|
|
1111
1072
|
* if (rendering === "gpu") {
|
|
@@ -1133,8 +1094,8 @@ export interface SystemInfo {
|
|
|
1133
1094
|
* @example Say why the video is drawn in software
|
|
1134
1095
|
* An About page explains a software renderer with the player's own words,
|
|
1135
1096
|
* for example that the graphics driver is on the player's denylist.
|
|
1136
|
-
* `system()` reports the renderer and its reason together
|
|
1137
|
-
*
|
|
1097
|
+
* `system()` reports the renderer and its reason together; the message is
|
|
1098
|
+
* English text that may name the adapter and
|
|
1138
1099
|
* the driver version.
|
|
1139
1100
|
* ```ts
|
|
1140
1101
|
* const { rendering, renderingReason } = await plugin.app.system();
|