@vestra-player/sdk 1.11.0-rc.2 → 1.11.0-rc.3

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
@@ -10,7 +10,7 @@
10
10
  - **The copies take a fact first** (1.11.0-rc.2 adds the last two): `subtitles.changed` into `plugin.subtitles.state`, `window.changed` into `plugin.window.state`, `layout.changed` into the panel layout, `audio.tracks.changed` into `plugin.player.state.audioTracks` (when it is the copy's source) and `audio.devices.changed` into `plugin.player.state.audioOutput`, so the copy holds it when the listener runs and a binding that reads it runs again.
11
11
  - Removed `Player.subscribe()` and `Player.onChange()`.
12
12
  - **An event reaches a plugin from its first listener.** `source.state`, `playback.backend`, `window.state`, `timeline.changed`, `appearance.changed` and `resolvers.fileTypes` are subscribed while a listener, a watcher (`MainWindow.onChange`, a panel slot's `onChange`, `Subtitles.onChange`, a media handle's `ready` and `onEnd`, a scrub) or a stream holds them; the SDK's own copy and a binding's read never subscribe them on their own, so a bound value or a command state that reads `plugin.player.state` shows the newest snapshot the plugin has. `Media.ready` no longer polls the state every 100 ms.
13
- - **No request after `runtime.stop`**: once the player sent `runtime.stop`, every request of the plugin is refused with `disabled` and not sent, the plugin's own cleanup included (the player's runner refused them already). In `TestHost` the cleanup requests at a plugin's stop (and at `park()` and `upgrade()`) are therefore no longer sent, and the test host revokes what the run held itself, as the player does: its windows, panels, commands, settings pages, resolvers, sequence provider, streams and filter chains.
13
+ - **No request after `runtime.stop`**: once the player sent `runtime.stop`, every request of the plugin is refused with `disabled` and not sent, the plugin's own cleanup included (the player's runner refused them already). In `TestHost` the cleanup requests at a plugin's stop (and at `park()` and `upgrade()`) are therefore no longer sent, and the test host revokes what the run held itself, as the player does (1.11.0-rc.3 matches each kind of stop): at every stop its windows, panels, commands, settings pages, resolvers, sequence provider, streams, filter chains, display layer, render options and shaders; its timeline layer, always-on-top and cursor settings stay through `park()` (an idle stop) and go at every other stop (disable, a fault, uninstall, reload, `upgrade()`, quit, or `stop()` without a reason).
14
14
  - **`TestHost`** sends the fact events by the player's rules: `audio.tracks.changed` after a source change, `window.changed` and `layout.changed` after a `window.state`, `subtitles.changed` and `audio.devices.changed` after a request or an event changed them, and `video.reconfigured` and `audio.reconfigured` from `host.stats` when a source becomes ready. `app.started` is sent with `host.emit`.
15
15
 
16
16
  **No capability disclosure:**
Binary file
@@ -1830,7 +1830,7 @@ export class TestHost {
1830
1830
  * pass it to {@link startPlugin} as `host`.
1831
1831
  */
1832
1832
  constructor() {
1833
- revokers.set(this, () => this.#revoke());
1833
+ revokers.set(this, (reason) => this.#revoke(reason));
1834
1834
  this.subtitles = {
1835
1835
  presentation: {
1836
1836
  revision: 1,
@@ -2929,7 +2929,7 @@ export class TestHost {
2929
2929
  return upgrade(this, this.#inner, activate);
2930
2930
  }
2931
2931
  /** See {@link revokeRun}: each through the host's own handler. */
2932
- #revoke() {
2932
+ #revoke(reason) {
2933
2933
  const run = (method, params) => {
2934
2934
  try {
2935
2935
  void Promise.resolve(this.#defaults[method]?.(params)).catch(() => { });
@@ -2953,8 +2953,28 @@ export class TestHost {
2953
2953
  for (const [producerId, producer] of this.producers)
2954
2954
  if (!producer.released)
2955
2955
  run("producer.release", { producerId });
2956
- // Its processing chains (filters) are withdrawn.
2956
+ // The playback worker's part (`owner.parked` and `owner.disabled`
2957
+ // alike): its filter chains, display layer, render options, shaders.
2957
2958
  this.processing.resources.clear();
2959
+ if (this.videoView.owner === this.manifestId)
2960
+ run("video.view.release", {});
2961
+ if (this.videoRender.owner === this.manifestId)
2962
+ run("video.render.release", {});
2963
+ this.videoShaders.handles.clear();
2964
+ // Kept through a standby, removed at every other stop (the player's
2965
+ // `keeps_shown_state`: an idle stop only).
2966
+ if (reason === "idle")
2967
+ return;
2968
+ const id = this.manifestId;
2969
+ const marks = this.timeline.layers.delete(id);
2970
+ const ranges = this.timeline.rangeLayers.delete(id);
2971
+ if (marks || ranges)
2972
+ this.emit("timeline.changed", {
2973
+ marks: this.timeline.marks,
2974
+ ranges: this.timeline.ranges,
2975
+ });
2976
+ this.mainWindow.onTop = false;
2977
+ this.mainWindow.cursorAutoHide = "fullscreen";
2958
2978
  }
2959
2979
  #defaults = {
2960
2980
  ...triggersHandlers(this, this.#inner),
@@ -3112,7 +3132,7 @@ export async function startPlugin(activate, options = {}) {
3112
3132
  await instance.dispose({ reason });
3113
3133
  await host.settle();
3114
3134
  // Standby and an upgrade stop the run: the player revokes what it held.
3115
- revokeRun(host);
3135
+ revokeRun(host, reason);
3116
3136
  await host.settle();
3117
3137
  };
3118
3138
  await host.settle();
@@ -3136,7 +3156,7 @@ export async function startPlugin(activate, options = {}) {
3136
3156
  if (!triggers.parked)
3137
3157
  await instance.dispose({ reason });
3138
3158
  await host.settle();
3139
- revokeRun(host);
3159
+ revokeRun(host, typeof reason === "string" ? reason : undefined);
3140
3160
  await host.settle();
3141
3161
  host.close();
3142
3162
  };
@@ -3164,7 +3184,7 @@ export async function startPlugin(activate, options = {}) {
3164
3184
  host.loseConnection();
3165
3185
  await instance.dispose({ reason: "host-lost" });
3166
3186
  await host.settle();
3167
- revokeRun(host);
3187
+ revokeRun(host, "host-lost");
3168
3188
  await host.settle();
3169
3189
  host.close();
3170
3190
  },
@@ -6,10 +6,17 @@ import type { TestHost } from "./index.ts";
6
6
  * What the player undoes by itself when a plugin's run stops (SDK 1.11.0):
7
7
  * the plugin's own cleanup requests are not sent after `runtime.stop`
8
8
  * (`RequestQueue.close`), so the test host revokes what the run held, as
9
- * the player does (its stop revokes the run's windows, panels, commands,
10
- * settings pages, resolvers, sequence provider, streams and filter
11
- * chains). By host.
9
+ * the player does at every stop (`host/lifecycle.rs` `stop_run` and the
10
+ * playback worker's `owner.parked` / `owner.disabled`): the run's windows,
11
+ * panels, commands, settings pages, resolvers, sequence provider, streams,
12
+ * filter chains, display layer, render options and shaders. Its timeline
13
+ * layer, always-on-top and cursor settings stay through a standby (an idle
14
+ * stop, `keeps_shown_state`) and go at every other stop: disable, a
15
+ * fault, uninstall, reload, upgrade, quit. By host.
12
16
  */
13
- export declare const revokers: WeakMap<TestHost, () => void>;
14
- /** Revoke what the plugin's run held (`startPlugin`'s `stop`). */
15
- export declare function revokeRun(host: TestHost): void;
17
+ export declare const revokers: WeakMap<TestHost, (reason?: string) => void>;
18
+ /**
19
+ * Revoke what the plugin's run held, for a stop with `reason`
20
+ * (`startPlugin`'s `stop`, `park()` with `idle`, `upgrade()`).
21
+ */
22
+ export declare function revokeRun(host: TestHost, reason?: string): void;
@@ -2,12 +2,19 @@
2
2
  * What the player undoes by itself when a plugin's run stops (SDK 1.11.0):
3
3
  * the plugin's own cleanup requests are not sent after `runtime.stop`
4
4
  * (`RequestQueue.close`), so the test host revokes what the run held, as
5
- * the player does (its stop revokes the run's windows, panels, commands,
6
- * settings pages, resolvers, sequence provider, streams and filter
7
- * chains). By host.
5
+ * the player does at every stop (`host/lifecycle.rs` `stop_run` and the
6
+ * playback worker's `owner.parked` / `owner.disabled`): the run's windows,
7
+ * panels, commands, settings pages, resolvers, sequence provider, streams,
8
+ * filter chains, display layer, render options and shaders. Its timeline
9
+ * layer, always-on-top and cursor settings stay through a standby (an idle
10
+ * stop, `keeps_shown_state`) and go at every other stop: disable, a
11
+ * fault, uninstall, reload, upgrade, quit. By host.
8
12
  */
9
13
  export const revokers = new WeakMap();
10
- /** Revoke what the plugin's run held (`startPlugin`'s `stop`). */
11
- export function revokeRun(host) {
12
- revokers.get(host)?.();
14
+ /**
15
+ * Revoke what the plugin's run held, for a stop with `reason`
16
+ * (`startPlugin`'s `stop`, `park()` with `idle`, `upgrade()`).
17
+ */
18
+ export function revokeRun(host, reason) {
19
+ revokers.get(host)?.(reason);
13
20
  }
package/llms.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  # Vestra Player SDK
2
2
 
3
- > @vestra-player/sdk 1.11.0-rc.2: 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.0-rc.3: 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.0-rc.2",
3
+ "version": "1.11.0-rc.3",
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": {