@vestra-player/sdk 1.11.2 → 1.11.4

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,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.11.4
4
+
5
+ Nobody must change anything. **Product data**: `BUILTIN_COMMANDS` lists `vestra.window/pip` as Tools ▸ Picture-in-Picture (player 0.11.8, user ruling 2026-11-27; it was palette only), and so does the built-in command table in [Commands](docs/reference/commands.md). It is registered only where the system has picture-in-picture (macOS 14+). No API change.
6
+
7
+ ## 1.11.3
8
+
9
+ Nobody must change anything. A control without `ifCurrent` (pause, seek, speed, restart, close, a step, a loop, an audio track), a capture and a scrub now act on the current state: while a stream (or anything else that holds `source.state`) keeps `player.state` current, nothing changes; otherwise the SDK reads the state first, so a plugin that read the state once and keeps no stream is no longer refused with `stale` after any pause, seek or new file by someone else. Calls made together share one read and go out in the order they were made; `stale` still comes when the source changes between that read and the call, and an explicit `ifCurrent` is sent as given. The `stale` todos of the `menus`, `adjust-panel` and `three-ways` examples pass, and the golden traces of `examples/menus` and `examples/adjust-panel` gain that read (with the speed now applied) instead of listing `stale`.
10
+
3
11
  ## 1.11.2
4
12
 
5
13
  Additions and fixes only; nobody must change anything except a plugin test that relies on a host error the plugin does not handle (below).
package/dist/commands.js CHANGED
@@ -359,6 +359,7 @@ vestra.history | recent.clear | Open ▸ Recently Played ▸ Clear Entries
359
359
  vestra.history | recent.enabled | Open ▸ Recently Played ▸ Record Playback History
360
360
  host | stop | Close | F4
361
361
  host | play-pause | Play/Pause | Space, Mouse:LeftClick
362
+ vestra.window | pip | Tools ▸ Picture-in-Picture
362
363
  vestra.audio | audio.track.none | Tools ▸ Audio Track ▸ No Audio Tracks
363
364
  vestra.subtitles | track-off | Tools ▸ Subtitle Track ▸ Off
364
365
  vestra.capture | capture.save | Tools ▸ Snapshot ▸ Save Current Frame | Ctrl+E
@@ -420,7 +421,6 @@ vestra.playback | ab.count.3 | (3 Times)
420
421
  vestra.playback | ab.count.5 | (5 Times)
421
422
  vestra.playback | ab.count.10 | (10 Times)
422
423
  vestra.window | hide-cursor | (Hide Pointer While Playing)
423
- vestra.window | pip | (Picture-in-Picture)
424
424
  vestra.window | mini | (Mini Size) | \`
425
425
  vestra.window | size.0.5 | (0.5×) | 1
426
426
  vestra.window | size.1 | (1×) | 2
Binary file
@@ -194,6 +194,13 @@ export declare class Connection {
194
194
  * once more here.
195
195
  */
196
196
  follow(event: string, why?: Why): Disposable;
197
+ /**
198
+ * Whether `event` is subscribed at the player now: something holds it
199
+ * (a listener, a hold, a stream, a handle that follows the source), so a
200
+ * state copy kept by it follows the player's events. False while a
201
+ * held-only group waits for a holder, and when nothing started it.
202
+ */
203
+ following(event: string): boolean;
197
204
  /**
198
205
  * A binding (or a command's function field) reads `event`'s state: its
199
206
  * reason joins what the player is told while a plugin listener, hold or
@@ -452,6 +452,15 @@ export class Connection {
452
452
  follow(event, why) {
453
453
  return this.#hold(event, why, "never");
454
454
  }
455
+ /**
456
+ * Whether `event` is subscribed at the player now: something holds it
457
+ * (a listener, a hold, a stream, a handle that follows the source), so a
458
+ * state copy kept by it follows the player's events. False while a
459
+ * held-only group waits for a holder, and when nothing started it.
460
+ */
461
+ following(event) {
462
+ return this.#events.get(event)?.off !== undefined;
463
+ }
455
464
  #hold(event, why, catchUp, listens = true) {
456
465
  const group = this.#events.get(event);
457
466
  if (!group)
@@ -261,7 +261,8 @@ export function mediaCapture(scope) {
261
261
  const service = serviceOf(runtime);
262
262
  const player = playerOf(runtime);
263
263
  // The source now: a capture needs one, even from a plugin that never
264
- // read the state (its copy then starts following the player).
264
+ // read the state; read first when the copy does not follow the
265
+ // player (`PlayerService.current`).
265
266
  const at = options.ifCurrent ?? (await player.current());
266
267
  const { expected } = player.expected(at);
267
268
  if (!expected)
@@ -444,7 +445,8 @@ function mediaSources(scope) {
444
445
  const expected = options?.ifCurrent === undefined
445
446
  ? undefined
446
447
  : playerOf(scope.runtime).expected(options.ifCurrent).expected;
447
- return host().remember(expected);
448
+ // In its turn among the plugin's calls on the source.
449
+ return playerOf(scope.runtime).inTurn(() => host().remember(expected));
448
450
  },
449
451
  get: async (value) => host().get(token(value)),
450
452
  locate: async (value) => host().locate(token(value)),
@@ -42,8 +42,6 @@ export declare class PlayerService implements StreamSource {
42
42
  * a read that failed is tried again by the next call.
43
43
  */
44
44
  read(): Promise<void>;
45
- /** Whether the mirror is registered yet. */
46
- get started(): boolean;
47
45
  /**
48
46
  * Register the SDK's copy of the state (a mirror of `source.state`; a
49
47
  * plugin listens through `watch`, `follow` and `player.on`). It hears
@@ -52,8 +50,23 @@ export declare class PlayerService implements StreamSource {
52
50
  * starts. Resolves at once.
53
51
  */
54
52
  start(): Promise<void>;
55
- /** The state as the player has it now, for a call that needs a source. */
53
+ /**
54
+ * The state as the player has it now, for a call that acts on the
55
+ * current state (a capture): the copy as it is while it follows the
56
+ * player's events, else read first ({@link fresh}).
57
+ */
56
58
  current(): Promise<PlayerState>;
59
+ /**
60
+ * Wait until the copy is the player's current state, for a call that
61
+ * acts on it (a control, a step, a capture, a scrub). While something
62
+ * holds `source.state` the copy follows the player's events: nothing to
63
+ * wait for. Otherwise it is the newest snapshot the plugin has, which an
64
+ * admitted intent since (a pause, a seek, a new file, by anyone) made
65
+ * stale: it is read first. Calls in a burst share one read ({@link inTurn}
66
+ * keeps their order). A read that fails leaves the copy as it was; the
67
+ * call goes on with it.
68
+ */
69
+ fresh(): Promise<void> | undefined;
57
70
  /** Drop anything older than what was already delivered. */
58
71
  accept(raw: SourceState): void;
59
72
  /**
@@ -113,6 +126,22 @@ export declare class PlayerService implements StreamSource {
113
126
  expected(state: PlayerState | undefined): {
114
127
  expected?: SourceStamp;
115
128
  };
129
+ /**
130
+ * Send a call in its turn among the plugin's calls on the source: at
131
+ * once (in the same tick) when no read is on its way, else right after
132
+ * that read, with the calls that waited for it in the order they were
133
+ * made. `read`: the call acts on the current state, so a read starts
134
+ * first when the copy does not follow the player ({@link fresh}).
135
+ */
136
+ inTurn<T>(send: () => Promise<T>, read?: boolean): Promise<T>;
137
+ /**
138
+ * `send` with the stamp a call sends, in its turn ({@link inTurn}):
139
+ * `ifCurrent`'s when given (as it is), else the current state's, read
140
+ * first when the copy does not follow the player.
141
+ */
142
+ withStamp<T>(ifCurrent: PlayerState | undefined, send: (stamp: {
143
+ expected?: SourceStamp;
144
+ }) => Promise<T>): Promise<T>;
116
145
  control(intent: SourceIntent, options?: Conditional): Promise<void>;
117
146
  /** Close only if `generation` is still the player's source. */
118
147
  closeIfCurrent(generation: number): Promise<void>;
@@ -175,6 +175,10 @@ export class PlayerService {
175
175
  #started = false;
176
176
  /** `read()`'s one read, once asked for. */
177
177
  #read;
178
+ /** The read that calls acting on the current state wait for (`fresh`). */
179
+ #fresh;
180
+ /** The sends waiting for that read, in the order they were made (`inTurn`). */
181
+ #waiting = [];
178
182
  output;
179
183
  constructor(runtime) {
180
184
  this.runtime = runtime;
@@ -211,10 +215,6 @@ export class PlayerService {
211
215
  }
212
216
  })());
213
217
  }
214
- /** Whether the mirror is registered yet. */
215
- get started() {
216
- return this.#started;
217
- }
218
218
  /**
219
219
  * Register the SDK's copy of the state (a mirror of `source.state`; a
220
220
  * plugin listens through `watch`, `follow` and `player.on`). It hears
@@ -229,11 +229,45 @@ export class PlayerService {
229
229
  this.runtime.on("source.state", (data) => this.accept(data), "held", true);
230
230
  return Promise.resolve();
231
231
  }
232
- /** The state as the player has it now, for a call that needs a source. */
232
+ /**
233
+ * The state as the player has it now, for a call that acts on the
234
+ * current state (a capture): the copy as it is while it follows the
235
+ * player's events, else read first ({@link fresh}).
236
+ */
233
237
  async current() {
234
238
  await this.start();
239
+ const fresh = this.fresh();
240
+ if (fresh)
241
+ await fresh;
235
242
  return this.state;
236
243
  }
244
+ /**
245
+ * Wait until the copy is the player's current state, for a call that
246
+ * acts on it (a control, a step, a capture, a scrub). While something
247
+ * holds `source.state` the copy follows the player's events: nothing to
248
+ * wait for. Otherwise it is the newest snapshot the plugin has, which an
249
+ * admitted intent since (a pause, a seek, a new file, by anyone) made
250
+ * stale: it is read first. Calls in a burst share one read ({@link inTurn}
251
+ * keeps their order). A read that fails leaves the copy as it was; the
252
+ * call goes on with it.
253
+ */
254
+ fresh() {
255
+ if (this.#fresh)
256
+ return this.#fresh;
257
+ // Note: `following` stays true when the subscription failed (its
258
+ // `off` is then a rejected promise); the copy is then sent as it is.
259
+ if (this.runtime.following("source.state"))
260
+ return undefined;
261
+ const fresh = this.refresh().then(() => { }, () => { });
262
+ // Once read: cleared, then the waiting sends go out in one go, in the
263
+ // order they were made; a call after them starts a read of its own.
264
+ this.#fresh = fresh.then(() => {
265
+ this.#fresh = undefined;
266
+ for (const send of this.#waiting.splice(0))
267
+ send();
268
+ });
269
+ return this.#fresh;
270
+ }
237
271
  /** Drop anything older than what was already delivered. */
238
272
  accept(raw) {
239
273
  if (raw.eventSequence < this.raw.eventSequence)
@@ -394,12 +428,38 @@ export class PlayerService {
394
428
  const raw = raws.get(state ?? this.state);
395
429
  return raw && raw.eventSequence >= 0 ? { expected: raw.stamp } : {};
396
430
  }
397
- async control(intent, options) {
398
- await this.submit({
399
- ...intent,
400
- ...this.expected(options?.ifCurrent),
431
+ /**
432
+ * Send a call in its turn among the plugin's calls on the source: at
433
+ * once (in the same tick) when no read is on its way, else right after
434
+ * that read, with the calls that waited for it in the order they were
435
+ * made. `read`: the call acts on the current state, so a read starts
436
+ * first when the copy does not follow the player ({@link fresh}).
437
+ */
438
+ inTurn(send, read = false) {
439
+ if (!(read ? this.fresh() : this.#fresh))
440
+ return send();
441
+ return new Promise((resolve, reject) => {
442
+ this.#waiting.push(() => {
443
+ try {
444
+ resolve(send());
445
+ }
446
+ catch (error) {
447
+ reject(error);
448
+ }
449
+ });
401
450
  });
402
451
  }
452
+ /**
453
+ * `send` with the stamp a call sends, in its turn ({@link inTurn}):
454
+ * `ifCurrent`'s when given (as it is), else the current state's, read
455
+ * first when the copy does not follow the player.
456
+ */
457
+ withStamp(ifCurrent, send) {
458
+ return this.inTurn(() => send(this.expected(ifCurrent)), !ifCurrent);
459
+ }
460
+ async control(intent, options) {
461
+ await this.withStamp(options?.ifCurrent, (stamp) => this.submit({ ...intent, ...stamp }));
462
+ }
403
463
  /** Close only if `generation` is still the player's source. */
404
464
  async closeIfCurrent(generation) {
405
465
  const raw = this.runtime.reads
@@ -500,14 +560,14 @@ class ScrubHandle {
500
560
  #service;
501
561
  constructor(service) {
502
562
  this.#service = service;
503
- // A scrub follows the source. When it is the first thing to need the
504
- // state (the mirror starts now), the gesture starts from the state read
505
- // right after subscribing, not from the copy of start-up.
506
- const late = !service.started;
507
- const fresh = service.start();
508
- let ready = !late;
563
+ // A scrub follows the source. When the copy did not follow it yet (the
564
+ // mirror starts now, or nothing held `source.state`), the gesture
565
+ // starts from the state read now, not from the plugin's old copy.
566
+ void service.start();
567
+ const fresh = service.fresh();
568
+ let ready = !fresh;
509
569
  this.#allowed = { ...service.raw.stamp };
510
- if (late)
570
+ if (fresh)
511
571
  void fresh.then(() => {
512
572
  ready = true;
513
573
  if (this.#active && !this.#pending)
@@ -521,7 +581,7 @@ class ScrubHandle {
521
581
  this.end();
522
582
  });
523
583
  this.#queue = new Latest(async ({ seconds, keyframes }) => {
524
- if (late)
584
+ if (fresh)
525
585
  await fresh;
526
586
  if (!this.#active)
527
587
  throw superseded;
@@ -743,12 +803,15 @@ export function player(scope) {
743
803
  throw abortError();
744
804
  let ticket;
745
805
  try {
746
- ticket = await service().submit({
806
+ // In its turn: after a read on its way for earlier controls.
807
+ ticket = await service().inTurn(() => service().submit({
747
808
  kind: "open",
748
809
  source,
749
810
  startPaused: options.paused ?? false,
750
- ...(options.ifCurrent ? service().expected(options.ifCurrent) : {}),
751
- }, { signal, accepted: (accepted) => (ticket = accepted) });
811
+ ...(options.ifCurrent
812
+ ? service().expected(options.ifCurrent)
813
+ : {}),
814
+ }, { signal, accepted: (accepted) => (ticket = accepted) }));
752
815
  }
753
816
  catch (error) {
754
817
  // Cancelling a pending open (e.g. a URL still being resolved) closes it.
@@ -815,8 +878,7 @@ export function player(scope) {
815
878
  };
816
879
  },
817
880
  async addAudioTrack(path, options = {}) {
818
- const { expected } = service().expected(options.ifCurrent);
819
- const added = await scope.runtime.host.audio.add(path, options.select ?? true, expected);
881
+ const added = await service().withStamp(options.ifCurrent, ({ expected }) => scope.runtime.host.audio.add(path, options.select ?? true, expected));
820
882
  await service()
821
883
  .refresh()
822
884
  .catch(() => { });
@@ -827,8 +889,7 @@ export function player(scope) {
827
889
  throw failure("invalid", "unit is frame or keyframe");
828
890
  if (direction !== "backward" && direction !== "forward")
829
891
  throw failure("invalid", "direction is backward or forward");
830
- const { expected } = service().expected(options.ifCurrent);
831
- await scope.runtime.host.step.step(unit, direction, expected);
892
+ await service().withStamp(options.ifCurrent, ({ expected }) => scope.runtime.host.step.step(unit, direction, expected));
832
893
  await service()
833
894
  .refresh()
834
895
  .catch(() => { });
@@ -868,19 +929,17 @@ export function player(scope) {
868
929
  (!Number.isInteger(count) || count < 1 || count > 1_000_000))
869
930
  throw failure("invalid", "count must be an integer 1–1000000");
870
931
  }
871
- const { expected } = service().expected(options.ifCurrent);
872
- await scope.runtime.host.marks.setLoop(loop && {
932
+ await service().withStamp(options.ifCurrent, ({ expected }) => scope.runtime.host.marks.setLoop(loop && {
873
933
  a: loop.a,
874
934
  b: loop.b,
875
935
  ...(loop.count === undefined ? {} : { count: loop.count }),
876
- }, expected);
936
+ }, expected));
877
937
  await service()
878
938
  .refresh()
879
939
  .catch(() => { });
880
940
  },
881
941
  async selectAudioTrack(id, options = {}) {
882
- const { expected } = service().expected(options.ifCurrent);
883
- await scope.runtime.host.audio.select(id, expected);
942
+ await service().withStamp(options.ifCurrent, ({ expected }) => scope.runtime.host.audio.select(id, expected));
884
943
  return service().refresh();
885
944
  },
886
945
  };
@@ -3,6 +3,7 @@ import { createHash } from "node:crypto";
3
3
  import { isTextValue, textProblem } from "../i18n.js";
4
4
  import { Latest } from "./latest.js";
5
5
  import { abortError, failure, sleep, uncertain } from "./errors.js";
6
+ import { playerOf } from "./player.js";
6
7
  /**
7
8
  * The player's limits on subtitle files a plugin loads with
8
9
  * {@link Subtitles.load}, which `TestHost` enforces with the player's codes.
@@ -98,13 +99,12 @@ class SubtitleService {
98
99
  }, "held", true);
99
100
  runtime.on("playback.backend", () => void this.refresh().catch(() => { }), "held", true);
100
101
  this.style = new Latest(async ({ style, options }) => {
101
- const expected = await this.expected(options);
102
- await this.#mutate(++this.#operation, (operationId) => runtime.host.subtitles.style({
102
+ await this.inTurn(options, (expected) => this.#mutate(++this.#operation, (operationId) => runtime.host.subtitles.style({
103
103
  operationId,
104
104
  revision: ++this.#styleRevision,
105
105
  expected,
106
106
  style,
107
- }));
107
+ })));
108
108
  });
109
109
  }
110
110
  watch(watcher) {
@@ -208,12 +208,28 @@ class SubtitleService {
208
208
  }
209
209
  /** Default: the selection as it is now. `ifCurrent` pins an older one. */
210
210
  async expected(options) {
211
- const pinned = options?.ifCurrent && raws.get(options.ifCurrent);
211
+ const pinned = this.#pinned(options);
212
212
  if (pinned)
213
- return pinned.selection.stamp;
213
+ return pinned;
214
214
  await this.refresh();
215
215
  return this.raw.selection.stamp;
216
216
  }
217
+ #pinned(options) {
218
+ const pinned = options?.ifCurrent && raws.get(options.ifCurrent);
219
+ return pinned ? pinned.selection.stamp : undefined;
220
+ }
221
+ /**
222
+ * `send` with the selection stamp ({@link expected}), in its turn among
223
+ * the plugin's calls on the source (`PlayerService.inTurn`): its first
224
+ * request goes out in the same tick, or right after a read of the source
225
+ * on its way for an earlier control.
226
+ */
227
+ inTurn(options, send) {
228
+ return playerOf(this.#runtime).inTurn(() => {
229
+ const pinned = this.#pinned(options);
230
+ return pinned ? send(pinned) : this.expected(options).then(send);
231
+ });
232
+ }
217
233
  nextOperation() {
218
234
  return ++this.#operation;
219
235
  }
@@ -302,9 +318,8 @@ export function subtitles(scope) {
302
318
  const role = options?.role ?? "primary";
303
319
  if (role !== "primary" && role !== "secondary")
304
320
  throw failure("invalid", 'role must be "primary" or "secondary"');
305
- const expected = await service().expected(options);
306
321
  const chosen = track && target(track);
307
- return service().mutate((id) => host().select(chosen, expected, id, role));
322
+ return service().inTurn(options, (expected) => service().mutate((id) => host().select(chosen, expected, id, role)));
308
323
  },
309
324
  async load(srt, options) {
310
325
  const format = options?.format ?? "srt";
@@ -327,7 +342,8 @@ export function subtitles(scope) {
327
342
  [...title].length > 200))
328
343
  throw failure("invalid", "title needs 1–200 characters");
329
344
  const svc = service();
330
- const current = await svc.refresh();
345
+ // In its turn among the plugin's calls on the source.
346
+ const current = await playerOf(scope.runtime).inTurn(() => svc.refresh());
331
347
  const expected = await svc.expected(options);
332
348
  const uploadId = svc.nextUpload();
333
349
  const resourceId = `external-${uploadId}`;
@@ -390,8 +406,7 @@ export function subtitles(scope) {
390
406
  const chosen = target(track);
391
407
  if (chosen.kind !== "external" || !service().owned.has(chosen.resourceId))
392
408
  throw failure("invalid", "只能移除本插件加载的字幕");
393
- const expected = await service().expected(options);
394
- const state = await service().mutate((id) => host().remove(chosen.resourceId, expected, id));
409
+ const state = await service().inTurn(options, (expected) => service().mutate((id) => host().remove(chosen.resourceId, expected, id)));
395
410
  service().owned.delete(chosen.resourceId);
396
411
  return state;
397
412
  },
@@ -386,10 +386,14 @@ export interface Chapter {
386
386
  start: number;
387
387
  }
388
388
  /**
389
- * Controls act on the state you are looking at: by default `player.state`.
390
- * If another plugin or the user changed the source in between, the call fails
391
- * with code `stale` and nothing happens. Pass `ifCurrent` to bind the call to
392
- * an older snapshot instead (for example the state when a drag started).
389
+ * Controls act on the current state by default. While a
390
+ * {@link Player.stream} (or anything else that follows the source) keeps
391
+ * `player.state` current, that is the state they act on; otherwise the SDK
392
+ * reads the state first (calls made together share one read). If another
393
+ * plugin or the user changed the source in between, the call fails with
394
+ * code `stale` and nothing happens. Pass `ifCurrent` to pin the call to an
395
+ * older snapshot instead (for example the state when a dialog opened); it
396
+ * is sent as given.
393
397
  *
394
398
  * The SDK refreshes `player.state` after its own operations, so a plugin's
395
399
  * consecutive calls do not make each other stale. {@link Player.open} is
@@ -419,7 +423,7 @@ export interface Chapter {
419
423
  * @category Playback
420
424
  */
421
425
  export interface Conditional {
422
- /** The state the call is conditional on; default: the current `player.state`. */
426
+ /** The state the call is conditional on; default: the current state (read first when no stream keeps `player.state` current). */
423
427
  ifCurrent?: PlayerState;
424
428
  }
425
429
  /**
@@ -939,8 +943,9 @@ export interface StateStream {
939
943
  * has: from `read()`, `refresh()`, an event's data and this plugin's own
940
944
  * calls, and while a {@link Player.stream} is open, every change. Every
941
945
  * control is
942
- * conditional: it acts on the state the plugin last saw and fails with
943
- * `stale` when the source changed meanwhile: another file, a close, or any
946
+ * conditional: it acts on the current state (read first when no stream
947
+ * keeps `state` current) or on the one given as `ifCurrent`, and fails
948
+ * with `stale` when the source changed meanwhile: another file, a close, or any
944
949
  * pause, seek or speed change by the user or another plugin (see
945
950
  * {@link Conditional}). The player keeps the source when a plugin stops;
946
951
  * only the plugin's own handles (a stream, its sequence provider, its
@@ -1346,8 +1351,8 @@ export interface Player {
1346
1351
  *
1347
1352
  * @example Pause, but only the file the user was watching
1348
1353
  * A "pause on lock" helper pauses the current file and does nothing when
1349
- * another file was opened in between. The call is conditional on
1350
- * `player.state` by default; `stale` means the source changed and the
1354
+ * another file was opened in between. The call acts on the current state
1355
+ * by default; `stale` means the source changed and the
1351
1356
  * pause was not applied, which is the intended outcome here.
1352
1357
  * ```ts
1353
1358
  * try {
@@ -1377,13 +1382,13 @@ export interface Player {
1377
1382
  *
1378
1383
  * @example Jump back ten seconds
1379
1384
  * Playback jumps ten seconds back, never before the start. The target is
1380
- * computed from the snapshot the call is conditional on, so if the user
1381
- * opened another file meanwhile the seek fails with `stale` instead of
1382
- * landing in the wrong file.
1385
+ * computed from the state read now, and the seek is pinned to it
1386
+ * (`ifCurrent`), so if the user opened another file meanwhile the seek
1387
+ * fails with `stale` instead of landing in the wrong file.
1383
1388
  * ```ts
1384
- * const { position } = plugin.player.state;
1385
- * if (position !== null && plugin.player.state.can.seek)
1386
- * await plugin.player.seek(Math.max(0, position - 10)); // seconds
1389
+ * const now = await plugin.player.refresh();
1390
+ * if (now.position !== null && now.can.seek)
1391
+ * await plugin.player.seek(Math.max(0, now.position - 10), { ifCurrent: now }); // seconds
1387
1392
  * ```
1388
1393
  *
1389
1394
  * @since 1.0.0
package/llms.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  # Vestra Player SDK
2
2
 
3
- > @vestra-player/sdk 1.11.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.4: 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.2",
3
+ "version": "1.11.4",
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": {