@vestra-player/sdk 1.7.6 → 1.7.8

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.
@@ -1,5 +1,6 @@
1
1
  import type { AppInfo } from "./base.ts";
2
- import type { MediaJob } from "../../media.ts";
2
+ import type { Player } from "./playback.ts";
3
+ import type { MediaJob, WireExportCheck } from "../../media.ts";
3
4
  import type { Disposable } from "./base.ts";
4
5
  import type { Conditional } from "./playback.ts";
5
6
  /**
@@ -292,6 +293,11 @@ export interface ExportEncoding {
292
293
  * - `error.code` is `export-failed`, or `unsupported` for an export the
293
294
  * player cannot make as asked (a stream copy it cannot make, a
294
295
  * `videoBitrate: "source"` whose source bitrate it cannot tell).
296
+ * - an export of parts ({@link MediaCapture.export}) also has
297
+ * `progress.part` (from 1) and `progress.parts` while it runs, and
298
+ * `facts.join` once written;
299
+ * it can also end with `source-missing` or `source-changed` (since
300
+ * 1.7.8).
295
301
  *
296
302
  * @since 1.0.0
297
303
  * @category Media
@@ -476,4 +482,508 @@ export interface MediaCapture {
476
482
  * @since 1.0.0
477
483
  */
478
484
  capture(options?: CaptureOptions): Promise<Snapshot>;
485
+ /**
486
+ * Remembered local files: tokens for files the user opened, kept across
487
+ * restarts, for exports made later ({@link MediaCapture.export}) and for
488
+ * opening them again ({@link MediaSources.open}).
489
+ *
490
+ * @capability media.sources
491
+ * @since 1.7.8
492
+ */
493
+ readonly sources: MediaSources;
494
+ /**
495
+ * Export a clip whose input is ranges of remembered files instead of a
496
+ * snapshot: one part is a clip of one file, several parts are joined in
497
+ * the order given into one file. The same formats as a clip of a
498
+ * snapshot ({@link ExportOptions}: `copy` and `mp4`), the same job
499
+ * ({@link ExportJob}: the queue of 2 per plugin and 8 in the player,
500
+ * `done`, `cancel`, `outcome`); a snapshot's export is unchanged.
501
+ *
502
+ * `format: "copy"` copies each part without re-encoding, from the video
503
+ * keyframe at or before its start (as a copied clip), and needs every
504
+ * part to have the same video codec, profile, codec data, size, frame
505
+ * rate and pixel format and the same audio (or none):
506
+ * {@link MediaCapture.exportCheck} says whether they do and, if not, why.
507
+ * `format: "mp4"` re-encodes every part to H.264 + AAC at the first
508
+ * part's size (square pixels) and frame rate under the
509
+ * {@link ExportEncoding} ceilings, each picture scaled to fit and centred
510
+ * on black, the sound resampled to 48 kHz stereo (silence for a part
511
+ * without sound when another part has some).
512
+ *
513
+ * While it runs, `progress` covers the whole output (`done` and
514
+ * `total` in seconds) and says which part is being written (`part`
515
+ * from 1, of `parts`). A finished job's `facts.join` has the range each
516
+ * part was written from. A part whose file is gone ends the job
517
+ * `failed` with `source-missing`, a file changed since it was remembered
518
+ * with `source-changed`, parts a copy cannot write together with `unsupported`.
519
+ * Before writing, the player compares the free space with an estimate
520
+ * (the parts' share of their files for a copy; the picture for a
521
+ * re-encode) for the intermediate parts, kept in the player's own
522
+ * temporary folder, and for the output beside `destination`; too little
523
+ * ends the job `failed` with `no-space`. Cancelling removes everything
524
+ * written so far, and what a crash leaves in the temporary folder goes
525
+ * at the player's next start.
526
+ *
527
+ * @capability media.read and media.control, and media.sources (its
528
+ * tokens)
529
+ * @throws `invalid` (rejects) No part or more than 100, a part whose end
530
+ * is not after its start, parts longer than 24 hours in all, a relative
531
+ * destination, `encoding` with `copy` or `container` with `mp4`, an
532
+ * {@link ExportEncoding} value outside its set.
533
+ * @throws `missing` (rejects) A part's token is not one of this
534
+ * plugin's references (forgotten, or another plugin's).
535
+ * @throws `busy` (rejects) This plugin runs 2 exports (or the player 8).
536
+ * @throws `unavailable` (rejects) No FFmpeg, or the export worker could not
537
+ * start.
538
+ * @throws `capability` (rejects) The manifest does not declare
539
+ * `media.control` and `media.sources`.
540
+ *
541
+ * @example Export two ranges of remembered files as one file
542
+ * Two parts from two files become one file, copied as they are when the
543
+ * check allows it and re-encoded otherwise. `exportCheck` answers from
544
+ * the remembered facts; the job then runs in the player's export worker
545
+ * and `done` resolves with its terminal state.
546
+ * ```ts
547
+ * declare const intro: SourceReference, scene: SourceReference;
548
+ * // ---cut---
549
+ * const parts = [
550
+ * { source: intro.token, start: 0, end: 12 },
551
+ * { source: scene.token, start: 95.5, end: 130 },
552
+ * ];
553
+ * const check = await plugin.media.exportCheck(parts);
554
+ * if (check.blocking.length > 0) return; // a file is missing, say
555
+ * const job = await plugin.media.export({
556
+ * parts,
557
+ * destination: "/tmp/joined.mp4",
558
+ * format: check.copy.ok ? "copy" : "mp4",
559
+ * });
560
+ * const end = await job.done;
561
+ * await plugin.osd.show("Export: {}", [end.status]);
562
+ * ```
563
+ *
564
+ * @since 1.7.8
565
+ */
566
+ export(options: PartsExportOptions): Promise<ExportJob>;
567
+ /**
568
+ * Check an export before starting it, of parts or of a snapshot's clip:
569
+ * what blocks it (a part whose file is missing or changed, an unknown
570
+ * token, a range outside the file, a file without video), whether a
571
+ * stream copy (`format: "copy"`) can write it and, if not, each
572
+ * difference from the first part (`effects` for a processed snapshot,
573
+ * whose effects need a re-encode), and what a re-encode (`format:
574
+ * "mp4"`) writes (with `encoding`, under its ceilings). Parts are
575
+ * numbered from 0 in the order given; `{ snapshot, end }` is one part,
576
+ * the snapshot's clip from its time to `end`. For parts it reads the
577
+ * facts remembered with each reference and looks at each file on disk
578
+ * (nothing is decoded, so it is cheap enough to run on every change of
579
+ * a list); for a snapshot it reads the held file's streams.
580
+ *
581
+ * @capability media.control, and media.sources for parts
582
+ * @throws `invalid` (rejects) No part or more than 100, a time that is
583
+ * negative, past 24 hours (24 hours in all) or not finite, a snapshot
584
+ * `end` not after its time or past its duration, an invalid
585
+ * `encoding`.
586
+ * @throws `released` (rejects) The snapshot was released.
587
+ * @throws `busy` (rejects) This plugin has 4 checks or source requests
588
+ * running.
589
+ * @throws `capability` (rejects) The manifest does not declare
590
+ * `media.control` (and `media.sources` for parts).
591
+ *
592
+ * @example Say why the fast export is not possible
593
+ * The plugin shows a line under its list when the parts need a
594
+ * re-encode. Each reason names the part, the field that differs and both
595
+ * values, so the line can say "part 2 is 1920×818, part 1 is
596
+ * 3840×1714".
597
+ * ```ts
598
+ * declare const parts: ExportPart[];
599
+ * // ---cut---
600
+ * const check = await plugin.media.exportCheck(parts);
601
+ * if (!check.copy.ok) {
602
+ * // Parts count from 0; the first difference is enough for one line.
603
+ * const [first] = check.copy.reasons;
604
+ * if (first)
605
+ * console.log(`part ${first.part + 1} is ${first.value}, part 1 is ${first.expected}`);
606
+ * }
607
+ * ```
608
+ *
609
+ * @example Offer a fast cut of a snapshot only when it is possible
610
+ * The Clip page greys its Fast button when a stream copy of the marked
611
+ * range cannot be made. The same check takes a snapshot's clip: one part
612
+ * from the snapshot time to `end`.
613
+ * ```ts
614
+ * declare const snapshot: Snapshot;
615
+ * // ---cut---
616
+ * const check = await plugin.media.exportCheck({ snapshot, end: snapshot.time + 20 });
617
+ * const fast = check.copy.ok;
618
+ * console.log(fast ? "Fast" : "Precise only");
619
+ * ```
620
+ *
621
+ * @since 1.7.8
622
+ */
623
+ exportCheck(input: ExportPart[] | {
624
+ snapshot: Snapshot;
625
+ end: number;
626
+ }, options?: {
627
+ /** The re-encode's settings, for its size and frame rate. */
628
+ encoding?: ExportEncoding;
629
+ }): Promise<ExportCheck>;
630
+ }
631
+ /**
632
+ * A remembered local file, from {@link MediaSources}: its token and what the
633
+ * player knows of it. Never its path or its content.
634
+ *
635
+ * @since 1.7.8
636
+ * @category Media
637
+ */
638
+ export interface SourceReference {
639
+ /** The opaque token: this plugin's key for the file. Store it. */
640
+ readonly token: string;
641
+ /** The file's name, for display. */
642
+ readonly name: string;
643
+ /** Its duration in seconds. */
644
+ readonly duration: number;
645
+ /**
646
+ * `ok`; `missing` when no file is at its path any more (moved, renamed,
647
+ * deleted, a drive not connected); `changed` when the file there has
648
+ * another size or modification time than when it was remembered.
649
+ */
650
+ readonly status: "ok" | "missing" | "changed";
651
+ /** Its video stream (the default one), `null` for none. */
652
+ readonly video: {
653
+ /** FFmpeg's codec name (`h264`, `hevc`, `vp9`, …). */
654
+ codec: string;
655
+ /** Width in pixels as stored (before the sample aspect ratio). */
656
+ width: number;
657
+ /** Height in pixels. */
658
+ height: number;
659
+ /** Frames per second. */
660
+ fps: number;
661
+ /** FFmpeg's pixel format (`yuv420p`, …), `null` when unknown. */
662
+ pixelFormat: string | null;
663
+ } | null;
664
+ /** Its audio stream (the default one), `null` for none. */
665
+ readonly audio: {
666
+ /** FFmpeg's codec name (`aac`, `opus`, …). */
667
+ codec: string;
668
+ /** Samples per second. */
669
+ sampleRate: number;
670
+ /** Channel count. */
671
+ channels: number;
672
+ } | null;
673
+ }
674
+ /**
675
+ * `plugin.media.sources`: remembered local files. The player gives a
676
+ * plugin a token for the file playing now; the token survives restarts
677
+ * and stands for that file in {@link MediaCapture.export},
678
+ * {@link MediaCapture.exportCheck} and {@link MediaSources.open}.
679
+ *
680
+ * Uses beyond exports: a bookmarks or history plugin keeps tokens to
681
+ * reopen what the user watched at a position ({@link MediaSources.open},
682
+ * with Locate… when a file moved), a resume plugin follows files across
683
+ * renames, a compare plugin switches between two remembered files, a
684
+ * chapters plugin keeps its marks per file without storing paths.
685
+ *
686
+ * @remarks
687
+ * Tokens hide paths as an API convenience, not as a security boundary:
688
+ * while the file plays, `player.state.source` (`playback.read`) shows its
689
+ * path, and a plugin is an ordinary Node.js process, not sandboxed from
690
+ * the file system, that can find files by other means. What a token gives is a
691
+ * way to name the user's files without the plugin keeping their paths,
692
+ * and to find them again after a move.
693
+ *
694
+ * Only the player makes tokens, and only for a local file that is
695
+ * playing (the user opened it: the file dialog, a drop, the playlist, the
696
+ * command line); a stream, an address or a plugin's own picture is
697
+ * refused. A token belongs to the plugin that got it and means nothing to
698
+ * another. It gives the file's name, duration and stream facts, never its
699
+ * path or content. The player keeps the plugin's tokens in the profile
700
+ * until the plugin forgets them or is uninstalled, at most 500 per plugin.
701
+ * When a file has moved, {@link MediaSources.locate} lets the user find it
702
+ * again in the player's own file dialog.
703
+ *
704
+ * @capability media.sources
705
+ *
706
+ * @example Remember the playing file and check it later
707
+ * The plugin keeps the token in its storage and checks the file before
708
+ * using it. `remember` answers for the file playing now; `get` looks at
709
+ * the file on disk again, so a moved file reads `missing`.
710
+ * ```ts
711
+ * const store = plugin.storage.json("parts", { defaults: { tokens: [] as string[] } });
712
+ * const added = await plugin.media.sources.remember();
713
+ * store.save({ tokens: [...store.value.tokens, added.token] });
714
+ * // … after a restart:
715
+ * const again = await plugin.media.sources.get(added.token);
716
+ * if (again.status !== "ok") console.log(`${again.name} is ${again.status}`);
717
+ * ```
718
+ *
719
+ * @since 1.7.8
720
+ * @category Media
721
+ */
722
+ export interface MediaSources {
723
+ /**
724
+ * A token for the file playing now (the same token again for the same
725
+ * file as it is). Fails `unsupported` for a stream, an address or a
726
+ * plugin's picture, `stale` when the source changed since `ifCurrent`.
727
+ *
728
+ * @capability media.sources
729
+ * @throws `unsupported` (rejects) The source is not a local file, or the
730
+ * player cannot read its streams.
731
+ * @throws `stale` (rejects) The source changed since `ifCurrent`.
732
+ * @throws `limit` (rejects) The plugin holds 500 references; forget one.
733
+ * @throws `busy` (rejects) This plugin has 4 source requests or checks
734
+ * running; try again when one has answered.
735
+ * @throws `unavailable` (rejects) No FFmpeg to read the file with.
736
+ * @throws `capability` (rejects) The manifest does not declare
737
+ * `media.sources`.
738
+ *
739
+ * @example Add the marked range to a list, with a thumbnail
740
+ * The range the user marked becomes a part of the plugin's list. The
741
+ * token stands for the file; the plugin keeps it with the times, and the
742
+ * name is what the list shows. There is no thumbnail API: while the file
743
+ * plays, the plugin captures the part's first frame
744
+ * ({@link MediaCapture.capture}, `media.read` and `media.control`) and
745
+ * exports it into its own data directory; `plugin.ui.image` shows it
746
+ * scaled down.
747
+ * ```ts
748
+ * declare const list: { token: string; name: string; start: number; end: number; thumbnail: string }[];
749
+ * declare const start: number, end: number;
750
+ * // ---cut---
751
+ * const file = await plugin.media.sources.remember();
752
+ * // A new name each time: an export never overwrites a file.
753
+ * const thumbnail = `${plugin.dataDirectory}/thumb-${file.token}-${Date.now()}.jpg`;
754
+ * const snapshot = await plugin.media.capture({ at: start });
755
+ * try {
756
+ * await (await snapshot.export({ format: "jpeg", destination: thumbnail, quality: 80 })).done;
757
+ * } finally {
758
+ * await snapshot.dispose();
759
+ * }
760
+ * list.push({ token: file.token, name: file.name, start, end, thumbnail });
761
+ * // In the row: plugin.ui.image(thumbnail, { maxSide: 64 })
762
+ * ```
763
+ *
764
+ * @since 1.7.8
765
+ */
766
+ remember(options?: Conditional): Promise<SourceReference>;
767
+ /**
768
+ * The reference with its file looked at now: `status` says whether it
769
+ * is still there as it was.
770
+ *
771
+ * @capability media.sources
772
+ * @throws `missing` (rejects) Not one of this plugin's tokens.
773
+ * @throws `busy` (rejects) This plugin has 4 source requests or checks
774
+ * running; try again when one has answered.
775
+ * @throws `capability` (rejects) The manifest does not declare
776
+ * `media.sources`.
777
+ *
778
+ * @example Mark the parts whose file is gone
779
+ * At start the plugin checks each remembered file once. A part whose file
780
+ * was moved or deleted reads `missing`, and its row offers Locate.
781
+ * ```ts
782
+ * declare const tokens: string[];
783
+ * // ---cut---
784
+ * for (const token of tokens) {
785
+ * const file = await plugin.media.sources.get(token);
786
+ * if (file.status === "missing") console.log(`${file.name}: File missing`);
787
+ * }
788
+ * ```
789
+ *
790
+ * @since 1.7.8
791
+ */
792
+ get(token: string): Promise<SourceReference>;
793
+ /**
794
+ * Ask the user where the file is now: the player shows its own file
795
+ * dialog (named after the file, opened in its old folder) and, when the
796
+ * user picks a file, the token stands for that file from then on.
797
+ * Resolves `null` when the user cancels.
798
+ *
799
+ * @capability media.sources
800
+ * @throws `missing` (rejects) Not one of this plugin's tokens.
801
+ * @throws `busy` (rejects) Another dialog of the player is open, or this
802
+ * plugin showed a Locate dialog less than 2 seconds ago.
803
+ * @throws `unavailable` (rejects) No window to show the dialog in.
804
+ * @throws `unsupported` (rejects) The player cannot read the chosen file's
805
+ * streams.
806
+ * @throws `capability` (rejects) The manifest does not declare
807
+ * `media.sources`.
808
+ *
809
+ * @example Locate a moved file
810
+ * The row's Locate… button asks the user for the file. The token keeps
811
+ * its value, so every part that uses it works again.
812
+ * ```ts
813
+ * declare const token: string;
814
+ * // ---cut---
815
+ * const found = await plugin.media.sources.locate(token);
816
+ * if (found) console.log(`${found.name} found again`);
817
+ * ```
818
+ *
819
+ * @since 1.7.8
820
+ */
821
+ locate(token: string): Promise<SourceReference | null>;
822
+ /**
823
+ * The player forgets the token (an unknown one is ignored).
824
+ *
825
+ * @capability media.sources
826
+ * @throws `capability` (rejects) The manifest does not declare
827
+ * `media.sources`.
828
+ *
829
+ * @example Forget a file no part uses any more
830
+ * When the last part from a file leaves the list, the plugin lets the
831
+ * player forget the file, which frees one of its 500 references.
832
+ * ```ts
833
+ * declare const token: string;
834
+ * // ---cut---
835
+ * await plugin.media.sources.forget(token);
836
+ * ```
837
+ *
838
+ * @since 1.7.8
839
+ */
840
+ forget(token: string): Promise<void>;
841
+ /**
842
+ * Every reference this plugin holds, each with its file looked at now.
843
+ *
844
+ * @capability media.sources
845
+ * @throws `busy` (rejects) This plugin has 4 source requests or checks
846
+ * running; try again when one has answered.
847
+ * @throws `capability` (rejects) The manifest does not declare
848
+ * `media.sources`.
849
+ *
850
+ * @example Forget the references the list no longer uses
851
+ * After the user cleared the list, the plugin forgets every file none of
852
+ * its parts names. `list` gives all of the plugin's tokens, including
853
+ * ones its own storage lost.
854
+ * ```ts
855
+ * declare const used: Set<string>;
856
+ * // ---cut---
857
+ * for (const file of await plugin.media.sources.list())
858
+ * if (!used.has(file.token)) await plugin.media.sources.forget(file.token);
859
+ * ```
860
+ *
861
+ * @since 1.7.8
862
+ */
863
+ list(): Promise<SourceReference[]>;
864
+ /**
865
+ * Open the remembered file in the player and play it from `start`
866
+ * seconds (default its beginning): the user's "preview this part". It
867
+ * is an ordinary open, as {@link Player.open} of that file would be (the
868
+ * current source is replaced; the playlist treats it as any open), so it
869
+ * needs `playback.control` as `Player.open` does, and `media.sources` for
870
+ * the token. The plugin names the file by its token instead of keeping
871
+ * its path; that is a convenience, not a boundary: once the file plays,
872
+ * `player.state.source` (`playback.read`) shows its path, as for any
873
+ * open. Resolves once the file is loaded. A file that is gone or changed
874
+ * is refused before anything opens.
875
+ *
876
+ * @capability media.sources and playback.control (and playback.read, to
877
+ * follow the open until the file is loaded)
878
+ * @throws `source-missing` (rejects) No file is at the token's path any
879
+ * more; offer {@link MediaSources.locate}.
880
+ * @throws `source-changed` (rejects) The file changed since it was
881
+ * remembered; offer {@link MediaSources.locate}.
882
+ * @throws `missing` (rejects) Not one of this plugin's tokens.
883
+ * @throws `invalid` (rejects) `start` negative, or at or after the file's
884
+ * end.
885
+ * @throws `replaced` (rejects) Another source replaced it before it
886
+ * loaded.
887
+ * @throws `backend` (rejects) The player could not load the file.
888
+ * @throws `capability` (rejects) The manifest does not declare
889
+ * `media.sources` or `playback.control`.
890
+ *
891
+ * @example Preview a part on double-click
892
+ * Double-clicking a row of the plugin's list plays that part's file from
893
+ * the part's start. A file that has moved since is refused, and the row
894
+ * then offers Locate….
895
+ * ```ts
896
+ * declare const part: { token: string; start: number };
897
+ * // ---cut---
898
+ * try {
899
+ * await plugin.media.sources.open(part.token, { start: part.start });
900
+ * } catch (error) {
901
+ * // Moved or rewritten: the row shows "File missing · Locate…".
902
+ * if ((error as { code?: string }).code === "source-missing") console.log("missing");
903
+ * }
904
+ * ```
905
+ *
906
+ * @since 1.7.8
907
+ */
908
+ open(token: string, options?: {
909
+ /** Seconds of the file to start at; default 0. */
910
+ start?: number;
911
+ }): Promise<void>;
479
912
  }
913
+ /**
914
+ * One part of an export of remembered files: a range of one file, in its
915
+ * own seconds.
916
+ *
917
+ * @since 1.7.8
918
+ * @category Media
919
+ */
920
+ export interface ExportPart {
921
+ /**
922
+ * The file's token ({@link SourceReference.token}), from
923
+ * {@link MediaSources.remember}: a token, not a path.
924
+ */
925
+ source: string;
926
+ /** Start, seconds of the file. */
927
+ start: number;
928
+ /** End, seconds of the file; after `start`. */
929
+ end: number;
930
+ }
931
+ /**
932
+ * Options of {@link MediaCapture.export}: the parts in order (1 to 100),
933
+ * where to write the file (never over an existing one) and the format, as
934
+ * for a clip of a snapshot ({@link ExportOptions}).
935
+ *
936
+ * The fields are a snapshot clip's: `destination`, `format` (`copy` or
937
+ * `mp4`), `container` and `encoding` mean the same there, so moving an
938
+ * export from a snapshot to parts changes only its input (`parts` instead
939
+ * of the snapshot and `end`).
940
+ *
941
+ * @since 1.7.8
942
+ * @category Media
943
+ */
944
+ export type PartsExportOptions = {
945
+ /** The parts, in the order they are written. */
946
+ parts: ExportPart[];
947
+ /** Absolute path of the new file. */
948
+ destination: string;
949
+ } & ({
950
+ /**
951
+ * Copy every part as it is (lossless, about as fast as the disk);
952
+ * each part starts on the keyframe at or before its start.
953
+ */
954
+ format: "copy";
955
+ /**
956
+ * `auto` (default): MP4 when the codecs fit it, otherwise MKV (the
957
+ * extension of `destination` follows). `mp4` fails `unsupported`
958
+ * when they do not.
959
+ */
960
+ container?: "auto" | "mp4" | "mkv";
961
+ } | {
962
+ /** Re-encode every part to the first part's size and frame rate. */
963
+ format: "mp4";
964
+ /** The encoder settings, as for a clip. */
965
+ encoding?: ExportEncoding;
966
+ });
967
+ /**
968
+ * The answer of {@link MediaCapture.exportCheck}.
969
+ *
970
+ * - `blocking`: problems that stop any export of the parts, each with its part (from 0)
971
+ * and `problem`: `unknown` (not this plugin's token), `missing`,
972
+ * `changed`, `noVideo` or `range` (outside the file; `duration` is the
973
+ * file's, or shorter than one frame).
974
+ * - `copy`: `{ ok: true, container }` when a stream copy can write the
975
+ * parts, else `{ ok: false, reasons }`: each difference of a part from
976
+ * the first, `field` being `videoCodec`, `videoParams` (profile or codec
977
+ * data), `size` (`"1920×818"`), `fps`, `pixelFormat`, `audio` or `effects` (a processed snapshot)
978
+ * (`"aac 44100 Hz 1 ch"`, `"none"`), with the part's `value` and the
979
+ * first part's (`expected`).
980
+ * - `encode`: what a re-encode writes: the first part's size and frame
981
+ * rate (under the encoding's ceilings) and 48 kHz stereo audio when any
982
+ * part has sound (`null` audio otherwise); `null` when the first part
983
+ * has no video.
984
+ * - `duration`: the parts' total length in seconds.
985
+ *
986
+ * @since 1.7.8
987
+ * @category Media
988
+ */
989
+ export type ExportCheck = WireExportCheck;
package/dist/wire.d.ts CHANGED
@@ -1036,6 +1036,34 @@ export declare function createWire(transport: Transport): {
1036
1036
  cancel: "requested" | "tooLate" | "terminal";
1037
1037
  }>;
1038
1038
  operation: (operationId: number) => Promise<import("./media.ts").MediaOperation>;
1039
+ startParts: (options: {
1040
+ operationId: number;
1041
+ parts: import("./media.ts").WireExportPart[];
1042
+ destination: string;
1043
+ } & ({
1044
+ kind: "rawCopy";
1045
+ container?: "auto" | "mp4" | "mkv";
1046
+ } | {
1047
+ kind: "rawMp4";
1048
+ encoding?: import("./media.ts").WireEncoding;
1049
+ })) => Promise<{
1050
+ jobId: number;
1051
+ status: "queued";
1052
+ }>;
1053
+ check: (parts: import("./media.ts").WireExportPart[], encoding?: import("./media.ts").WireEncoding) => Promise<import("./media.ts").WireExportCheck>;
1054
+ checkSnapshot: (snapshotId: number, end: number, encoding?: import("./media.ts").WireEncoding) => Promise<import("./media.ts").WireExportCheck>;
1055
+ };
1056
+ mediaSources: {
1057
+ remember: (expected?: SourceStamp) => Promise<import("./media.ts").WireSourceReference>;
1058
+ get: (token: string) => Promise<import("./media.ts").WireSourceReference>;
1059
+ locate: (token: string) => Promise<import("./media.ts").WireSourceReference | null>;
1060
+ forget: (token: string) => Promise<void>;
1061
+ list: () => Promise<import("./media.ts").WireSourceReference[]>;
1062
+ open: (options: {
1063
+ token: string;
1064
+ operationId: number;
1065
+ start?: number;
1066
+ }) => Promise<import("./source.ts").SourceOperation>;
1039
1067
  };
1040
1068
  source: {
1041
1069
  state: () => Promise<import("./source.ts").SourceState>;
package/llms.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  # Vestra Player SDK
2
2
 
3
- > @vestra-player/sdk 1.7.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/.
3
+ > @vestra-player/sdk 1.7.8: 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
 
@@ -26,7 +26,7 @@
26
26
  ## API
27
27
 
28
28
  - `/API/Commands`: 15 entries: CommandState, Bindable, Condition, When, MenuId, BarButtonIcon, CommandButton, CommandOptions, Command, Commands, HostAction, Host, BindingRef, BindingInfo, Bindings
29
- - `/API/Media`: 7 entries: CaptureOptions, Snapshot, ExportOptions, ExportEncoding, JobState, ExportJob, MediaCapture
29
+ - `/API/Media`: 12 entries: CaptureOptions, Snapshot, ExportOptions, ExportEncoding, JobState, ExportJob, MediaCapture, SourceReference, MediaSources, ExportPart, PartsExportOptions, ExportCheck
30
30
  - `/API/Packages`: 10 entries: PackageManifest, PackageSource, InstallOptions, PackageCandidate, PackageChangeStatus, PackageChange, PluginInfo, PluginDisplay, PluginWarning, Packages
31
31
  - `/API/Playback`: 33 entries: CommandKeys, MarkKind, TimelineMark, RangeStyle, TimelineRange, TimelineLayer, Timeline, AudioTrack, PlayerState, AudioDevice, Chapter, Conditional, Media, Scrub, StreamFrame,…
32
32
  - `/API/Plugin`: 21 entries: Disposable, PluginError, Scope, Plugin, StopReason, DisposeInfo, WindowState, MainWindow, AppInfo, App, SystemInfo, DisplayInfo, Wire, WireView, WireCommands, WireCommandOptions,…
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vestra-player/sdk",
3
- "version": "1.7.6",
3
+ "version": "1.7.8",
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": {