@vestra-player/sdk 1.11.5 → 1.11.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.11.6
4
+
5
+ Additions only; **nobody must change anything**: a plugin that does not use them behaves as before.
6
+
7
+ **Small player and window members** (needs the player release that answers them, 0.11.13 or later; the version is the coordinator's to confirm). On an older player the new requests fail with the player's unknown-method error, and the new options are ignored, so a plugin that relies on them declares that player release in `minPlayerVersion`.
8
+
9
+ - **`OsdShowOptions.durationMs`**: how long an `osd.show` message stays, an integer of 500–30,000 ms (`OSD_LIMITS.minDurationMs`, `maxDurationMs`; mpv's `show-text` duration). Omitted: 2 seconds, about 4 with actions, as before. A message with actions is still held under the pointer (at most 30 seconds).
10
+ - **`Player.seekSubtitle("next" | "previous" | "current")`** (`player.seekSubtitle`): mpv's `sub-seek` on the selected primary subtitle; `unavailable` without one.
11
+ - **`Player.open(source, { start })`**: open at a time without showing the first frame (mpv's per-file `start`, the same load option the player uses to resume after a renderer restart). Also for resolved addresses; a file resolver's generated stream starts at its beginning. `invalid` for a negative or non-finite time; sent only when above 0.
12
+ - **`MainWindow.setMaximized(boolean)`**, **`MainWindow.setMinimized(boolean)`** (`window.setMaximized`, `window.setMinimized`): maximize or restore (`unavailable` in fullscreen), minimize or bring back. No `minimized` field in `WindowState` (not reported by the player yet).
13
+ - **TestHost**: answers the new requests with the player's checks and codes; `mainWindow.minimized` records `setMinimized` (`maximized` follows `setMaximized`); `osd.show` checks `durationMs`; an open checks `start`.
14
+ - **Docs**: Limits (`OSD_LIMITS`) and Messages tables. The API surface snapshot gains the members above.
15
+
3
16
  ## 1.11.5
4
17
 
5
18
  **Apple motion smoothing** (request R1; needs the first player release with the Apple engine, 0.11.12 or later). An addition only: **nobody must change anything**; a plugin that does not use `"apple"` behaves as before. Used by Apple Motion Smoothing (`zysilm.applemotion`); also for any plugin that offers motion smoothing on macOS (a picture panel's smoothing switch, a per-file profile plugin that turns smoothing on for low-rate video).
@@ -43,6 +43,7 @@ export const API_REQUESTS = Object.freeze({
43
43
  "Player.previous": [{ method: "sequence.step" }],
44
44
  "Player.addAudioTrack": [{ method: "audio.addTrack" }],
45
45
  "Player.selectAudioTrack": [{ method: "audio.selectTrack" }],
46
+ "Player.seekSubtitle": [{ method: "player.seekSubtitle" }],
46
47
  "Player.step": [{ method: "player.step" }],
47
48
  "Player.setStepSeek": [{ method: "player.setStepSeek" }],
48
49
  "Player.setLoop": [{ method: "player.setLoop" }],
@@ -76,6 +77,8 @@ export const API_REQUESTS = Object.freeze({
76
77
  "MainWindow.setPictureInPicture": [
77
78
  { method: "window.setPictureInPicture" },
78
79
  ],
80
+ "MainWindow.setMaximized": [{ method: "window.setMaximized" }],
81
+ "MainWindow.setMinimized": [{ method: "window.setMinimized" }],
79
82
  "Appearance.set": [{ method: "appearance.set" }],
80
83
  "Appearance.setLanguage": [{ method: "appearance.setLanguage" }],
81
84
  "Drops.provide": [{ method: "drops.provide" }],
Binary file
@@ -50,6 +50,10 @@ export declare const OSD_LIMITS: Readonly<{
50
50
  readonly actions: 2;
51
51
  /** Characters of an action's title, as shown (40; at least 1 that is not white space). */
52
52
  readonly actionChars: 40;
53
+ /** The shortest `OsdShowOptions.durationMs`, milliseconds (500). */
54
+ readonly minDurationMs: 500;
55
+ /** The longest `OsdShowOptions.durationMs`, milliseconds (30,000). */
56
+ readonly maxDurationMs: 30000;
53
57
  }>;
54
58
  /**
55
59
  * Copy and check template arguments: an array or object of at most 16
@@ -51,7 +51,25 @@ export const OSD_LIMITS = Object.freeze({
51
51
  actions: 2,
52
52
  /** Characters of an action's title, as shown (40; at least 1 that is not white space). */
53
53
  actionChars: 40,
54
+ /** The shortest `OsdShowOptions.durationMs`, milliseconds (500). */
55
+ minDurationMs: 500,
56
+ /** The longest `OsdShowOptions.durationMs`, milliseconds (30,000). */
57
+ maxDurationMs: 30_000,
54
58
  });
59
+ /** Check `OsdShowOptions.durationMs`: an integer of milliseconds within `OSD_LIMITS`. */
60
+ function osdDuration(options) {
61
+ if (options === undefined || options === null || typeof options !== "object")
62
+ return undefined;
63
+ const ms = options.durationMs;
64
+ if (ms === undefined)
65
+ return undefined;
66
+ if (typeof ms !== "number" ||
67
+ !Number.isInteger(ms) ||
68
+ ms < OSD_LIMITS.minDurationMs ||
69
+ ms > OSD_LIMITS.maxDurationMs)
70
+ throw failure("invalid", `durationMs is an integer from ${OSD_LIMITS.minDurationMs} to ${OSD_LIMITS.maxDurationMs}`);
71
+ return ms;
72
+ }
55
73
  /** Copy and check `OsdShowOptions.actions`: what the SDK can check before the player does. */
56
74
  function osdActions(options) {
57
75
  if (options === undefined || options === null)
@@ -159,6 +177,6 @@ class PanelHandle {
159
177
  }
160
178
  }
161
179
  export const osd = (scope) => ({
162
- show: async (text, args, options) => scope.runtime.host.osd.show(shownText(text, args), templateArgs(args), osdActions(options)),
180
+ show: async (text, args, options) => scope.runtime.host.osd.show(shownText(text, args), templateArgs(args), osdActions(options), osdDuration(options)),
163
181
  panel: () => new PanelHandle(scope),
164
182
  });
@@ -798,9 +798,11 @@ export function player(scope) {
798
798
  return !!raw && sameStamp(raw.stamp, service().raw.stamp);
799
799
  },
800
800
  async open(source, options = {}) {
801
- const { signal } = options;
801
+ const { signal, start } = options;
802
802
  if (signal?.aborted)
803
803
  throw abortError();
804
+ if (start !== undefined && !(Number.isFinite(start) && start >= 0))
805
+ throw failure("invalid", "start must be a finite number of seconds, 0 or more");
804
806
  let ticket;
805
807
  try {
806
808
  // In its turn: after a read on its way for earlier controls.
@@ -808,6 +810,7 @@ export function player(scope) {
808
810
  kind: "open",
809
811
  source,
810
812
  startPaused: options.paused ?? false,
813
+ ...(start ? { start } : {}),
811
814
  ...(options.ifCurrent
812
815
  ? service().expected(options.ifCurrent)
813
816
  : {}),
@@ -942,5 +945,10 @@ export function player(scope) {
942
945
  await service().withStamp(options.ifCurrent, ({ expected }) => scope.runtime.host.audio.select(id, expected));
943
946
  return service().refresh();
944
947
  },
948
+ async seekSubtitle(direction, options = {}) {
949
+ if (!["next", "previous", "current"].includes(direction))
950
+ throw failure("invalid", 'direction is "next", "previous" or "current"');
951
+ await service().withStamp(options.ifCurrent, ({ expected }) => scope.runtime.host.step.seekSubtitle(direction, expected));
952
+ },
945
953
  };
946
954
  }
@@ -343,6 +343,17 @@ export function coreActionsHandlers(host, inner) {
343
343
  host.stepSeek = p.seconds;
344
344
  host.stepSeekKeyframes = p.keyframes === true;
345
345
  },
346
+ // Player 0.11.13: mpv's `sub-seek`. The test host has no cues: it
347
+ // checks what the player checks and records the request (`sent`).
348
+ "player.seekSubtitle": (p) => {
349
+ if (!["next", "previous", "current"].includes(String(p.direction)))
350
+ throw new HostError("invalid", "direction is next, previous or current");
351
+ audioCondition(host, inner, p.expected);
352
+ if (!host.source.capabilities.seek)
353
+ throw new HostError("unsupported", hostText(host, inner, "Not supported by the current source"));
354
+ if (!host.subtitles.selection.target)
355
+ throw new HostError("unavailable", "no subtitle track is selected");
356
+ },
346
357
  "player.step": (p) => {
347
358
  audioCondition(host, inner, p.expected);
348
359
  const s = host.source;
@@ -1913,8 +1913,9 @@ export declare class TestHost implements Transport {
1913
1913
  /**
1914
1914
  * The main window as the player would show it. Change it with
1915
1915
  * `setMainWindow` (the user resized or maximized it, entered fullscreen,
1916
- * closed the picture-in-picture window); `onTop`, `cursorAutoHide` and
1917
- * `pictureInPicture.active` record the plugin's `window.set…` calls.
1916
+ * closed the picture-in-picture window); `onTop`, `cursorAutoHide`,
1917
+ * `pictureInPicture.active`, `maximized` and `minimized` record
1918
+ * the plugin's `window.set…` calls.
1918
1919
  * `pictureInPicture.supported: false` stands for Windows and Linux.
1919
1920
  */
1920
1921
  readonly mainWindow: {
@@ -1939,6 +1940,13 @@ export declare class TestHost implements Transport {
1939
1940
  onTop: boolean;
1940
1941
  /** The effective `window.setCursorAutoHide` mode. */
1941
1942
  cursorAutoHide: "fullscreen" | "playing";
1943
+ /**
1944
+ * Whether `window.setMinimized` minimized the main window (default
1945
+ * `false`).
1946
+ *
1947
+ * @since 1.11.6
1948
+ */
1949
+ minimized: boolean;
1942
1950
  /** Picture-in-picture: `supported` (preset) and `active`. */
1943
1951
  pictureInPicture: {
1944
1952
  /** Set to `false` to simulate Windows or Linux. */
@@ -1419,8 +1419,9 @@ export class TestHost {
1419
1419
  /**
1420
1420
  * The main window as the player would show it. Change it with
1421
1421
  * `setMainWindow` (the user resized or maximized it, entered fullscreen,
1422
- * closed the picture-in-picture window); `onTop`, `cursorAutoHide` and
1423
- * `pictureInPicture.active` record the plugin's `window.set…` calls.
1422
+ * closed the picture-in-picture window); `onTop`, `cursorAutoHide`,
1423
+ * `pictureInPicture.active`, `maximized` and `minimized` record
1424
+ * the plugin's `window.set…` calls.
1424
1425
  * `pictureInPicture.supported: false` stands for Windows and Linux.
1425
1426
  */
1426
1427
  mainWindow = {
@@ -1445,6 +1446,13 @@ export class TestHost {
1445
1446
  onTop: false,
1446
1447
  /** The effective `window.setCursorAutoHide` mode. */
1447
1448
  cursorAutoHide: "fullscreen",
1449
+ /**
1450
+ * Whether `window.setMinimized` minimized the main window (default
1451
+ * `false`).
1452
+ *
1453
+ * @since 1.11.6
1454
+ */
1455
+ minimized: false,
1448
1456
  /** Picture-in-picture: `supported` (preset) and `active`. */
1449
1457
  pictureInPicture: {
1450
1458
  /** Set to `false` to simulate Windows or Linux. */
@@ -86,6 +86,12 @@ export function sourceIntent(host, inner, intent) {
86
86
  eventSequence: host.source.eventSequence + 1,
87
87
  };
88
88
  if (intent.kind === "open" || intent.kind === "openProvider") {
89
+ // Player 0.11.13: mpv's per-file `start`, seconds.
90
+ if (intent.start !== undefined &&
91
+ !(typeof intent.start === "number" &&
92
+ Number.isFinite(intent.start) &&
93
+ intent.start >= 0))
94
+ throw new HostError("invalid", "start must be a finite number >= 0");
89
95
  next.stamp.generation++;
90
96
  next.cycle++;
91
97
  next.kind = intent.kind === "open" ? "media" : "producer";
@@ -30,6 +30,13 @@ export function osdHandlers(host, inner) {
30
30
  throw new HostError("invalid", `${command} is not a command of this plugin`);
31
31
  return { title, command };
32
32
  });
33
+ // Player 0.11.13: how long it stays, an integer of milliseconds.
34
+ const ms = p.durationMs;
35
+ if (ms !== undefined &&
36
+ !(Number.isInteger(ms) &&
37
+ Number(ms) >= OSD_LIMITS.minDurationMs &&
38
+ Number(ms) <= OSD_LIMITS.maxDurationMs))
39
+ throw new HostError("invalid", `durationMs is an integer from ${OSD_LIMITS.minDurationMs} to ${OSD_LIMITS.maxDurationMs}`);
33
40
  host.osd.push(text);
34
41
  host.osdActions.push(actions);
35
42
  },
@@ -349,6 +349,18 @@ export function servicesHandlers(host, inner) {
349
349
  return { width, height, clamped };
350
350
  },
351
351
  "window.setAlwaysOnTop": (p) => void (host.mainWindow.onTop = p.onTop === true),
352
+ "window.setMaximized": (p) => {
353
+ if (typeof p.maximized !== "boolean")
354
+ throw new HostError("invalid", "maximized requires a boolean");
355
+ if (host.mainWindow.fullscreen)
356
+ throw new HostError("unavailable", hostText(host, inner, "Not available in fullscreen"));
357
+ host.setMainWindow({ maximized: p.maximized });
358
+ },
359
+ "window.setMinimized": (p) => {
360
+ if (typeof p.minimized !== "boolean")
361
+ throw new HostError("invalid", "minimized requires a boolean");
362
+ host.mainWindow.minimized = p.minimized;
363
+ },
352
364
  "window.setCursorAutoHide": (p) => {
353
365
  if (p.mode !== "fullscreen" && p.mode !== "playing")
354
366
  throw new HostError("invalid", "mode is fullscreen or playing");
@@ -991,6 +991,53 @@ export interface MainWindow {
991
991
  * @since 1.0.0
992
992
  */
993
993
  setPictureInPicture(on: boolean): Promise<void>;
994
+ /**
995
+ * Maximize the main window (`true`) or restore it (`false`), as its title
996
+ * bar's button does; `state.maximized` follows. Resolves once the player
997
+ * asked the system.
998
+ *
999
+ * @throws `invalid` (rejects) `maximized` is not a boolean.
1000
+ * @throws `unavailable` (rejects) Fullscreen, or no user interface.
1001
+ *
1002
+ * @example Maximize the window for a wide video
1003
+ * A plugin maximizes the window when a cinema-wide video starts, unless the
1004
+ * user is in fullscreen (where it is refused) or it is maximized already.
1005
+ * ```ts
1006
+ * const { fullscreen, maximized } = plugin.window.state;
1007
+ * if (!fullscreen && !maximized) await plugin.window.setMaximized(true);
1008
+ * ```
1009
+ *
1010
+ * @player 0.11.13
1011
+ * @since 1.11.6
1012
+ */
1013
+ setMaximized(maximized: boolean): Promise<void>;
1014
+ /**
1015
+ * Minimize the main window to the taskbar or Dock (`true`), or bring it
1016
+ * back (`false`). Resolves once the player asked the system. Minimizing
1017
+ * does not pause; a plugin that wants that pauses itself.
1018
+ *
1019
+ * @throws `invalid` (rejects) `minimized` is not a boolean.
1020
+ * @throws `unavailable` (rejects) No user interface.
1021
+ *
1022
+ * @example Hide the player with a boss key
1023
+ * One key pauses playback and minimizes the window. The pause goes first,
1024
+ * so nothing plays while the window is out of sight.
1025
+ * ```ts
1026
+ * plugin.commands.add({
1027
+ * id: "boss-key",
1028
+ * title: "Pause and Minimize",
1029
+ * bindings: ["Ctrl+Shift+B"],
1030
+ * run: async () => {
1031
+ * await plugin.player.setPaused(true); // first: nothing plays unseen
1032
+ * await plugin.window.setMinimized(true); // to the taskbar or Dock
1033
+ * },
1034
+ * });
1035
+ * ```
1036
+ *
1037
+ * @player 0.11.13
1038
+ * @since 1.11.6
1039
+ */
1040
+ setMinimized(minimized: boolean): Promise<void>;
994
1041
  }
995
1042
  /**
996
1043
  * `plugin.app`: fixed for the life of the plugin process.
@@ -4,6 +4,7 @@ import type { MediaCapture } from "./snapshots.ts";
4
4
  import type { FileResolverOptions, Resolver } from "./sources.ts";
5
5
  import type { View } from "./ui-content.ts";
6
6
  import type { App, Scope } from "./base.ts";
7
+ import type { Subtitles } from "./subtitles.ts";
7
8
  import type { Disposable, PluginError, WindowState } from "./base.ts";
8
9
  import type { SubtitlesState } from "./subtitles.ts";
9
10
  import type { LayoutPosition } from "./ui-layout.ts";
@@ -1277,6 +1278,7 @@ export interface Player {
1277
1278
  * returned (for example split streams with different headers).
1278
1279
  * @throws `unavailable` (rejects) The stream a file resolver prepared was
1279
1280
  * not ready to play.
1281
+ * @throws `invalid` (rejects) `start` is negative or not finite.
1280
1282
  *
1281
1283
  * @example Open a file paused
1282
1284
  * The file opens at its start without playing. `open` resolves once the
@@ -1288,11 +1290,33 @@ export interface Player {
1288
1290
  * await media.ready(); // rejects `failed` when the file cannot be loaded
1289
1291
  * ```
1290
1292
  *
1293
+ * @example Resume a file where the user left it
1294
+ * The file opens at 12:34 and plays from there, with no frame of its
1295
+ * start shown first. `start` is mpv's per-file `start` option: the player
1296
+ * loads the file at that time instead of seeking once it has loaded.
1297
+ * ```ts
1298
+ * const media = await plugin.player.open("/Movies/film.mkv", { start: 754 }); // seconds
1299
+ * await media.ready();
1300
+ * ```
1301
+ *
1291
1302
  * @since 1.0.0
1292
1303
  */
1293
1304
  open(source: string, options?: {
1294
1305
  paused?: boolean;
1295
1306
  signal?: AbortSignal;
1307
+ /**
1308
+ * Start here, in seconds from the media's start (0 or more; `0` or
1309
+ * omitted: the beginning). The player loads the file at this time, so
1310
+ * no frame of its start shows first (mpv's per-file `start`); a time
1311
+ * past the end opens it at its end. Also for an address a
1312
+ * {@link Resolver} resolves; a stream a file resolver generates
1313
+ * ({@link FileResolverOptions}) starts at its beginning. Players
1314
+ * before 0.11.13 ignore it.
1315
+ *
1316
+ * @player 0.11.13
1317
+ * @since 1.11.6
1318
+ */
1319
+ start?: number;
1296
1320
  } & Conditional): Promise<Media>;
1297
1321
  /**
1298
1322
  * Start a source whose frames this plugin generates (the stream becomes
@@ -1661,6 +1685,52 @@ export interface Player {
1661
1685
  * @since 1.0.0
1662
1686
  */
1663
1687
  selectAudioTrack(id: number, options?: Conditional): Promise<PlayerState>;
1688
+ /**
1689
+ * Jump to the start of the next or previous subtitle line, or of the line
1690
+ * on screen (`"current"`), of the selected primary subtitle track; mpv's
1691
+ * `sub-seek`. Resolves once the player asked for the seek;
1692
+ * `state.position` follows when it has landed. Where there is no such line
1693
+ * (after the last one, or before the first) nothing moves.
1694
+ *
1695
+ * @remarks
1696
+ * The player knows the lines it has read: all of a subtitle file (loaded
1697
+ * with {@link Subtitles.load} or beside the video), but of a track inside
1698
+ * the video only the lines up to what was played or buffered, so a jump
1699
+ * forward in an embedded track can find nothing yet.
1700
+ *
1701
+ * @throws `invalid` (rejects) `direction` is not `"next"`, `"previous"` or
1702
+ * `"current"`.
1703
+ * @throws `unavailable` (rejects) No ready media, or no subtitle track is
1704
+ * selected.
1705
+ * @throws `unsupported` (rejects) The source cannot seek, or is a
1706
+ * generated stream.
1707
+ * @throws `stale` (rejects) The source changed since the state the call is
1708
+ * based on (another file, a close, or any pause, seek
1709
+ * or speed change by the user or another plugin).
1710
+ *
1711
+ * @example Repeat the line on screen
1712
+ * A language-learning plugin's key plays the subtitle line on screen again
1713
+ * from its start, and another goes to the next line. `seekSubtitle` uses
1714
+ * the selected subtitle's own timing, so the plugin needs no cue list.
1715
+ * ```ts
1716
+ * plugin.commands.add({
1717
+ * id: "repeat-line",
1718
+ * title: "Repeat Subtitle Line",
1719
+ * bindings: ["Ctrl+R"],
1720
+ * run: () => plugin.player.seekSubtitle("current"), // the line on screen, from its start
1721
+ * });
1722
+ * plugin.commands.add({
1723
+ * id: "next-line",
1724
+ * title: "Next Subtitle Line",
1725
+ * bindings: ["Ctrl+Right"],
1726
+ * run: () => plugin.player.seekSubtitle("next"), // nothing moves after the last line
1727
+ * });
1728
+ * ```
1729
+ *
1730
+ * @player 0.11.13
1731
+ * @since 1.11.6
1732
+ */
1733
+ seekSubtitle(direction: "next" | "previous" | "current", options?: Conditional): Promise<void>;
1664
1734
  /**
1665
1735
  * One frame or to the next / previous keyframe (pauses for frames). Rejects
1666
1736
  * `unsupported` without moving video (audio only, cover art, a generated
@@ -914,7 +914,8 @@ export interface OsdPanelOptions {
914
914
  */
915
915
  export interface Osd {
916
916
  /**
917
- * Show a one-line message at the top left of the video for 2 seconds.
917
+ * Show a one-line message at the top left of the video for 2 seconds (or
918
+ * `options.durationMs`).
918
919
  *
919
920
  * @remarks
920
921
  * Replaces the message on screen, whichever plugin showed it. A message
@@ -937,13 +938,14 @@ export interface Osd {
937
938
  *
938
939
  * @param args - Values for its placeholders. Pass `null` with a `Text` and
939
940
  * options.
940
- * @param options - Action buttons after the text.
941
+ * @param options - Action buttons after the text, and how long it stays.
941
942
  * @returns Resolves once the message is on screen.
942
943
  *
943
944
  * @throws `invalid` (rejects) The shown text is empty, only white space,
944
945
  * or longer than 200 characters, or `args` is not a {@link TemplateArgs};
945
946
  * or there are more than 2 actions, a title is empty or longer than 40
946
- * characters once translated, or a command is not one of the plugin's.
947
+ * characters once translated, or a command is not one of the plugin's;
948
+ * or `durationMs` is not an integer from 500 to 30,000.
947
949
  * @throws `unavailable` (rejects) The player runs without a user interface.
948
950
  *
949
951
  * @example Confirm an action and show a value
@@ -975,6 +977,16 @@ export interface Osd {
975
977
  * });
976
978
  * ```
977
979
  *
980
+ * @example Keep a long message on screen longer
981
+ * A message the user needs time to read stays 6 seconds instead of 2.
982
+ * `durationMs` sets how long the player shows it; a newer message, from
983
+ * any plugin, still replaces it at once.
984
+ * ```ts
985
+ * await plugin.osd.show("Subtitles shifted by {} ms to match the audio", [250], {
986
+ * durationMs: 6000, // milliseconds, 500–30,000
987
+ * });
988
+ * ```
989
+ *
978
990
  * @since 1.0.0
979
991
  */
980
992
  show(text: TextValue, args?: TemplateArgs | null, options?: OsdShowOptions): Promise<void>;
@@ -1049,4 +1061,16 @@ export interface OsdAction {
1049
1061
  export interface OsdShowOptions {
1050
1062
  /** At most 2 buttons (`OSD_LIMITS.actions`), in order after the text. */
1051
1063
  actions?: readonly OsdAction[];
1064
+ /**
1065
+ * How long the message stays, in milliseconds: an integer from 500 to
1066
+ * 30,000 (`OSD_LIMITS.minDurationMs`, `maxDurationMs`); omitted: 2
1067
+ * seconds, or about 4 with actions (mpv's `show-text` duration). A message
1068
+ * with actions is still held while the pointer is on it, at most 30
1069
+ * seconds after it showed. A newer message replaces it earlier. Players
1070
+ * before 0.11.13 ignore it.
1071
+ *
1072
+ * @player 0.11.13
1073
+ * @since 1.11.6
1074
+ */
1075
+ durationMs?: number;
1052
1076
  }
@@ -159,5 +159,15 @@ export function mainWindow(scope) {
159
159
  await host().setPictureInPicture(on);
160
160
  await service().read();
161
161
  },
162
+ async setMaximized(maximized) {
163
+ if (typeof maximized !== "boolean")
164
+ throw failure("invalid", "maximized must be a boolean");
165
+ await host().setMaximized(maximized);
166
+ },
167
+ async setMinimized(minimized) {
168
+ if (typeof minimized !== "boolean")
169
+ throw failure("invalid", "minimized must be a boolean");
170
+ await host().setMinimized(minimized);
171
+ },
162
172
  };
163
173
  }
package/dist/source.d.ts CHANGED
@@ -18,6 +18,8 @@ export type SourceIntent = {
18
18
  kind: "open";
19
19
  source: string;
20
20
  startPaused: boolean;
21
+ /** mpv's per-file `start`, seconds (player 0.11.13); sent only when above 0. */
22
+ start?: number;
21
23
  expected?: SourceStamp;
22
24
  } | {
23
25
  kind: "restart" | "close";
package/dist/wire.d.ts CHANGED
@@ -758,7 +758,7 @@ export declare function createWire(transport: Transport): {
758
758
  checked: boolean;
759
759
  }>;
760
760
  };
761
- /** The main window: its state, size, level, pointer hiding and picture-in-picture. */
761
+ /** The main window: its state, size, level, pointer hiding, picture-in-picture, maximized and minimized. */
762
762
  window: {
763
763
  state: () => Promise<WindowFacts>;
764
764
  setVideoArea: (width: number, height: number) => Promise<{
@@ -769,6 +769,8 @@ export declare function createWire(transport: Transport): {
769
769
  setAlwaysOnTop: (onTop: boolean) => Promise<void>;
770
770
  setCursorAutoHide: (mode: "fullscreen" | "playing") => Promise<void>;
771
771
  setPictureInPicture: (on: boolean) => Promise<void>;
772
+ setMaximized: (maximized: boolean) => Promise<void>;
773
+ setMinimized: (minimized: boolean) => Promise<void>;
772
774
  };
773
775
  /** Output devices (mpv ids) and the one to play on. */
774
776
  audioOutput: {
@@ -904,6 +906,8 @@ export declare function createWire(transport: Transport): {
904
906
  step: {
905
907
  step: (unit: string, direction: string, expected?: SourceStamp) => Promise<void>;
906
908
  setStepSeek: (seconds: number, keyframes?: boolean) => Promise<void>;
909
+ /** mpv's `sub-seek`: `next`, `previous` or `current` line. */
910
+ seekSubtitle: (direction: string, expected?: SourceStamp) => Promise<void>;
907
911
  };
908
912
  clipboard: {
909
913
  readText: () => Promise<string | null>;
@@ -994,7 +998,7 @@ export declare function createWire(transport: Transport): {
994
998
  show: (text: TextValueJson, args?: TemplateArgsJson, actions?: {
995
999
  title: TextValueJson;
996
1000
  command: string;
997
- }[]) => Promise<void>;
1001
+ }[], durationMs?: number) => Promise<void>;
998
1002
  panel: (text: TextValueJson | null, args?: TemplateArgsJson, maxColumns?: number) => Promise<void>;
999
1003
  };
1000
1004
  layout: {
package/dist/wire.js CHANGED
@@ -96,13 +96,15 @@ export function createWire(transport) {
96
96
  /** Message and detail are templates formatted with `args`. */
97
97
  confirm: (options) => transport.request("dialogs.confirm", options),
98
98
  },
99
- /** The main window: its state, size, level, pointer hiding and picture-in-picture. */
99
+ /** The main window: its state, size, level, pointer hiding, picture-in-picture, maximized and minimized. */
100
100
  window: {
101
101
  state: () => transport.request("window.state"),
102
102
  setVideoArea: (width, height) => transport.request("window.setVideoArea", { width, height }),
103
103
  setAlwaysOnTop: (onTop) => transport.request("window.setAlwaysOnTop", { onTop }),
104
104
  setCursorAutoHide: (mode) => transport.request("window.setCursorAutoHide", { mode }),
105
105
  setPictureInPicture: (on) => transport.request("window.setPictureInPicture", { on }),
106
+ setMaximized: (maximized) => transport.request("window.setMaximized", { maximized }),
107
+ setMinimized: (minimized) => transport.request("window.setMinimized", { minimized }),
106
108
  },
107
109
  /** Output devices (mpv ids) and the one to play on. */
108
110
  audioOutput: {
@@ -209,6 +211,11 @@ export function createWire(transport) {
209
211
  ...(expected ? { expected } : {}),
210
212
  }),
211
213
  setStepSeek: (seconds, keyframes) => transport.request("player.setStepSeek", keyframes === undefined ? { seconds } : { seconds, keyframes }),
214
+ /** mpv's `sub-seek`: `next`, `previous` or `current` line. */
215
+ seekSubtitle: (direction, expected) => transport.request("player.seekSubtitle", {
216
+ direction,
217
+ ...(expected ? { expected } : {}),
218
+ }),
212
219
  },
213
220
  clipboard: {
214
221
  readText: () => transport.request("clipboard.readText"),
@@ -283,11 +290,12 @@ export function createWire(transport) {
283
290
  },
284
291
  /** `text` is a template in the plugin's catalog, formatted with `args`. */
285
292
  osd: {
286
- show: (text, args, actions) => transport.request("osd.show", {
293
+ show: (text, args, actions, durationMs) => transport.request("osd.show", {
287
294
  text,
288
295
  ...(args === undefined ? {} : { args }),
289
296
  // Sent only when given.
290
297
  ...(actions === undefined ? {} : { actions }),
298
+ ...(durationMs === undefined ? {} : { durationMs }),
291
299
  }),
292
300
  panel: (text, args, maxColumns) => transport.request("osd.panel", {
293
301
  text,
package/llms.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  # Vestra Player SDK
2
2
 
3
- > @vestra-player/sdk 1.11.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/.
3
+ > @vestra-player/sdk 1.11.6: 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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vestra-player/sdk",
3
- "version": "1.11.5",
3
+ "version": "1.11.6",
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": {