@vestra-player/sdk 1.5.13 → 1.5.15
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 +25 -0
- package/README.md +12 -20
- package/dist/capabilities.d.ts +73 -1
- package/dist/capabilities.js +263 -28
- package/dist/commands.d.ts +89 -0
- package/dist/commands.js +438 -0
- package/dist/palettes.d.ts +23 -0
- package/dist/palettes.js +72 -0
- package/dist/player-runtime.d.ts +6 -2
- package/dist/player-runtime.js +6 -2
- package/dist/plugin/bindings.d.ts +45 -0
- package/dist/plugin/bindings.js +91 -42
- package/dist/plugin/osd.d.ts +32 -0
- package/dist/plugin/osd.js +36 -2
- package/dist/plugin/player.js +8 -0
- package/dist/plugin/services.d.ts +25 -0
- package/dist/plugin/services.js +29 -4
- package/dist/plugin/testing.d.ts +24 -1
- package/dist/plugin/testing.js +37 -7
- package/dist/plugin/types.d.ts +144 -32
- package/dist/subtitles.d.ts +5 -1
- package/dist/wire.d.ts +3 -0
- package/llms-full.txt +2683 -378
- package/llms.txt +72 -136
- package/package.json +2 -1
package/llms.txt
CHANGED
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
# Vestra Player SDK
|
|
2
2
|
|
|
3
|
-
> @vestra-player/sdk 1.5.
|
|
4
|
-
|
|
5
|
-
**How plugins run**
|
|
6
|
-
|
|
7
|
-
- Each plugin runs in its own Node.js process (Node.js 26, which the player ships) started by the player.
|
|
8
|
-
- The player loads the entry module and calls its **default export** `activate(plugin)`.
|
|
9
|
-
- Everything a plugin creates (commands, windows, panels, filters, listeners…) is a handle owned by `plugin` or a child scope, and is released automatically when the plugin stops.
|
|
10
|
-
- Plugins are trusted code.
|
|
11
|
-
- The API is the same on macOS and Windows.
|
|
3
|
+
> @vestra-player/sdk 1.5.15: 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; it runs in its own Node.js process. Everything a plugin creates (commands, windows, panels, filters, listeners…) is a handle that is released automatically when the plugin stops. L<n> are line numbers in llms-full.txt, next to this file: every page, declaration and example.
|
|
12
4
|
|
|
13
5
|
**Rules**
|
|
14
6
|
|
|
15
|
-
- **Only the public SDK.** Import `@vestra-player/sdk` with `import type` only (a runtime import fails `vestra-plugin build`) and `@vestra-player/sdk/testing` only in tests.
|
|
16
|
-
- **No other plugins.** Do not import another plugin's code, read its directory or data directory, or talk to it privately (shared files, sockets, messages).
|
|
17
|
-
- **No system commands.** Do not run `open`, `sips`, `plutil`, `security`, `cmd`, `powershell` or similar.
|
|
7
|
+
- **Only the public SDK.** Import `@vestra-player/sdk` with `import type` only (a runtime import fails `vestra-plugin build`) and `@vestra-player/sdk/testing` only in tests.
|
|
8
|
+
- **No other plugins.** Do not import another plugin's code, read its directory or data directory, or talk to it privately (shared files, sockets, messages).
|
|
9
|
+
- **No system commands.** Do not run `open`, `sips`, `plutil`, `security`, `cmd`, `powershell` or similar.
|
|
18
10
|
- **macOS and Windows.** The same code runs on both: build paths with `node:path`, write package paths with `/`, and handle `unsupported` where a method documents a platform difference.
|
|
19
|
-
- **Your own id.** `<owner>.<name>`, where the owner is your GitHub user or organization.
|
|
11
|
+
- **Your own id.** `<owner>.<name>`, where the owner is your GitHub user or organization.
|
|
20
12
|
|
|
21
13
|
**Files**
|
|
22
14
|
|
|
@@ -29,7 +21,7 @@ my-plugin/
|
|
|
29
21
|
package.json dev dependency and scripts
|
|
30
22
|
```
|
|
31
23
|
|
|
32
|
-
**manifest.json**
|
|
24
|
+
**manifest.json**
|
|
33
25
|
|
|
34
26
|
```json
|
|
35
27
|
{
|
|
@@ -37,21 +29,12 @@ my-plugin/
|
|
|
37
29
|
"version": "0.1.0",
|
|
38
30
|
"apiVersion": "vestra/1",
|
|
39
31
|
"entry": "main.ts",
|
|
40
|
-
"capabilities": ["commands", "ui.osd"]
|
|
41
|
-
"minPlayerVersion": "0.4.1",
|
|
42
|
-
"name": "Hello",
|
|
43
|
-
"author": "Me",
|
|
44
|
-
"punchline": "Says hello from the Tools menu.",
|
|
45
|
-
"description": "A first plugin.\nIt adds Tools ▸ Hello, which shows an on-screen message.",
|
|
46
|
-
"tags": ["example"],
|
|
47
|
-
"icon": "assets/icon.png",
|
|
48
|
-
"readme": "README.md",
|
|
49
|
-
"changelog": "CHANGELOG.md",
|
|
50
|
-
"sourceUrl": "https://github.com/me/hello",
|
|
51
|
-
"license": "MIT"
|
|
32
|
+
"capabilities": ["commands", "ui.osd", "playback.read", "events"]
|
|
52
33
|
}
|
|
53
34
|
```
|
|
54
35
|
|
|
36
|
+
Fields: `id`, `version`, `apiVersion`, `entry`, `capabilities`, `name`, `author`, `punchline`, `description`, `tags`, `icon`, `readme`, `changelog`, `sourceUrl`, `license`, `minPlayerVersion`; unknown fields and capabilities are rejected. Rules and limits: L2026–2089.
|
|
37
|
+
|
|
55
38
|
**main.ts**
|
|
56
39
|
|
|
57
40
|
```ts
|
|
@@ -66,62 +49,45 @@ export default async function activate(plugin: Plugin) {
|
|
|
66
49
|
}
|
|
67
50
|
```
|
|
68
51
|
|
|
69
|
-
**Capabilities** (a call without
|
|
70
|
-
|
|
71
|
-
- `
|
|
72
|
-
- `
|
|
73
|
-
- `
|
|
74
|
-
- `
|
|
75
|
-
- `
|
|
76
|
-
- `
|
|
77
|
-
- `ui.
|
|
78
|
-
- `ui.
|
|
79
|
-
- `
|
|
80
|
-
- `
|
|
81
|
-
- `
|
|
82
|
-
- `
|
|
83
|
-
- `
|
|
84
|
-
- `
|
|
85
|
-
- `
|
|
86
|
-
- `media.
|
|
87
|
-
- `
|
|
88
|
-
- `
|
|
89
|
-
- `
|
|
90
|
-
- `
|
|
91
|
-
- `
|
|
92
|
-
- `
|
|
93
|
-
- `
|
|
94
|
-
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
// tests/main.test.ts
|
|
100
|
-
import assert from "node:assert/strict";
|
|
101
|
-
import test from "node:test";
|
|
102
|
-
import { startPlugin } from "@vestra-player/sdk/testing";
|
|
103
|
-
import activate from "../main.ts";
|
|
104
|
-
|
|
105
|
-
test("shows the position", async () => {
|
|
106
|
-
const { host, stop } = await startPlugin(activate, {
|
|
107
|
-
directory: new URL("..", import.meta.url), // reads manifest.json
|
|
108
|
-
});
|
|
109
|
-
host.setSource({ phase: "ready", position: 12, duration: 60 });
|
|
110
|
-
await host.settle();
|
|
111
|
-
await host.command("where").run();
|
|
112
|
-
assert.deepEqual(host.osd, ["12.0 s of 60.0 s"]);
|
|
113
|
-
await stop();
|
|
114
|
-
});
|
|
115
|
-
```
|
|
52
|
+
**Capabilities** (a call without one fails with `capability`)
|
|
53
|
+
|
|
54
|
+
- `producer.av`: Player.openStream (also `playback.control`)
|
|
55
|
+
- `playback.read`: Player.state/refresh/stats/chapters/audioDevices, Timeline.marks
|
|
56
|
+
- `playback.control`: Player.open/setPaused/seek/setRate/restart/close/scrub/setOutput/provideSequence/next/previous/addAudioTrack/selectAudioTrack/step/setStepSeek/setLoop/setAudioDevice, Power.preventSleep
|
|
57
|
+
- `source.resolve`: Resolvers.add
|
|
58
|
+
- `events`: Player/Subtitles/Timeline/MainWindow/Appearance/PanelSlot/Panel/BackdropSlot.onChange, Resolvers.onFileTypesChange
|
|
59
|
+
- `commands`: Commands.add, Host.run
|
|
60
|
+
- `ui.window`: Windows.create
|
|
61
|
+
- `ui.mount`: Panels.mount/bottom/sidebar/backdrop, PanelSlot/Panel/BackdropSlot.onChange
|
|
62
|
+
- `ui.dialog`: Dialogs.confirm/openFile/openFiles/openDirectory/saveFile
|
|
63
|
+
- `plugins.manage`: Packages.validate/validateArchive/rollback/setEnabled/uninstall
|
|
64
|
+
- `processing.video`: Plugin.video.filter/video.view/video.render (also `playback.read`)
|
|
65
|
+
- `processing.audio`: Plugin.audio.filter (also `playback.read`, `events`)
|
|
66
|
+
- `subtitles.read`: Subtitles.state/onChange/refresh
|
|
67
|
+
- `subtitles.control`: Subtitles.select/load/remove/setStyle
|
|
68
|
+
- `media.read`: MediaCapture.capture, Snapshot.export (also `media.control`)
|
|
69
|
+
- `media.control`: MediaCapture.capture, Snapshot.export (also `media.read`)
|
|
70
|
+
- `ui.osd`: Osd.show/panel
|
|
71
|
+
- `clipboard`: Clipboard.readText/writeText/writeImage
|
|
72
|
+
- `window.control`: MainWindow.setVideoArea/setAlwaysOnTop/setCursorAutoHide/setPictureInPicture
|
|
73
|
+
- `bindings.manage`: Bindings.list/set/reset/onChange
|
|
74
|
+
- `timeline.marks`: Timeline.layer
|
|
75
|
+
- `ui.drop`: Drops.provide, Panel.onDrop
|
|
76
|
+
- `ui.settings`: Settings.page/show
|
|
77
|
+
- `ui.theme`: Appearance.set/setLanguage
|
|
78
|
+
- `secrets`: Secrets.get/set/delete
|
|
79
|
+
- No capability: `tools`, `storage`, `system`, `app`, `ui` (images and Markdown), `i18n`, reading window.state, appearance.theme and packages.list. Details: L2090–2132.
|
|
80
|
+
|
|
81
|
+
**Test**: `tests/*.test.ts` with `node:test`, run by `vestra-plugin test`. `startPlugin(activate, { directory: new URL("..", import.meta.url) })` from `@vestra-player/sdk/testing` returns `{ host, stop }`; `host` is a TestHost (an in-memory player): `host.setSource(…)`, `host.command(id).run()`, `host.press(key)`, `await host.settle()`, then assert on `host.osd`, `host.window(id).props`… Guide: L1588–1753; TestHost: L6675.
|
|
116
82
|
|
|
117
83
|
**Command line**
|
|
118
84
|
|
|
119
|
-
- `vestra-plugin check
|
|
120
|
-
- `vestra-plugin
|
|
121
|
-
- `vestra-plugin
|
|
122
|
-
- `vestra-plugin pack
|
|
123
|
-
- `vestra-plugin i18n extract
|
|
124
|
-
- `vestra-plugin i18n check
|
|
85
|
+
- `vestra-plugin check`: strict type check of the plugin's .ts files and tests/*.ts
|
|
86
|
+
- `vestra-plugin build`: check, then write dist/
|
|
87
|
+
- `vestra-plugin test`: node --test on tests/*.test.{ts,mjs}
|
|
88
|
+
- `vestra-plugin pack`: build, then dist/ → <out>/<id>-<version>.vxp
|
|
89
|
+
- `vestra-plugin i18n extract`: find the texts to translate, write locales/messages.pot and merge it into every locales/<lang>.po
|
|
90
|
+
- `vestra-plugin i18n check`: coverage per language, placeholder and plural problems, a stale messages.pot
|
|
125
91
|
- `vestra-player --plugin <dir>` runs a plugin from source, no build needed.
|
|
126
92
|
|
|
127
93
|
**Error codes** (`error.code`; branch on it, never on `message`)
|
|
@@ -131,79 +97,49 @@ test("shows the position", async () => {
|
|
|
131
97
|
- `invalid`: A bad argument
|
|
132
98
|
- `missing`: The target does not exist
|
|
133
99
|
- `busy`: The player is still doing a previous call of the same kind
|
|
134
|
-
- `conflict`: Another plugin owns the resource
|
|
100
|
+
- `conflict`: Another plugin owns the resource
|
|
135
101
|
- `unavailable`: Not possible right now
|
|
136
102
|
- `unsupported`: Not possible on this system, build or source
|
|
137
103
|
- `failed`: The operation ran and failed
|
|
138
104
|
- `aborted`: An `AbortSignal` fired
|
|
139
105
|
- `timeout`: A time limit ran out
|
|
140
|
-
- `limit`: A player-wide limit was reached, a property value is over the limits of PropValue
|
|
141
|
-
- `reserved`:
|
|
106
|
+
- `limit`: A player-wide limit was reached, a property value is over the limits of PropValue
|
|
107
|
+
- `reserved`: The id is `vestra` or starts with `vestra.`
|
|
142
108
|
- `versionMismatch`: The package needs a newer player or another `apiVersion`
|
|
143
|
-
-
|
|
144
|
-
- `ui`: The player could not apply a property to a tool window or a settings page, or could not build the Options window
|
|
145
|
-
- `disabled`: The plugin is being stopped
|
|
146
|
-
- Others: PluginError, llms-full.txt L974.
|
|
109
|
+
- Others: PluginError, llms-full.txt L3029.
|
|
147
110
|
|
|
148
111
|
## Reference
|
|
149
112
|
|
|
150
|
-
- [
|
|
151
|
-
-
|
|
152
|
-
-
|
|
153
|
-
-
|
|
154
|
-
-
|
|
155
|
-
-
|
|
156
|
-
- [API: @vestra-player/sdk
|
|
113
|
+
- [llms-full.txt](https://vestrasys.github.io/vestra-player-sdk/llms-full.txt), also node_modules/@vestra-player/sdk/llms-full.txt; the pages are on the [site](https://vestrasys.github.io/vestra-player-sdk/).
|
|
114
|
+
- Tutorials: Getting started L9–214
|
|
115
|
+
- Concepts: How a plugin runs L215–364; Commands, menus and key bindings L365–462; Playback state, controls and sources L463–585; Video and audio processing L586–663; Windows, panels, settings pages, dialogs and the OSD L664–950
|
|
116
|
+
- How-to: Keep a slider responsive while dragging L951–1125; Remember a window's state between runs L1126–1255; Translate a plugin L1256–1439; Migrate a plugin to English source text L1440–1587; Test a plugin L1588–1753; Publish a plugin L1754–1842
|
|
117
|
+
- Guidelines: Interface guidelines L1843–1927; Menu guidelines L1928–2025
|
|
118
|
+
- Reference: Manifest L2026–2089; Capabilities L2090–2132; Limits L2133–2227; Commands, menus and bindings L2228–2696; Platforms L2697–2725; Theme L2726–2930; Command line L2931–2986
|
|
119
|
+
- [API: @vestra-player/sdk](https://vestrasys.github.io/vestra-player-sdk/modules/_vestra-player_sdk.html): L2987–6510
|
|
120
|
+
- [API: @vestra-player/sdk/testing](https://vestrasys.github.io/vestra-player-sdk/modules/_vestra-player_sdk_testing.html): L6511–7835
|
|
157
121
|
|
|
158
122
|
## API
|
|
159
123
|
|
|
160
|
-
Where each module of `plugin` is declared:
|
|
161
|
-
|
|
162
|
-
- Plugin
|
|
163
|
-
-
|
|
164
|
-
- plugin.windows: Windows L1566
|
|
165
|
-
- plugin.panels: Panels L2207
|
|
166
|
-
- plugin.dialogs: Dialogs L2493
|
|
167
|
-
- plugin.player: Player L2934
|
|
168
|
-
- plugin.video: VideoFilter L3199, VideoView L3262, RenderOptions L3304
|
|
169
|
-
- plugin.audio: AudioFilter L3223
|
|
170
|
-
- plugin.subtitles: Subtitles L3402
|
|
171
|
-
- plugin.media: MediaCapture L3562
|
|
172
|
-
- plugin.resolvers: Resolvers L3667
|
|
173
|
-
- plugin.packages: Packages L3907
|
|
174
|
-
- plugin.osd: Osd L3135
|
|
175
|
-
- plugin.host: Host L3083
|
|
176
|
-
- plugin.clipboard: Clipboard L4024
|
|
177
|
-
- plugin.power: Power L4044
|
|
178
|
-
- plugin.tools: Tools L4077
|
|
179
|
-
- plugin.storage: Storage L4120
|
|
180
|
-
- plugin.system: System L4143
|
|
181
|
-
- plugin.secrets: Secrets L4161
|
|
182
|
-
- plugin.window: MainWindow L2330
|
|
183
|
-
- plugin.app: App L2411
|
|
184
|
-
- plugin.bindings: Bindings L3994
|
|
185
|
-
- plugin.ui: Ui L1453
|
|
186
|
-
- plugin.timeline: Timeline L2287
|
|
187
|
-
- plugin.drops: Drops L1863
|
|
188
|
-
- plugin.appearance: Appearance L1892
|
|
189
|
-
- plugin.i18n: I18n L2034
|
|
190
|
-
- plugin.settings: Settings L2140
|
|
124
|
+
Where each module of `plugin` (`plugin.<module>`) is declared:
|
|
125
|
+
|
|
126
|
+
- Plugin L3221, Scope L3090, PluginError L3029, Disposable L3002
|
|
127
|
+
- Commands L3433; Windows L3638; Panels L4281; Dialogs L4567; Player L5015; video: VideoFilter L5280, VideoView L5343, RenderOptions L5385; audio: AudioFilter L5304; Subtitles L5483; media: MediaCapture L5643; Resolvers L5748; Packages L5988; Osd L5216; Host L5164; Clipboard L6105; Power L6125; Tools L6158; Storage L6201; System L6224; Secrets L6242; window: MainWindow L4404; App L4485; Bindings L6075; Ui L3525; Timeline L4361; Drops L3937; Appearance L3966; I18n L4108; Settings L4214.
|
|
191
128
|
|
|
192
129
|
## Examples
|
|
193
130
|
|
|
194
|
-
|
|
131
|
+
Tested plugins in [examples/](https://github.com/vestrasys/vestra-player-sdk/tree/main/examples):
|
|
195
132
|
|
|
196
|
-
- hello: The README Quick start: one menu command and an on-screen message.
|
|
197
|
-
- blur: A tool window with one slider that blurs the playing video.
|
|
198
|
-
- signal-generator: Generates its own video and audio: colour bars and a 1 kHz tone.
|
|
199
|
-
- bookmark: A tool window bound to the playback state: remember the position and jump back to it.
|
|
200
|
-
- panel-menu: A sidebar panel with its own right-click menu.
|
|
201
|
-
- menus: Radio menu items, separator groups and a menu item whose title changes.
|
|
202
|
-
- theme-widgets: A tool window drawn with the player's theme and widgets.
|
|
203
|
-
- markdown: A window that shows a Markdown document.
|
|
204
|
-
- i18n: A plugin in the player's language: English source text, a Chinese translation.
|
|
133
|
+
- hello: The README Quick start: one menu command and an on-screen message. L8259–8348
|
|
134
|
+
- blur: A tool window with one slider that blurs the playing video. L8349–8610
|
|
135
|
+
- signal-generator: Generates its own video and audio: colour bars and a 1 kHz tone. L8611–8943
|
|
136
|
+
- bookmark: A tool window bound to the playback state: remember the position and jump back to it. L8944–9128
|
|
137
|
+
- panel-menu: A sidebar panel with its own right-click menu. L9129–9334
|
|
138
|
+
- menus: Radio menu items, separator groups and a menu item whose title changes. L9335–9494
|
|
139
|
+
- theme-widgets: A tool window drawn with the player's theme and widgets. L9495–9658
|
|
140
|
+
- markdown: A window that shows a Markdown document. L9659–9853
|
|
141
|
+
- i18n: A plugin in the player's language: English source text, a Chinese translation. L9854–10021
|
|
205
142
|
|
|
206
143
|
## Optional
|
|
207
144
|
|
|
208
|
-
- [Changelog](https://github.com/vestrasys/vestra-player-sdk/blob/main/CHANGELOG.md)
|
|
209
|
-
- Declarations with every doc comment: node_modules/@vestra-player/sdk/dist/plugin/types.d.ts, dist/plugin/testing.d.ts; Slint widgets: slint/vestra/*.slint.
|
|
145
|
+
- [Changelog](https://github.com/vestrasys/vestra-player-sdk/blob/main/CHANGELOG.md); full doc comments in node_modules/@vestra-player/sdk/dist/plugin/types.d.ts (the API) and dist/plugin/testing.d.ts (TestHost); Slint library in slint/vestra/.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vestra-player/sdk",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.15",
|
|
4
4
|
"description": "Plugin API types, test host and plugin CLI for Vestra Player (apiVersion vestra/1)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"docs": "typedoc",
|
|
49
49
|
"docs:check": "node scripts/check-docs.mjs",
|
|
50
50
|
"docs:llms": "node scripts/llms.mjs",
|
|
51
|
+
"docs:tables": "node scripts/doc-tables.mjs",
|
|
51
52
|
"examples": "node scripts/check-examples.mjs",
|
|
52
53
|
"format": "prettier --write \"{src,test,bin,scripts,examples}/**/*.{ts,mjs}\" package.json tsconfig.json tsconfig.check.json typedoc.json .oxlintrc.json examples/tsconfig.json \"examples/*/package.json\"",
|
|
53
54
|
"format:check": "prettier --check \"{src,test,bin,scripts,examples}/**/*.{ts,mjs}\" package.json tsconfig.json tsconfig.check.json typedoc.json .oxlintrc.json examples/tsconfig.json \"examples/*/package.json\"",
|