@vestra-player/sdk 1.7.1 → 1.7.2
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 +10 -0
- package/README.md +6 -9
- package/bin/vestra-plugin.mjs +4 -4
- package/dist/api-requests.d.ts +8 -8
- package/dist/api-requests.js +8 -8
- package/dist/capability-check.d.ts +15 -15
- package/dist/capability-check.js +4 -4
- package/dist/capability-rules.d.ts +4 -5
- package/dist/capability-rules.js +4 -5
- package/dist/commands.d.ts +34 -44
- package/dist/commands.js +21 -27
- package/dist/docs-tree.json.gz +0 -0
- package/dist/docs.d.ts +1 -1
- package/dist/docs.js +13 -3
- package/dist/i18n-tools.js +1 -1
- package/dist/i18n.js +1 -1
- package/dist/media.d.ts +7 -7
- package/dist/palettes.d.ts +5 -5
- package/dist/palettes.js +5 -5
- package/dist/plugin/appearance.js +1 -1
- package/dist/plugin/bindings.d.ts +2 -3
- package/dist/plugin/bindings.js +2 -3
- package/dist/plugin/commands.js +10 -11
- package/dist/plugin/connection.d.ts +18 -19
- package/dist/plugin/connection.js +23 -24
- package/dist/plugin/index.d.ts +5 -5
- package/dist/plugin/index.js +1 -1
- package/dist/plugin/osd.d.ts +1 -1
- package/dist/plugin/osd.js +1 -1
- package/dist/plugin/passes.d.ts +4 -4
- package/dist/plugin/passes.js +4 -4
- package/dist/plugin/patch.d.ts +8 -8
- package/dist/plugin/patch.js +12 -12
- package/dist/plugin/player/events.js +5 -5
- package/dist/plugin/resolvers.js +3 -3
- package/dist/plugin/scope.d.ts +4 -4
- package/dist/plugin/scope.js +4 -4
- package/dist/plugin/services.d.ts +2 -3
- package/dist/plugin/services.js +2 -3
- package/dist/plugin/shaders.js +5 -6
- package/dist/plugin/state.js +10 -10
- package/dist/plugin/testing/commands.d.ts +4 -5
- package/dist/plugin/testing/commands.js +4 -5
- package/dist/plugin/testing/i18n.d.ts +1 -1
- package/dist/plugin/testing/i18n.js +1 -1
- package/dist/plugin/testing/index.d.ts +147 -165
- package/dist/plugin/testing/index.js +137 -155
- package/dist/plugin/testing/internals.d.ts +2 -2
- package/dist/plugin/testing/internals.js +2 -2
- package/dist/plugin/timeline.d.ts +1 -1
- package/dist/plugin/timeline.js +2 -2
- package/dist/plugin/types/base.d.ts +90 -111
- package/dist/plugin/types/commands.d.ts +142 -174
- package/dist/plugin/types/packages.d.ts +48 -63
- package/dist/plugin/types/playback.d.ts +45 -59
- package/dist/plugin/types/plugin-wire.d.ts +38 -45
- package/dist/plugin/types/processing.d.ts +52 -65
- package/dist/plugin/types/services.d.ts +18 -25
- package/dist/plugin/types/snapshots.d.ts +34 -46
- package/dist/plugin/types/sources.d.ts +14 -16
- package/dist/plugin/types/subtitles.d.ts +7 -8
- package/dist/plugin/types/ui-content.d.ts +111 -116
- package/dist/plugin/types/ui-layout.d.ts +52 -63
- package/dist/plugin/types/ui-locale.d.ts +41 -45
- package/dist/plugin/types/ui-shell.d.ts +69 -87
- package/dist/plugin/values.d.ts +15 -18
- package/dist/plugin/values.js +16 -19
- package/dist/plugin/view/base.d.ts +2 -2
- package/dist/plugin/view/base.js +7 -8
- package/dist/plugin/view/layout.d.ts +2 -2
- package/dist/plugin/view/panel.js +2 -4
- package/dist/plugin/view/writer.d.ts +8 -8
- package/dist/plugin/view/writer.js +37 -39
- package/dist/plugin/when.d.ts +3 -3
- package/dist/plugin/wire-facade.js +6 -7
- package/dist/processing.d.ts +26 -30
- package/dist/processing.js +4 -4
- package/dist/source-resolvers.d.ts +2 -2
- package/dist/source.d.ts +1 -2
- package/dist/subtitles.d.ts +1 -1
- package/dist/ts-plugin.d.ts +5 -5
- package/dist/wire.d.ts +63 -70
- package/dist/wire.js +21 -25
- package/llms.txt +7 -10
- package/package.json +1 -1
- package/slint/vestra/bar-buttons.slint +6 -8
- package/slint/vestra/focus.slint +1 -1
- package/slint/vestra/widgets.slint +2 -4
|
@@ -20,8 +20,8 @@ export interface CommandState {
|
|
|
20
20
|
/** Shown as busy; like `enabled: false`, the player does not call `run`. Default false. */
|
|
21
21
|
busy: boolean;
|
|
22
22
|
/**
|
|
23
|
-
* Shown when the command is disabled or busy: English source text the
|
|
24
|
-
*
|
|
23
|
+
* Shown when the command is disabled or busy: English source text the player
|
|
24
|
+
* translates, or a {@link Text}.
|
|
25
25
|
*/
|
|
26
26
|
reason: TextValue | null;
|
|
27
27
|
}
|
|
@@ -33,9 +33,8 @@ export interface CommandState {
|
|
|
33
33
|
*
|
|
34
34
|
* @remarks
|
|
35
35
|
* Only a command with at least one function field takes part in the update
|
|
36
|
-
* passes
|
|
37
|
-
*
|
|
38
|
-
* when {@link Command.set} changes it.
|
|
36
|
+
* passes: a command whose fields are all values or `plugin.when` conditions is
|
|
37
|
+
* registered once and evaluated again only when {@link Command.set} changes it.
|
|
39
38
|
*
|
|
40
39
|
* @example Mix a computed state with a fixed one
|
|
41
40
|
* The Loop item carries a check mark while a loop is set and is always
|
|
@@ -143,20 +142,18 @@ export interface Condition {
|
|
|
143
142
|
not(): Condition;
|
|
144
143
|
}
|
|
145
144
|
/**
|
|
146
|
-
* `plugin.when`: the vocabulary of conditions
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
145
|
+
* `plugin.when`: the vocabulary of conditions. It names only state the player
|
|
146
|
+
* owns: the source's phase, kind, pause and controls (the same names as
|
|
147
|
+
* {@link PlayerState}), fullscreen, the palette and the saved interface
|
|
148
|
+
* language.
|
|
150
149
|
*
|
|
151
150
|
* @remarks
|
|
152
151
|
* Give a condition as a command's `enabled` or `checked`
|
|
153
|
-
* ({@link CommandOptions}, {@link Command.set}). The player evaluates it
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
* is busy), so a fixed reason is enough. Players before 0.5.21 have no
|
|
159
|
-
* `plugin.when` (declare `"minPlayerVersion": "0.5.21"`).
|
|
152
|
+
* ({@link CommandOptions}, {@link Command.set}). The player evaluates it and
|
|
153
|
+
* shows the result in menus, on keys and on bar buttons, again whenever that
|
|
154
|
+
* state changes, also while the plugin is stopped because nothing used it. With
|
|
155
|
+
* an `enabled` condition the player shows the command's `reason` only while the
|
|
156
|
+
* condition is false (or the command is busy), so a fixed reason is enough.
|
|
160
157
|
*
|
|
161
158
|
* State the vocabulary does not name (a plugin's own settings, an open
|
|
162
159
|
* window, a track list) stays a function or a value set with
|
|
@@ -268,12 +265,11 @@ export interface When {
|
|
|
268
265
|
language(language: LanguagePreference): Condition;
|
|
269
266
|
}
|
|
270
267
|
/**
|
|
271
|
-
* A built-in top-level menu of the player, named in a command path as
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
* default; older players refuse `@reset` with `invalid`.
|
|
268
|
+
* A built-in top-level menu of the player, named in a command path as `@<id>`
|
|
269
|
+
* or by its English key (see {@link CommandOptions.path}): Open, Playback,
|
|
270
|
+
* Subtitles, Video, Audio, Screen, Settings, Reset. The list is `MENU_IDS` in
|
|
271
|
+
* `@vestra-player/sdk/testing`. Reset (`@reset`) gathers every command that
|
|
272
|
+
* puts something back to its default.
|
|
277
273
|
*
|
|
278
274
|
* @since 1.3.0
|
|
279
275
|
* @category Commands
|
|
@@ -295,15 +291,14 @@ export type BarButtonIcon = "play" | "pause" | "stop" | "back" | "forward" | "op
|
|
|
295
291
|
* @remarks
|
|
296
292
|
* **Where it shows.** The player draws the bottom bar's button strip and
|
|
297
293
|
* decides where it goes: today at the right end of the bottom bar; this may
|
|
298
|
-
* change
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
* [Bottom-bar buttons](../../../docs/explanation/commands.md#bottom-bar-buttons).
|
|
294
|
+
* change. Buttons are ordered by `order`, then by plugin id; lower `order`
|
|
295
|
+
* comes first and stays visible longest. When the strip runs out of room, or
|
|
296
|
+
* more than 8 plugin buttons are declared, the remaining buttons move to the
|
|
297
|
+
* strip's » menu, in the same order. A button is never dropped: it is either in
|
|
298
|
+
* the strip or in the » menu, and its command keeps its menu entry, its key and
|
|
299
|
+
* its place in the command palette. Users may pin and unpin buttons later; do
|
|
300
|
+
* not rely on a position. See [Bottom-bar
|
|
301
|
+
* buttons](../../../docs/reference/commands.md#bottom-bar-buttons).
|
|
307
302
|
*
|
|
308
303
|
* **What it shows.** The icon, the command's title (translated, a trailing
|
|
309
304
|
* "…" removed) and its first key as the tooltip ("Plugin Store (F9)"),
|
|
@@ -334,8 +329,7 @@ export type BarButtonIcon = "play" | "pause" | "stop" | "back" | "forward" | "op
|
|
|
334
329
|
* });
|
|
335
330
|
* ```
|
|
336
331
|
*
|
|
337
|
-
* @player 0.5.10
|
|
338
|
-
* (declare `"minPlayerVersion": "0.5.10"` when the button matters).
|
|
332
|
+
* @player 0.5.10
|
|
339
333
|
* @since 1.5.29
|
|
340
334
|
*
|
|
341
335
|
* @category Commands
|
|
@@ -370,21 +364,18 @@ export interface CommandButton {
|
|
|
370
364
|
*
|
|
371
365
|
* Built-in menus keep their place. The built-in top-level menus
|
|
372
366
|
* ({@link MenuId}) sit at fixed orders, whatever is inside them: Open 110,
|
|
373
|
-
* Playback 200, Subtitles 300, Video 400, Audio 500, Screen 710, Settings
|
|
374
|
-
*
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
* (`["
|
|
378
|
-
*
|
|
379
|
-
* `order`
|
|
380
|
-
*
|
|
381
|
-
*
|
|
382
|
-
* in
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
* Players before 0.3.0 place every submenu at its smallest order, so there
|
|
386
|
-
* an item without `order` moves the whole menu to the top; to avoid that,
|
|
387
|
-
* give it an order in the menu's range (Video: 400–499).
|
|
367
|
+
* Playback 200, Subtitles 300, Video 400, Audio 500, Screen 710, Settings 830,
|
|
368
|
+
* Reset 840 (directly below Settings and in its separator group). Like every
|
|
369
|
+
* built-in menu, Reset shows only when a command is in it. This holds whether
|
|
370
|
+
* the path names the menu by id (`["@video", "Blur"]`) or by its key
|
|
371
|
+
* (`["Video", "Blur"]`), so a plugin's item never moves the player's menu.
|
|
372
|
+
* Directly inside a built-in menu, `order` 0 (the default) sorts after every
|
|
373
|
+
* other order: an item without `order` goes at the end, after the player's own
|
|
374
|
+
* items (which all use 100 or more). Give a positive order to sit between them
|
|
375
|
+
* (the player's items in menu order are in [Built-in
|
|
376
|
+
* commands](../../../docs/reference/commands.md#built-in-commands)), or a
|
|
377
|
+
* negative one to come first. Deeper levels (a plugin's own submenu) have no
|
|
378
|
+
* such rule.
|
|
388
379
|
*
|
|
389
380
|
* {@link Commands.add} throws `invalid` synchronously for a bad path,
|
|
390
381
|
* order or binding; the player refuses an empty or overlong text, a control
|
|
@@ -392,7 +383,7 @@ export interface CommandButton {
|
|
|
392
383
|
* `invalid` (through `ready`). The same path registered twice, or a path that
|
|
393
384
|
* is both an item and a submenu, fails with `conflict` (through `ready`).
|
|
394
385
|
*
|
|
395
|
-
* @see {@link Commands.add}, [Commands, menus and
|
|
386
|
+
* @see {@link Commands.add}, [Commands, menus and bindings](../../../docs/reference/commands.md)
|
|
396
387
|
* @since 1.0.0
|
|
397
388
|
* @category Commands
|
|
398
389
|
*/
|
|
@@ -404,25 +395,22 @@ export interface CommandOptions {
|
|
|
404
395
|
* one segment is a top-level item. Omit it for a command that is not in the
|
|
405
396
|
* main menu (bindings and panel menus only); `title` is then required.
|
|
406
397
|
*
|
|
407
|
-
* Segments are English source text, and menus merge by them: commands
|
|
408
|
-
*
|
|
409
|
-
*
|
|
410
|
-
*
|
|
411
|
-
*
|
|
412
|
-
*
|
|
413
|
-
*
|
|
414
|
-
*
|
|
415
|
-
* `@
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
* titled their menus in Chinese (视频…): there `["Video", "Blur"]` is a
|
|
419
|
-
* menu of its own, so plugins for those players write `@video`; player
|
|
420
|
-
* 0.4.3 still accepts the old Chinese titles of its own menus.
|
|
398
|
+
* Segments are English source text, and menus merge by them: commands of
|
|
399
|
+
* different plugins with the same leading segments share a submenu. The
|
|
400
|
+
* player shows each segment and the title in the interface language from the
|
|
401
|
+
* declaring plugin's catalog (`locales/<lang>.po`, see the [i18n
|
|
402
|
+
* guide](../../../docs/guides/i18n.md)); the player's own menus (Open,
|
|
403
|
+
* Playback, Subtitles, Video, Audio, Screen, Settings, Reset, and Playback ▸
|
|
404
|
+
* Speed, Playback ▸ Seek) always show the player's words. A built-in menu can
|
|
405
|
+
* also be named by its id, `@` plus a {@link MenuId}: `@open`, `@playback`,
|
|
406
|
+
* `@subtitles`, `@video`, `@audio`, `@screen`, `@settings` or `@reset`. Only
|
|
407
|
+
* the first segment is read as an id; an unknown id, or an id with nothing
|
|
408
|
+
* after it, fails with `invalid`.
|
|
421
409
|
*
|
|
422
410
|
* A segment that mixes words with data (a track number, a count) is a
|
|
423
|
-
* {@link Text}
|
|
424
|
-
*
|
|
425
|
-
*
|
|
411
|
+
* {@link Text}: `plugin.i18n.text("Track {} ({})", [n, codec])`. The menu
|
|
412
|
+
* shows it translated and filled in; it merges by its English rendering
|
|
413
|
+
* ("Track 2 (opus)").
|
|
426
414
|
*
|
|
427
415
|
* @example Put items into built-in menus, one with a track number
|
|
428
416
|
* "Blur" appears in the Video menu and "Track 2 (opus)" under Audio ▸
|
|
@@ -462,9 +450,7 @@ export interface CommandOptions {
|
|
|
462
450
|
* 1–80 UTF-8 bytes (a text value counted by its English rendering), no
|
|
463
451
|
* control characters, no whitespace at either end
|
|
464
452
|
* (`COMMAND_LIMITS.categoryBytes`); the player refuses anything else with
|
|
465
|
-
* `invalid`.
|
|
466
|
-
* with `invalid`, so declare `"minPlayerVersion": "0.7.6"` when you set
|
|
467
|
-
* it.
|
|
453
|
+
* `invalid`.
|
|
468
454
|
*
|
|
469
455
|
* @example Name commands that have no menu path
|
|
470
456
|
* The palette lists "Subtitle Sync: Earlier 0.5 s" and "Subtitle Sync:
|
|
@@ -486,23 +472,19 @@ export interface CommandOptions {
|
|
|
486
472
|
* });
|
|
487
473
|
* ```
|
|
488
474
|
*
|
|
489
|
-
* @player 0.7.6
|
|
490
|
-
* refuse the declaration with `invalid`).
|
|
475
|
+
* @player 0.7.6
|
|
491
476
|
* @since 1.6.4
|
|
492
477
|
*/
|
|
493
478
|
category?: string | Text;
|
|
494
479
|
/**
|
|
495
|
-
* The id of this plugin's command that opens the window or panel where
|
|
496
|
-
*
|
|
497
|
-
*
|
|
498
|
-
*
|
|
499
|
-
*
|
|
500
|
-
*
|
|
501
|
-
*
|
|
502
|
-
*
|
|
503
|
-
* a command outside the menu. Sent only when set: players
|
|
504
|
-
* before 0.7.6 refuse the field with `invalid`, so declare
|
|
505
|
-
* `"minPlayerVersion": "0.7.6"` when you set it.
|
|
480
|
+
* The id of this plugin's command that opens the window or panel where this
|
|
481
|
+
* command's control lives (`"tune"` for a Subtitle Tuning… command whose
|
|
482
|
+
* window has the sync slider). The player's command palette shows that place
|
|
483
|
+
* next to the command. A local id, like `id`: ASCII letters, digits, `.`, `_`
|
|
484
|
+
* and `-`, 1–128 bytes; the player refuses anything else with `invalid`. The
|
|
485
|
+
* command it names need not be registered yet; while it is not, the palette
|
|
486
|
+
* shows the place it would show without `home`: the menu path above the item,
|
|
487
|
+
* "Menu" for a top-level item, nothing for a command outside the menu.
|
|
506
488
|
*
|
|
507
489
|
* @example Point a key command at its window
|
|
508
490
|
* The palette row for "Subtitle Sync: Earlier 0.5 s" also says where the
|
|
@@ -526,8 +508,7 @@ export interface CommandOptions {
|
|
|
526
508
|
* });
|
|
527
509
|
* ```
|
|
528
510
|
*
|
|
529
|
-
* @player 0.7.6
|
|
530
|
-
* refuse the declaration with `invalid`).
|
|
511
|
+
* @player 0.7.6
|
|
531
512
|
* @since 1.6.4
|
|
532
513
|
*/
|
|
533
514
|
home?: string;
|
|
@@ -555,7 +536,7 @@ export interface CommandOptions {
|
|
|
555
536
|
* `NumpadDivide`, `NumpadEnter`, `NumpadDecimal`, the video-area mouse
|
|
556
537
|
* inputs `Mouse:LeftClick`, `Mouse:LeftDoubleClick[:LeftHalf|:RightHalf]`,
|
|
557
538
|
* `Mouse:MiddleClick`, `Mouse:WheelUp`/`Down`/`Left`/`Right`, and the side
|
|
558
|
-
* buttons `Mouse:X1` (back), `Mouse:X2` (forward),
|
|
539
|
+
* buttons `Mouse:X1` (back), `Mouse:X2` (forward), anywhere
|
|
559
540
|
* in the main window or the floating sidebar window, except while a menu
|
|
560
541
|
* is open.
|
|
561
542
|
*
|
|
@@ -574,33 +555,31 @@ export interface CommandOptions {
|
|
|
574
555
|
/** Fire again on keyboard auto-repeat while the key is held. Default false. */
|
|
575
556
|
repeat?: boolean;
|
|
576
557
|
/**
|
|
577
|
-
* A button for this command on the bottom bar
|
|
578
|
-
*
|
|
579
|
-
*
|
|
580
|
-
*
|
|
581
|
-
*
|
|
582
|
-
*
|
|
583
|
-
* a button without a path.
|
|
558
|
+
* A button for this command on the bottom bar: an icon and a place,
|
|
559
|
+
* `{ icon: "store", order: 200 }`. Needs a `path`: the menu entry is where
|
|
560
|
+
* the command stays reachable wherever the button is (the strip or its »
|
|
561
|
+
* menu). See {@link CommandButton} for where it shows, what it shows and the
|
|
562
|
+
* limits. Fails with `invalid` for an unknown icon name, an order outside
|
|
563
|
+
* 0–999 or a button without a path.
|
|
584
564
|
*/
|
|
585
565
|
button?: CommandButton;
|
|
586
566
|
/**
|
|
587
567
|
* Whether the command can run (default true): a value, a function, or a
|
|
588
|
-
* {@link Condition} the player evaluates (`plugin.when
|
|
568
|
+
* {@link Condition} the player evaluates (`plugin.when`).
|
|
589
569
|
*/
|
|
590
570
|
enabled?: Bindable<boolean> | Condition;
|
|
591
571
|
/**
|
|
592
|
-
* Check mark (or radio dot with `radio`); `null` (default) draws none.
|
|
593
|
-
*
|
|
594
|
-
* it holds.
|
|
572
|
+
* Check mark (or radio dot with `radio`); `null` (default) draws none. A
|
|
573
|
+
* {@link Condition} (`plugin.when`) draws the mark while it holds.
|
|
595
574
|
*/
|
|
596
575
|
checked?: Bindable<boolean | null> | Condition;
|
|
597
576
|
/** Busy state (default false); the player does not call `run` while busy. */
|
|
598
577
|
busy?: Bindable<boolean>;
|
|
599
578
|
/**
|
|
600
|
-
* Why the command is disabled or busy (shown to the user): English
|
|
601
|
-
*
|
|
602
|
-
*
|
|
603
|
-
*
|
|
579
|
+
* Why the command is disabled or busy (shown to the user): English source
|
|
580
|
+
* text, or a {@link Text} for one with data in it. With an `enabled`
|
|
581
|
+
* {@link Condition} the player shows it only while the condition is false or
|
|
582
|
+
* the command is busy, so a fixed text is enough.
|
|
604
583
|
*/
|
|
605
584
|
reason?: Bindable<TextValue | null>;
|
|
606
585
|
/**
|
|
@@ -645,7 +624,7 @@ export interface CommandOptions {
|
|
|
645
624
|
* exportCommand.set({ enabled: () => plugin.player.state.phase === "ready" });
|
|
646
625
|
* ```
|
|
647
626
|
*
|
|
648
|
-
* @see {@link Commands.add}, [Commands, menus and
|
|
627
|
+
* @see {@link Commands.add}, [Commands, menus and bindings](../../../docs/reference/commands.md)
|
|
649
628
|
* @since 1.0.0
|
|
650
629
|
* @category Commands
|
|
651
630
|
*/
|
|
@@ -656,13 +635,13 @@ export interface Command extends Disposable {
|
|
|
656
635
|
* Replace some state fields (values or functions). Last write wins.
|
|
657
636
|
*
|
|
658
637
|
* @remarks
|
|
659
|
-
* Only this command is evaluated again
|
|
660
|
-
*
|
|
661
|
-
*
|
|
662
|
-
*
|
|
663
|
-
*
|
|
664
|
-
*
|
|
665
|
-
*
|
|
638
|
+
* Only this command is evaluated again, not every binding and command of
|
|
639
|
+
* the plugin. Several calls within one
|
|
640
|
+
* microtask send one update. A function field makes the command take part in
|
|
641
|
+
* the update passes from then on. A binding that reads a plugin variable
|
|
642
|
+
* changed together with `set` outside a handler the SDK runs (a timer) is not
|
|
643
|
+
* refreshed by it: call {@link Scope.update} or keep that variable in
|
|
644
|
+
* {@link Scope.state}.
|
|
666
645
|
*
|
|
667
646
|
* @example Show a command as busy while it works
|
|
668
647
|
* The Export item shows as busy with "Exporting…" as its reason while the
|
|
@@ -696,17 +675,16 @@ export interface Command extends Disposable {
|
|
|
696
675
|
checked: Bindable<boolean | null> | Condition;
|
|
697
676
|
}>): void;
|
|
698
677
|
/**
|
|
699
|
-
* Resolves when the host has registered the command. Rejects with
|
|
700
|
-
*
|
|
701
|
-
*
|
|
702
|
-
*
|
|
703
|
-
*
|
|
704
|
-
*
|
|
705
|
-
*
|
|
706
|
-
* activation
|
|
707
|
-
*
|
|
708
|
-
*
|
|
709
|
-
* show the bad declaration. Any other failure during activation
|
|
678
|
+
* Resolves when the host has registered the command. Rejects with `conflict`
|
|
679
|
+
* (path already taken), `invalid` or `limit` (more than 160 commands in this
|
|
680
|
+
* plugin, or 1024 in the whole player). You rarely need to await it: the
|
|
681
|
+
* refusal goes to {@link Scope.onError}. During activation the SDK, in the
|
|
682
|
+
* plugin's process, logs the refusal with the command id and the player's
|
|
683
|
+
* message, skips the command and lets the rest of the plugin activate;
|
|
684
|
+
* the error reaches `onError` once
|
|
685
|
+
* activation completes, so a listener added anywhere in `activate` hears it.
|
|
686
|
+
* `startPlugin` stays strict: there a refusal during activation fails it, so
|
|
687
|
+
* tests show the bad declaration. Any other failure during activation
|
|
710
688
|
* (`capability`, no answer) fails activation.
|
|
711
689
|
*
|
|
712
690
|
* Only the player's answer is skipped. What {@link Commands.add} checks
|
|
@@ -728,16 +706,16 @@ export interface Command extends Disposable {
|
|
|
728
706
|
* `plugin.commands`: menu commands with default bindings. Needs `commands`.
|
|
729
707
|
*
|
|
730
708
|
* @remarks
|
|
731
|
-
* A command is one action of the plugin with a menu item (`path`), default
|
|
732
|
-
*
|
|
733
|
-
*
|
|
734
|
-
*
|
|
735
|
-
*
|
|
736
|
-
*
|
|
737
|
-
*
|
|
738
|
-
*
|
|
739
|
-
*
|
|
740
|
-
* `
|
|
709
|
+
* A command is one action of the plugin with a menu item (`path`), default keys
|
|
710
|
+
* (`bindings`), optionally a bottom-bar button (`button`) and a state the menu
|
|
711
|
+
* shows (`enabled`, `checked`, `busy`, `reason`). The player owns the menu, the
|
|
712
|
+
* binding table and the user's key overrides: it calls `run` when the user
|
|
713
|
+
* picks the item, presses a key or clicks the button. Commands of all plugins
|
|
714
|
+
* merge into the player's menus by their English path keys. Registration is
|
|
715
|
+
* asynchronous: `add` returns at once, and {@link Command.ready} reports the
|
|
716
|
+
* player's answer (during activation the SDK logs a refusal and skips that
|
|
717
|
+
* command; `startPlugin` fails on it). What `add` checks itself throws from
|
|
718
|
+
* `add`.
|
|
741
719
|
*
|
|
742
720
|
* @capability commands
|
|
743
721
|
*
|
|
@@ -754,7 +732,7 @@ export interface Command extends Disposable {
|
|
|
754
732
|
* });
|
|
755
733
|
* ```
|
|
756
734
|
*
|
|
757
|
-
* @see {@link Command}, {@link CommandOptions}, [Commands, menus and
|
|
735
|
+
* @see {@link Command}, {@link CommandOptions}, [Commands, menus and bindings](../../../docs/reference/commands.md)
|
|
758
736
|
* @since 1.0.0
|
|
759
737
|
* @category Commands
|
|
760
738
|
*/
|
|
@@ -769,13 +747,13 @@ export interface Commands {
|
|
|
769
747
|
* @throws `invalid` synchronously for a malformed path (including an
|
|
770
748
|
* unknown `@` menu id), order or binding; `conflict` for an id this
|
|
771
749
|
* plugin has already declared and not disposed.
|
|
772
|
-
* @throws `invalid` (`ready` rejects; during activation
|
|
773
|
-
*
|
|
774
|
-
*
|
|
775
|
-
*
|
|
776
|
-
*
|
|
777
|
-
*
|
|
778
|
-
*
|
|
750
|
+
* @throws `invalid` (`ready` rejects; during activation the SDK logs and
|
|
751
|
+
* skips the command and the plugin activates, see {@link Command.ready};
|
|
752
|
+
* `startPlugin` fails) for a text the player refuses: an id, title, path segment, group or reason
|
|
753
|
+
* that is empty, longer than its `COMMAND_LIMITS` bytes (a text value counted
|
|
754
|
+
* by its English rendering), has a control character or whitespace at either
|
|
755
|
+
* end, or an id with other characters than ASCII letters, digits, `.`, `_`
|
|
756
|
+
* and `-`. `TestHost` refuses the same.
|
|
779
757
|
*
|
|
780
758
|
* @example Pause playback from a menu item
|
|
781
759
|
* Playback ▸ Pause (and Ctrl+P) pauses and resumes, shows a check mark
|
|
@@ -818,16 +796,14 @@ export interface Commands {
|
|
|
818
796
|
* player, and until its answer arrives (a few milliseconds) every
|
|
819
797
|
* command reads `[]`; a binding that read it runs again then.
|
|
820
798
|
*
|
|
821
|
-
* The plugin's own commands, and the player's own as `host/<id>`
|
|
822
|
-
*
|
|
823
|
-
* {@link "@vestra-player/sdk/testing"!BUILTIN_COMMANDS | BUILTIN_COMMANDS}
|
|
824
|
-
* shows the player's keys beside its
|
|
825
|
-
* not added (or another plugin's) reads
|
|
826
|
-
* `bindings.manage` (the whole
|
|
827
|
-
* {@link Bindings.list}). Without the
|
|
828
|
-
* command reads `[]`.
|
|
829
|
-
* builds `plugin` from its own SDK) and no `KeyHint` in their widgets,
|
|
830
|
-
* so declare `"minPlayerVersion": "0.7.6"`.
|
|
799
|
+
* The plugin's own commands, and the player's own as `host/<id>`
|
|
800
|
+
* (`host/volume-up`, `host/mute`: the ids of
|
|
801
|
+
* {@link "@vestra-player/sdk/testing"!BUILTIN_COMMANDS | BUILTIN_COMMANDS}
|
|
802
|
+
* rows owned by `host`), for a panel that shows the player's keys beside its
|
|
803
|
+
* own controls; an id the plugin has not added (or another plugin's) reads
|
|
804
|
+
* `[]`. Needs nothing beyond `commands`, not `bindings.manage` (the whole
|
|
805
|
+
* binding table, every plugin's, is {@link Bindings.list}). Without the
|
|
806
|
+
* `commands` capability every command reads `[]`.
|
|
831
807
|
*
|
|
832
808
|
* @example Show a slider's keys beside it
|
|
833
809
|
* The Brightness row shows its two keys, W and E by default, as key caps
|
|
@@ -846,8 +822,7 @@ export interface Commands {
|
|
|
846
822
|
* ```
|
|
847
823
|
*
|
|
848
824
|
* @capability commands
|
|
849
|
-
* @player 0.7.6
|
|
850
|
-
* have no `keys`: calling it throws a `TypeError`).
|
|
825
|
+
* @player 0.7.6
|
|
851
826
|
* @since 1.6.6
|
|
852
827
|
*/
|
|
853
828
|
keys(id: string): readonly string[];
|
|
@@ -872,8 +847,7 @@ export interface Commands {
|
|
|
872
847
|
* });
|
|
873
848
|
* ```
|
|
874
849
|
*
|
|
875
|
-
* @player 0.7.6
|
|
876
|
-
* have no `onKeysChange`).
|
|
850
|
+
* @player 0.7.6
|
|
877
851
|
* @since 1.6.6
|
|
878
852
|
*/
|
|
879
853
|
onKeysChange(listener: () => void): Disposable;
|
|
@@ -885,20 +859,18 @@ export interface Commands {
|
|
|
885
859
|
* | action | default bindings | behaviour |
|
|
886
860
|
* | --- | --- | --- |
|
|
887
861
|
* | `stop` | F4 | close the source |
|
|
888
|
-
* | `play-pause` | Space, a left click on the video
|
|
889
|
-
* | `previous` / `next` | PageUp, Mouse:X2 / PageDown, Mouse:X1
|
|
862
|
+
* | `play-pause` | Space, a left click on the video | pause / resume, replay after the end |
|
|
863
|
+
* | `previous` / `next` | PageUp, Mouse:X2 / PageDown, Mouse:X1 | ask the sequence provider |
|
|
890
864
|
* | `frame-back` / `frame-forward` | D / F | `player.step("frame", …)` |
|
|
891
865
|
* | `seek-backward` / `seek-forward` | ← / → | relative seek by `setStepSeek` seconds (or `host.run`'s `seconds`), exact or to keyframes as `setStepSeek` says |
|
|
892
866
|
* | `rate-normal`, `rate-down`, `rate-up` | Z, X, C | 1×, ±0.1 within 0.25–4 |
|
|
893
867
|
* | `volume-up` / `volume-down` | ↑ / ↓, wheel | ±5 (`volume-up` stops at 100) |
|
|
894
868
|
* | `mute` | M | toggle mute |
|
|
895
|
-
* | `fullscreen` | Escape
|
|
869
|
+
* | `fullscreen` | Escape | toggle the main window's fullscreen: enter it when windowed, leave it when fullscreen, as the Toggle Fullscreen command does (`unavailable` when the player has no window) |
|
|
896
870
|
*
|
|
897
|
-
* In the binding overlay their keys are `host/<action>`. `fullscreen`
|
|
898
|
-
*
|
|
871
|
+
* In the binding overlay their keys are `host/<action>`. `fullscreen` changes
|
|
872
|
+
* no playback state: read the result from `window.state.fullscreen`
|
|
899
873
|
* (`plugin.window.onChange`), which also changes when the user toggles it.
|
|
900
|
-
* Players before 0.5.2 reject it with `invalid`: set
|
|
901
|
-
* `"minPlayerVersion": "0.5.2"` when you use it.
|
|
902
874
|
*
|
|
903
875
|
* @see {@link Host.run}
|
|
904
876
|
* @since 1.0.0
|
|
@@ -987,8 +959,7 @@ export interface Host {
|
|
|
987
959
|
* once the seek is submitted, as before. `invalid` for `seconds` out of
|
|
988
960
|
* range.
|
|
989
961
|
*
|
|
990
|
-
* @player 0.5.1
|
|
991
|
-
* `seconds` and seek by the `setStepSeek` step)
|
|
962
|
+
* @player 0.5.1
|
|
992
963
|
* @since 1.5.19
|
|
993
964
|
*
|
|
994
965
|
* @example Add a 30-second skip that adds up with the arrow keys
|
|
@@ -1036,23 +1007,20 @@ export interface BindingInfo extends BindingRef {
|
|
|
1036
1007
|
/** Menu path as shown; `null` for a command outside the menu. */
|
|
1037
1008
|
path: string[] | null;
|
|
1038
1009
|
/**
|
|
1039
|
-
* The menu path's keys: the English text menus merge by, the same in
|
|
1040
|
-
*
|
|
1041
|
-
*
|
|
1042
|
-
*
|
|
1043
|
-
*
|
|
1044
|
-
* Always set by `list()`; optional so that test fakes written for older
|
|
1045
|
-
* SDKs still type-check.
|
|
1010
|
+
* The menu path's keys: the English text menus merge by, the same in every
|
|
1011
|
+
* interface language (`["Playback", "Seek", "Back 5 s"]`; a built-in menu by
|
|
1012
|
+
* its key, `"Video"`, also when declared as `@video`). `null` for a command
|
|
1013
|
+
* outside the menu. Find a command by where it is in the menu with this, not
|
|
1014
|
+
* with `path`. Always set by `list()`.
|
|
1046
1015
|
*
|
|
1047
1016
|
* @since 1.5.11
|
|
1048
1017
|
*/
|
|
1049
1018
|
key?: string[] | null;
|
|
1050
1019
|
/**
|
|
1051
1020
|
* The command's category as shown ({@link CommandOptions.category},
|
|
1052
|
-
* translated), `null` when it declares none (
|
|
1053
|
-
*
|
|
1054
|
-
*
|
|
1055
|
-
* category, use the menu path (`path`) as before.
|
|
1021
|
+
* translated), `null` when it declares none. Always set by `list()`. A list
|
|
1022
|
+
* of commands names one `Category: Title`; without a category, use the menu
|
|
1023
|
+
* path (`path`) as before.
|
|
1056
1024
|
*
|
|
1057
1025
|
* @since 1.6.4
|
|
1058
1026
|
*/
|
|
@@ -1098,7 +1066,7 @@ export interface BindingInfo extends BindingRef {
|
|
|
1098
1066
|
* applies the change at once to every running plugin.
|
|
1099
1067
|
*
|
|
1100
1068
|
* @capability bindings.manage
|
|
1101
|
-
* @see [Commands, menus and
|
|
1069
|
+
* @see [Commands, menus and bindings](../../../docs/reference/commands.md)
|
|
1102
1070
|
* @since 1.0.0
|
|
1103
1071
|
* @category Commands
|
|
1104
1072
|
*/
|
|
@@ -1180,8 +1148,8 @@ export interface Bindings {
|
|
|
1180
1148
|
reset(ref?: BindingRef): Promise<void>;
|
|
1181
1149
|
/**
|
|
1182
1150
|
* The binding list changed (read `list()` again): a declaration or an
|
|
1183
|
-
* override. At most every 200 ms
|
|
1184
|
-
*
|
|
1151
|
+
* override. At most every 200 ms, and only when the list itself changed,
|
|
1152
|
+
* not when a plugin starts again with the same commands.
|
|
1185
1153
|
*
|
|
1186
1154
|
* @capability bindings.manage
|
|
1187
1155
|
*
|