@vestra-player/sdk 1.7.1 → 1.7.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 +20 -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 +141 -155
- package/dist/plugin/testing/internals.d.ts +9 -2
- package/dist/plugin/testing/internals.js +9 -2
- package/dist/plugin/testing/layout.d.ts +46 -3
- package/dist/plugin/testing/layout.js +102 -7
- package/dist/plugin/testing/services.js +10 -2
- package/dist/plugin/testing/slint-types.d.ts +75 -0
- package/dist/plugin/testing/slint-types.js +974 -0
- 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
|
@@ -94,7 +94,7 @@ interface Filter<T> extends Disposable {
|
|
|
94
94
|
* never throws: a refused chain shows as `failed` in `status`.
|
|
95
95
|
*
|
|
96
96
|
* @capability processing.video, playback.read and events
|
|
97
|
-
* @see [
|
|
97
|
+
* @see [Process video with a shader or a filter](../../../docs/guides/filters.md)
|
|
98
98
|
* @since 1.0.0
|
|
99
99
|
* @category Processing
|
|
100
100
|
*/
|
|
@@ -123,7 +123,7 @@ export type VideoFilter = Filter<VideoNode[]>;
|
|
|
123
123
|
* result, `retry` applies it again, `dispose` withdraws it.
|
|
124
124
|
*
|
|
125
125
|
* @capability processing.audio, playback.read and events
|
|
126
|
-
* @see [
|
|
126
|
+
* @see [Process video with a shader or a filter](../../../docs/guides/filters.md)
|
|
127
127
|
* @since 1.0.0
|
|
128
128
|
* @category Processing
|
|
129
129
|
*/
|
|
@@ -182,7 +182,7 @@ export interface ViewSettings {
|
|
|
182
182
|
*
|
|
183
183
|
* @capability processing.video, playback.read and events (like
|
|
184
184
|
* {@link VideoFilter})
|
|
185
|
-
* @see [
|
|
185
|
+
* @see [Process video with a shader or a filter](../../../docs/guides/filters.md)
|
|
186
186
|
* @since 1.0.0
|
|
187
187
|
* @category Processing
|
|
188
188
|
*/
|
|
@@ -282,24 +282,22 @@ export interface RenderSettings {
|
|
|
282
282
|
* ```
|
|
283
283
|
*
|
|
284
284
|
* @remarks
|
|
285
|
-
* GPU renderer options (tone mapping, peak detection, shaders,
|
|
286
|
-
*
|
|
287
|
-
* rendering
|
|
288
|
-
*
|
|
289
|
-
* the player's first answer to `render()` (reported to `onError` too), and so is
|
|
285
|
+
* GPU renderer options (tone mapping, peak detection, shaders, interpolation).
|
|
286
|
+
* Only the GPU renderer has them (macOS; Windows with GPU rendering turned on);
|
|
287
|
+
* under software rendering the handle is `failed` with `unsupported` after the
|
|
288
|
+
* player's first answer to `render()` (reported to `onError` too), and so is
|
|
290
289
|
* every `set`. Single owner, like {@link VideoView}. `set` never throws; the
|
|
291
|
-
* result shows in `status`. For shaders that several plugins add at the
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
* them.
|
|
290
|
+
* result shows in `status`. For shaders that several plugins add at the same
|
|
291
|
+
* time, use {@link VideoShaders}. After a run of the player that ended
|
|
292
|
+
* abnormally while plugin shaders were drawing, a `set` whose merged values
|
|
293
|
+
* hold a non-empty `shaders` list is refused with `previous-crash` (the rules
|
|
294
|
+
* are on {@link VideoShaders}). Every `set` sends all the values set so far,
|
|
295
|
+
* the refused `shaders` included, so include `shaders: []` in the next `set` to
|
|
296
|
+
* go on without them.
|
|
299
297
|
*
|
|
300
298
|
* @capability processing.video, playback.read and events (like
|
|
301
299
|
* {@link VideoFilter})
|
|
302
|
-
* @see [
|
|
300
|
+
* @see [Process video with a shader or a filter](../../../docs/guides/filters.md)
|
|
303
301
|
* @since 1.0.0
|
|
304
302
|
* @category Processing
|
|
305
303
|
*/
|
|
@@ -321,18 +319,16 @@ export interface RenderOptions extends Disposable {
|
|
|
321
319
|
*/
|
|
322
320
|
set(value: Partial<RenderSettings>): void;
|
|
323
321
|
/**
|
|
324
|
-
* `failed` with `unsupported` while the player renders in software;
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
* `
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
*
|
|
333
|
-
* `shaders
|
|
334
|
-
* (`set({ shaders: [], toneMapping: "bt.2390" })`); `dispose` always
|
|
335
|
-
* works.
|
|
322
|
+
* `failed` with `unsupported` while the player renders in software; `failed`
|
|
323
|
+
* with `failed` when mpv cannot compile a shader (pushed later; while other
|
|
324
|
+
* plugins' {@link VideoShaders} are on too, the player cannot tell whose
|
|
325
|
+
* shader failed and says so in the message); `failed` with `previous-crash`
|
|
326
|
+
* when a `set` with a non-empty `shaders` list comes after a run of the
|
|
327
|
+
* player that ended abnormally while plugin shaders were drawing (the rules
|
|
328
|
+
* are the same as for {@link VideoShaders}). The handle keeps the refused
|
|
329
|
+
* list among its values and every `set` sends them all, so a later `set`
|
|
330
|
+
* without `shaders` is refused again: include `shaders: []` in it
|
|
331
|
+
* (`set({ shaders: [], toneMapping: "bt.2390" })`); `dispose` always works.
|
|
336
332
|
*/
|
|
337
333
|
readonly status: FilterStatus;
|
|
338
334
|
/**
|
|
@@ -357,8 +353,8 @@ export interface RenderOptions extends Disposable {
|
|
|
357
353
|
}
|
|
358
354
|
/**
|
|
359
355
|
* This plugin's own GPU shaders, from `plugin.video.shaders(id)`
|
|
360
|
-
* (`processing.video
|
|
361
|
-
*
|
|
356
|
+
* (`processing.video`): mpv user shaders (`.glsl`, `//!HOOK` …) that the GPU
|
|
357
|
+
* renderer runs on every frame.
|
|
362
358
|
*
|
|
363
359
|
* @remarks
|
|
364
360
|
* Any number of plugins hold shader handles at the same time (unlike
|
|
@@ -387,24 +383,20 @@ export interface RenderOptions extends Disposable {
|
|
|
387
383
|
* which file failed, so while several plugins' shaders are on, each of
|
|
388
384
|
* them hears it and the message says the player cannot tell whose.
|
|
389
385
|
*
|
|
390
|
-
* `set` sends the whole list (last write wins); `clear` and `dispose`
|
|
391
|
-
*
|
|
392
|
-
*
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
*
|
|
398
|
-
*
|
|
399
|
-
*
|
|
400
|
-
*
|
|
401
|
-
* the
|
|
402
|
-
*
|
|
403
|
-
*
|
|
404
|
-
* retry it. Do not set the list again in a loop while it is refused, and
|
|
405
|
-
* do not show an OSD line of your own for it; a later start of the player
|
|
406
|
-
* applies lists again once the guard lets it. Players before 0.6.3 never
|
|
407
|
-
* refuse with it.
|
|
386
|
+
* `set` sends the whole list (last write wins); `clear` and `dispose` withdraw
|
|
387
|
+
* it; the player removes a stopped plugin's shaders itself.
|
|
388
|
+
*
|
|
389
|
+
* **After an abnormal end**: when the previous run of the player ended while
|
|
390
|
+
* plugin shaders were drawing (a crash, the process being ended, a lost GPU
|
|
391
|
+
* device), the player refuses every non-empty list of every plugin with
|
|
392
|
+
* `previous-crash`, its message naming the plugins whose shaders were on: one
|
|
393
|
+
* such end keeps them off for the next start only; two within a day keep them
|
|
394
|
+
* off until the GPU, its driver or the player changes, or for 7 days. Clearing
|
|
395
|
+
* (`[]`, `clear`, `dispose`) still works. The player shows one OSD line about
|
|
396
|
+
* it itself; the handle is `failed` with `previous-crash` and the SDK does not
|
|
397
|
+
* retry it. Do not set the list again in a loop while it is refused, and do not
|
|
398
|
+
* show an OSD line of your own for it; a later start of the player applies
|
|
399
|
+
* lists again once the guard lets it.
|
|
408
400
|
*
|
|
409
401
|
* @example Add a sharpening shader the plugin ships
|
|
410
402
|
* The video looks sharper on the GPU renderer; under software rendering
|
|
@@ -424,8 +416,8 @@ export interface RenderOptions extends Disposable {
|
|
|
424
416
|
* ```
|
|
425
417
|
*
|
|
426
418
|
* @capability processing.video
|
|
427
|
-
* @player 0.5.20
|
|
428
|
-
* @see [
|
|
419
|
+
* @player 0.5.20
|
|
420
|
+
* @see [Process video with a shader or a filter](../../../docs/guides/filters.md)
|
|
429
421
|
* @since 1.5.39
|
|
430
422
|
* @category Processing
|
|
431
423
|
*/
|
|
@@ -436,7 +428,7 @@ export interface VideoShaders extends Disposable {
|
|
|
436
428
|
*
|
|
437
429
|
* @remarks
|
|
438
430
|
* Never throws: a refused list shows in `status` (`invalid`, `missing`,
|
|
439
|
-
* `limit`, `unsupported`, and `previous-crash
|
|
431
|
+
* `limit`, `unsupported`, and `previous-crash`: see
|
|
440
432
|
* the interface's remarks) and goes to {@link Scope.onError}, and what the
|
|
441
433
|
* player held stays.
|
|
442
434
|
*
|
|
@@ -517,10 +509,10 @@ export interface VideoShaders extends Disposable {
|
|
|
517
509
|
onStatus(listener: (status: FilterStatus) => void): Disposable;
|
|
518
510
|
}
|
|
519
511
|
/**
|
|
520
|
-
* Why the GPU's video upscaler does not work, as a stable kebab-case code.
|
|
521
|
-
*
|
|
522
|
-
* {@link UpscalingReason.message} for the rest. The codes
|
|
523
|
-
*
|
|
512
|
+
* Why the GPU's video upscaler does not work, as a stable kebab-case code. A
|
|
513
|
+
* newer player may add codes: compare with the ones you handle and show
|
|
514
|
+
* {@link UpscalingReason.message} for the rest. The codes, in the order the
|
|
515
|
+
* player checks them (the first that holds is reported):
|
|
524
516
|
*
|
|
525
517
|
* | Code | Meaning |
|
|
526
518
|
* | --- | --- |
|
|
@@ -590,7 +582,7 @@ export interface UpscalingReason {
|
|
|
590
582
|
* that renders it ({@link UpscalingDecodingCause}). Absent with every
|
|
591
583
|
* other code, and from players before 0.5.25.
|
|
592
584
|
*
|
|
593
|
-
* @player 0.5.25
|
|
585
|
+
* @player 0.5.25
|
|
594
586
|
* @since 1.5.43
|
|
595
587
|
*/
|
|
596
588
|
readonly cause?: UpscalingDecodingCause;
|
|
@@ -610,9 +602,8 @@ export interface UpscalingReason {
|
|
|
610
602
|
}
|
|
611
603
|
/**
|
|
612
604
|
* Why the video is not decoded on the GPU that renders it: the
|
|
613
|
-
* {@link UpscalingReason.cause} of a `decoding` reason
|
|
614
|
-
*
|
|
615
|
-
* ones you do not handle.
|
|
605
|
+
* {@link UpscalingReason.cause} of a `decoding` reason. A newer player may add
|
|
606
|
+
* causes: show {@link UpscalingReason.message} for the ones you do not handle.
|
|
616
607
|
*
|
|
617
608
|
* | Cause | Meaning |
|
|
618
609
|
* | --- | --- |
|
|
@@ -811,9 +802,6 @@ export interface UpscalingState {
|
|
|
811
802
|
* two GPUs the whole player must run on the NVIDIA one.
|
|
812
803
|
* **macOS, Linux:** `available` is `false` with `platform`.
|
|
813
804
|
*
|
|
814
|
-
* Players before 0.5.16 do not know `video.upscaling` and do not load a
|
|
815
|
-
* plugin that declares it: declare `"minPlayerVersion": "0.5.16"`.
|
|
816
|
-
*
|
|
817
805
|
* @example Offer AI upscaling as a menu item
|
|
818
806
|
* A Video menu item turns upscaling on and off; once the player said it
|
|
819
807
|
* cannot work here, the item is greyed out with the player's reason. The
|
|
@@ -844,8 +832,7 @@ export interface UpscalingState {
|
|
|
844
832
|
* ```
|
|
845
833
|
*
|
|
846
834
|
* @capability video.upscaling
|
|
847
|
-
* @player 0.5.16
|
|
848
|
-
* `video.upscaling`.
|
|
835
|
+
* @player 0.5.16
|
|
849
836
|
* @since 1.5.37
|
|
850
837
|
* @category Processing
|
|
851
838
|
*/
|
|
@@ -375,7 +375,7 @@ export interface JsonStore<T> extends Disposable {
|
|
|
375
375
|
* void queue;
|
|
376
376
|
* ```
|
|
377
377
|
*
|
|
378
|
-
* @see [Store a plugin's data](../../../docs/
|
|
378
|
+
* @see [Store a plugin's data](../../../docs/guides/store-data.md), [Open a tool window and remember its state](../../../docs/guides/windows.md)
|
|
379
379
|
* @since 1.0.0
|
|
380
380
|
* @category Services
|
|
381
381
|
*/
|
|
@@ -430,24 +430,24 @@ export interface Storage {
|
|
|
430
430
|
/**
|
|
431
431
|
* `plugin.storage.session`: JSON values that live as long as the **player**,
|
|
432
432
|
* not as long as the plugin's process (like `chrome.storage.session`). No
|
|
433
|
-
* capability
|
|
434
|
-
* `unsupported`).
|
|
433
|
+
* capability.
|
|
435
434
|
*
|
|
436
435
|
* `activate` can run more than once in one player session: the player stops
|
|
437
436
|
* and starts a plugin's process again when the plugin is reloaded (also a
|
|
438
437
|
* development load with `--plugin`) or upgraded, and after a crash or a
|
|
439
|
-
* failed start
|
|
440
|
-
*
|
|
441
|
-
*
|
|
442
|
-
*
|
|
443
|
-
*
|
|
438
|
+
* failed start; the player also restarts plugins that share a process, and
|
|
439
|
+
* stops an idle plugin after 30 s and starts it on its next use. Variables,
|
|
440
|
+
* timers, `fetch` calls, sockets and pending promises do not survive that
|
|
441
|
+
* (nor do they keep the plugin running): keep state that must survive a
|
|
442
|
+
* restart here (or in {@link Storage.json | storage.json} when it must also
|
|
443
|
+
* survive the player quitting) and pick it up again in `activate`.
|
|
444
444
|
*
|
|
445
445
|
* | | Values |
|
|
446
446
|
* | --- | --- |
|
|
447
447
|
* | The plugin's process restarts: reload, upgrade, crash | kept |
|
|
448
448
|
* | The plugin failed to start or failed, and starts again | kept |
|
|
449
449
|
* | The user, or a plugin with `plugins.manage` (`packages.setEnabled(id, false)`), disables the plugin | cleared |
|
|
450
|
-
* | An update or reinstall with `enabled: false` switches an enabled plugin off
|
|
450
|
+
* | An update or reinstall with `enabled: false` switches an enabled plugin off | cleared |
|
|
451
451
|
* | The plugin is uninstalled | cleared |
|
|
452
452
|
* | An earlier installation kept for a later reinstall (after a `replace`) is dropped because the player keeps only so many | cleared |
|
|
453
453
|
* | The player quits | cleared |
|
|
@@ -850,9 +850,9 @@ export type RenderingMode = "gpu" | "software";
|
|
|
850
850
|
*/
|
|
851
851
|
export type RenderingPreference = "auto" | "gpu" | "software";
|
|
852
852
|
/**
|
|
853
|
-
* Why the player renders the way it does, as a stable kebab-case code. A
|
|
854
|
-
*
|
|
855
|
-
* {@link RenderingReason.message} for the rest. The codes
|
|
853
|
+
* Why the player renders the way it does, as a stable kebab-case code. A newer
|
|
854
|
+
* player may add codes: compare with the ones you handle and show
|
|
855
|
+
* {@link RenderingReason.message} for the rest. The codes:
|
|
856
856
|
*
|
|
857
857
|
* | Code | Meaning |
|
|
858
858
|
* | --- | --- |
|
|
@@ -985,11 +985,6 @@ export interface RenderingState {
|
|
|
985
985
|
* plugin, so change it only when the user asks. A plugin that only needs
|
|
986
986
|
* to know whether render options work reads {@link SystemInfo.rendering}.
|
|
987
987
|
*
|
|
988
|
-
* Players before 0.5.13 do not know these requests: `state()` rejects with
|
|
989
|
-
* `unsupported`, and they do not load a plugin that declares
|
|
990
|
-
* `rendering.manage` (an unknown capability). Declare
|
|
991
|
-
* `"minPlayerVersion": "0.5.13"` when the plugin needs this.
|
|
992
|
-
*
|
|
993
988
|
* @example Offer GPU rendering as a menu item
|
|
994
989
|
* Settings ▸ GPU Rendering (Experimental) carries a check mark while the
|
|
995
990
|
* next start will draw on the GPU, is greyed out with the player's reason
|
|
@@ -1014,9 +1009,8 @@ export interface RenderingState {
|
|
|
1014
1009
|
*
|
|
1015
1010
|
* @capability None to read the state; `rendering.manage` to change the
|
|
1016
1011
|
* choice or restart the player.
|
|
1017
|
-
* @see [Offer a GPU rendering switch](../../../docs/
|
|
1018
|
-
* @player 0.5.13
|
|
1019
|
-
* (`unsupported`).
|
|
1012
|
+
* @see [Offer a GPU rendering switch](../../../docs/guides/gpu-rendering.md)
|
|
1013
|
+
* @player 0.5.13
|
|
1020
1014
|
* @since 1.5.35
|
|
1021
1015
|
* @category Services
|
|
1022
1016
|
*/
|
|
@@ -1030,11 +1024,10 @@ export interface Rendering {
|
|
|
1030
1024
|
* know the request.
|
|
1031
1025
|
*
|
|
1032
1026
|
* @example Find out whether the GPU can be chosen
|
|
1033
|
-
* The plugin reads the state once while it starts and keeps it for its
|
|
1034
|
-
*
|
|
1035
|
-
*
|
|
1036
|
-
*
|
|
1037
|
-
* with `unsupported`, and the plugin then offers nothing.
|
|
1027
|
+
* The plugin reads the state once while it starts and keeps it for its menu.
|
|
1028
|
+
* Each call asks the player; `gpu.available` is false, with a reason, where
|
|
1029
|
+
* this player has no GPU renderer, without a user interface, or when the
|
|
1030
|
+
* driver is ruled out.
|
|
1038
1031
|
* ```ts
|
|
1039
1032
|
* const state = await plugin.rendering.state().catch((error: PluginError) => {
|
|
1040
1033
|
* if (error.code === "unsupported") return null; // a player before 0.5.13
|
|
@@ -73,23 +73,22 @@ export interface Snapshot extends Disposable {
|
|
|
73
73
|
* Start exporting; the job runs in the host's offline worker.
|
|
74
74
|
* One snapshot can be exported several times.
|
|
75
75
|
*
|
|
76
|
-
* A **stream copy** (`format: "copy"
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* re-encode) and leave subtitle tracks and chapters out. `auto` writes
|
|
76
|
+
* A **stream copy** (`format: "copy"`) writes the video stream and the
|
|
77
|
+
* snapshot's audio track as they are in the file, without decoding: lossless
|
|
78
|
+
* and about as fast as the disk, but a copy can only begin on a keyframe. It
|
|
79
|
+
* starts at the video's last keyframe at or before the snapshot time (its
|
|
80
|
+
* first keyframe when the video itself starts later; keyframes an MP4 edit
|
|
81
|
+
* list discards do not count) and is cut at `end`, where it may run a few
|
|
82
|
+
* frames past `end`. An open GOP can write a frame or two that present before
|
|
83
|
+
* the keyframe; `start` includes them. The finished job's `outcome` gives the
|
|
84
|
+
* `start` and `end` actually written; a plugin that previews the cut (with
|
|
85
|
+
* `plugin.tools.run` and ffprobe's packet flags, say) shows those once the
|
|
86
|
+
* job is done. Copies need a raw snapshot (effects and burned-in subtitles
|
|
87
|
+
* need a re-encode) and leave subtitle tracks and chapters out. `auto` writes
|
|
89
88
|
* MP4 for H.264, HEVC, AV1 or MPEG-4 video with AAC, MP3, AC-3, E-AC-3 or
|
|
90
|
-
* ALAC audio (or none), and MKV for anything else. A copy the player
|
|
91
|
-
*
|
|
92
|
-
*
|
|
89
|
+
* ALAC audio (or none), and MKV for anything else. A copy the player cannot
|
|
90
|
+
* make (no video stream, a cover image, an external audio track, codecs `mp4`
|
|
91
|
+
* cannot hold) ends `failed` with the code `unsupported`.
|
|
93
92
|
*
|
|
94
93
|
* @capability media.read and media.control
|
|
95
94
|
* @throws `released` (rejects) The snapshot was already released.
|
|
@@ -139,10 +138,10 @@ export interface Snapshot extends Disposable {
|
|
|
139
138
|
export(options: ExportOptions): Promise<ExportJob>;
|
|
140
139
|
}
|
|
141
140
|
/**
|
|
142
|
-
* One frame as PNG, JPEG (`quality` 1–100, default 90) or BMP (24-bit), or
|
|
143
|
-
*
|
|
144
|
-
* {@link ExportEncoding}) or copied without re-encoding (`copy`,
|
|
145
|
-
*
|
|
141
|
+
* One frame as PNG, JPEG (`quality` 1–100, default 90) or BMP (24-bit), or a
|
|
142
|
+
* clip: re-encoded as MP4 (`mp4`, frame-accurate, optional
|
|
143
|
+
* {@link ExportEncoding}) or copied without re-encoding (`copy`, starting on a
|
|
144
|
+
* keyframe).
|
|
146
145
|
*
|
|
147
146
|
* `destination` is never overwritten if it exists. The extension does not
|
|
148
147
|
* choose the format (a copy's extension is set to its container).
|
|
@@ -150,15 +149,6 @@ export interface Snapshot extends Disposable {
|
|
|
150
149
|
* clip's end in source seconds. On Windows the export worker needs FFmpeg
|
|
151
150
|
* 6.1 or newer.
|
|
152
151
|
*
|
|
153
|
-
* **Which players have `copy`, `encoding` and the progress and range of
|
|
154
|
-
* a job**: player 0.7.6 and later. Declare `"minPlayerVersion": "0.7.6"`,
|
|
155
|
-
* or, to keep older players and offer these only where they exist, compare
|
|
156
|
-
* {@link AppInfo.version | plugin.app.version} with `0.7.6`, as for any
|
|
157
|
-
* newer API. Do not probe by trying: on an older player the `plugin`
|
|
158
|
-
* object comes from that player's own, older SDK, which rejects `copy` with
|
|
159
|
-
* `invalid` but builds a re-encode request without the `encoding` it does
|
|
160
|
-
* not know, so the clip is encoded with the fixed settings and no error.
|
|
161
|
-
*
|
|
162
152
|
* @since 1.0.0
|
|
163
153
|
* @category Media
|
|
164
154
|
*/
|
|
@@ -186,17 +176,16 @@ export type ExportOptions = {
|
|
|
186
176
|
/** Clip end, source seconds. */
|
|
187
177
|
end: number;
|
|
188
178
|
/**
|
|
189
|
-
* Encoder settings
|
|
190
|
-
* they existed.
|
|
179
|
+
* Encoder settings; without it, the settings before they existed.
|
|
191
180
|
*
|
|
192
181
|
* @since 1.6.10
|
|
193
182
|
*/
|
|
194
183
|
encoding?: ExportEncoding;
|
|
195
184
|
} | {
|
|
196
185
|
/**
|
|
197
|
-
* A clip copied stream by stream, without re-encoding
|
|
198
|
-
*
|
|
199
|
-
*
|
|
186
|
+
* A clip copied stream by stream, without re-encoding: lossless and about
|
|
187
|
+
* as fast as the disk. It starts on the video keyframe at or before the
|
|
188
|
+
* snapshot time; see {@link Snapshot.export}.
|
|
200
189
|
*
|
|
201
190
|
* @since 1.6.10
|
|
202
191
|
*/
|
|
@@ -216,13 +205,12 @@ export type ExportOptions = {
|
|
|
216
205
|
container?: "auto" | "mp4" | "mkv";
|
|
217
206
|
};
|
|
218
207
|
/**
|
|
219
|
-
* The encoder settings of a re-encoded clip (`format: "mp4"
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
* source" preset.
|
|
208
|
+
* The encoder settings of a re-encoded clip (`format: "mp4"`): a closed set of
|
|
209
|
+
* values, never encoder arguments. Every field is optional; the defaults are
|
|
210
|
+
* the settings clips had before: CRF 18, the fastest speed, the source's size
|
|
211
|
+
* and frame rate, AAC 192 kb/s, one thread. A value outside its set rejects the
|
|
212
|
+
* export with `invalid`. `videoBitrate: "source"` replaces the CRF with the
|
|
213
|
+
* source's bitrate, for a "Same as source" preset.
|
|
226
214
|
*
|
|
227
215
|
* @example A small file
|
|
228
216
|
* A 720p, 30 fps clip at a lower quality, encoded with the cores the player
|
|
@@ -269,10 +257,10 @@ export interface ExportEncoding {
|
|
|
269
257
|
audioBitrate?: 128 | 192 | 256;
|
|
270
258
|
/**
|
|
271
259
|
* `single` (default) encodes on one thread, leaving the other cores to
|
|
272
|
-
* playback. `auto` lets the player use more: half the logical
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
260
|
+
* playback. `auto` lets the player use more: half the logical processors, at
|
|
261
|
+
* most 8, so playback and the interface keep their rate. Every export runs at
|
|
262
|
+
* below-normal priority (as HandBrake and OBS run their encoders), with
|
|
263
|
+
* either setting.
|
|
276
264
|
*/
|
|
277
265
|
threads?: "single" | "auto";
|
|
278
266
|
/**
|
|
@@ -290,7 +278,7 @@ export interface ExportEncoding {
|
|
|
290
278
|
* `{ destination }`, `{ error: { code, message } }` or `{ cancelled: true }`.
|
|
291
279
|
* `facts` describes what the worker produced (versions, range, streams).
|
|
292
280
|
*
|
|
293
|
-
*
|
|
281
|
+
* In addition:
|
|
294
282
|
* - a finished clip's `outcome` also has `start` and `end`, the source
|
|
295
283
|
* times of its first frame and of the end of its last frame as written: a
|
|
296
284
|
* copy's earliest written frame (its keyframe, or the leading frames of
|
|
@@ -27,11 +27,11 @@ export interface WebResolverOptions {
|
|
|
27
27
|
resolve(url: string, signal: AbortSignal): Promise<ResolvedMedia>;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
* A resolver for local files by extension
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
30
|
+
* A resolver for local files by extension: when anyone opens such a file with
|
|
31
|
+
* {@link Player.open} (the Open dialog, the playlist, next / previous, the
|
|
32
|
+
* recent list, a drop that calls `open`), the player asks this plugin for a
|
|
33
|
+
* stream it generates instead of playing the file. Needs `source.resolve` and
|
|
34
|
+
* `producer.av`.
|
|
35
35
|
*
|
|
36
36
|
* @remarks
|
|
37
37
|
* The open keeps everything of the original call: its `ifCurrent`, its
|
|
@@ -211,7 +211,7 @@ export interface Resolver extends Disposable {
|
|
|
211
211
|
* another plugin), so the plugin does not intercept opens itself.
|
|
212
212
|
*
|
|
213
213
|
* @capability source.resolve (file resolvers also `producer.av`)
|
|
214
|
-
* @see [
|
|
214
|
+
* @see [Control playback](../../../docs/guides/control-playback.md)
|
|
215
215
|
* @since 1.0.0
|
|
216
216
|
* @category Sources
|
|
217
217
|
*/
|
|
@@ -248,11 +248,10 @@ export interface Resolvers {
|
|
|
248
248
|
*/
|
|
249
249
|
add(options: ResolverOptions): Resolver;
|
|
250
250
|
/**
|
|
251
|
-
* The extensions some plugin's file resolver handles
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
* Use it to accept such files beside the player's own media types, for
|
|
251
|
+
* The extensions some plugin's file resolver handles: lower case, without the
|
|
252
|
+
* dot, sorted, each once; not who registered them. Reading needs no
|
|
253
|
+
* capability. Without `events` it is the list from when the plugin first read
|
|
254
|
+
* it. Use it to accept such files beside the player's own media types, for
|
|
256
255
|
* example in a playlist's drop or folder scan.
|
|
257
256
|
*
|
|
258
257
|
* @example Accept files that a resolver plugin can play
|
|
@@ -275,11 +274,10 @@ export interface Resolvers {
|
|
|
275
274
|
readonly fileTypes: readonly string[];
|
|
276
275
|
/**
|
|
277
276
|
* {@link Resolvers.fileTypes} changed: a file resolver was added, or its
|
|
278
|
-
* plugin stopped. Needs `events`; without it the listener never fires.
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
* run).
|
|
277
|
+
* plugin stopped. Needs `events`; without it the listener never fires. When
|
|
278
|
+
* the player starts a stopped plugin for this change,
|
|
279
|
+
* {@link Resolvers.fileTypes} already has the new list at start and the
|
|
280
|
+
* listener still hears the change.
|
|
283
281
|
*
|
|
284
282
|
* @param listener - Receives the new list.
|
|
285
283
|
* @returns A handle that removes the listener.
|
|
@@ -128,7 +128,7 @@ export interface SubtitleConditional {
|
|
|
128
128
|
* @capability `subtitles.read` to read; `subtitles.control` and
|
|
129
129
|
* `subtitles.read` to change; `events` to re-read on source changes.
|
|
130
130
|
*
|
|
131
|
-
* @see [Load subtitles from a plugin](../../../docs/
|
|
131
|
+
* @see [Load subtitles from a plugin](../../../docs/guides/subtitles.md)
|
|
132
132
|
* @since 1.0.0
|
|
133
133
|
* @category Subtitles
|
|
134
134
|
*/
|
|
@@ -214,13 +214,12 @@ export interface Subtitles {
|
|
|
214
214
|
role?: "primary" | "secondary";
|
|
215
215
|
}): Promise<SubtitlesState>;
|
|
216
216
|
/**
|
|
217
|
-
* Upload a subtitle file's bytes (UTF-8 SRT, or ASS/SSA with
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
* once the commit was sent it completes.
|
|
217
|
+
* Upload a subtitle file's bytes (UTF-8 SRT, or ASS/SSA with `format: "ass"`)
|
|
218
|
+
* for the current source; select it unless `select: "none"`. `title` (1–200
|
|
219
|
+
* characters) names the track: data, or a {@link Text} the player translates
|
|
220
|
+
* (`text("{} · {}", [text("Simplified Chinese"), file])`). Aborting `signal`
|
|
221
|
+
* before the commit discards the upload (rejects with AbortError); once the
|
|
222
|
+
* commit was sent it completes.
|
|
224
223
|
*
|
|
225
224
|
* Limits: SRT ≤ 2 MiB and ≤ 10,000 cues; ASS ≤ 2 MiB with `[Script Info]`
|
|
226
225
|
* and `[Events]` and 1–20,000 `Dialogue:` lines. Convert other formats
|