@vivix-labs/media-tools 1.0.0-beta.20 → 1.0.0-beta.21

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/dist/shared.d.ts CHANGED
@@ -1,8 +1,23 @@
1
1
  import * as React from 'react';
2
2
  import { ReactNode } from 'react';
3
+ import { ClientContext } from 'vivix-studio/sdk/client';
3
4
  import { CallContext as CallContext$1, z } from 'vivix-studio/sdk/shared';
4
5
  import { MenuItem } from '@vivix-labs/ui-system';
5
6
 
7
+ type SequenceSound = {
8
+ state: 'original' | 'loading';
9
+ } | {
10
+ state: 'error';
11
+ message: string;
12
+ } | {
13
+ state: 'mixed';
14
+ url?: string;
15
+ segments: Extract<AudioPreviewResult, {
16
+ state: 'ready';
17
+ }>['segments'];
18
+ };
19
+ declare function watchSequenceSound(client: ClientContext, instanceId: string, getInputs: () => SequenceVideoInput[] | Promise<SequenceVideoInput[]>, update: (sound: SequenceSound) => void): () => void;
20
+
6
21
  type Scope = {
7
22
  kind: 'user' | 'project';
8
23
  id: string;
@@ -112,9 +127,11 @@ interface MutationResult {
112
127
  items: SqlRow[];
113
128
  }
114
129
  interface Query {
130
+ excludeArchived?: boolean;
115
131
  typeId: string;
116
132
  search?: string;
117
133
  kind?: string;
134
+ purpose?: string | string[];
118
135
  tag?: string;
119
136
  targetAssetId?: string;
120
137
  taskId?: string;
@@ -164,6 +181,11 @@ interface DataAPI {
164
181
  countVersionedRecords?(typeId: string): number;
165
182
  query(input: SqlInput): Promise<SqlRow[]>;
166
183
  mutate(input: MutationInput, call: CallContext): Promise<MutationResult>;
184
+ incomingRelations(targetObjectId: string, kind: 'input'): {
185
+ objectId: string;
186
+ versionId: string;
187
+ targetVersionId: string;
188
+ }[];
167
189
  versions(id: string): VersionValue[];
168
190
  version(ref: VersionRef): VersionValue;
169
191
  files(ref: VersionRef): FileValue[];
@@ -464,6 +486,168 @@ declare const saveEdit: z.ZodObject<{
464
486
  expectedRevision: z.ZodOptional<z.ZodNumber>;
465
487
  }, z.core.$strict>;
466
488
  type SaveEdit = z.infer<typeof saveEdit>;
489
+ declare const audioMix: z.ZodObject<{
490
+ version: z.ZodLiteral<1>;
491
+ originalGainDb: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
492
+ originals: z.ZodOptional<z.ZodArray<z.ZodObject<{
493
+ inputIndex: z.ZodNumber;
494
+ gainDb: z.ZodNullable<z.ZodNumber>;
495
+ role: z.ZodOptional<z.ZodEnum<{
496
+ dialogue: "dialogue";
497
+ ambience: "ambience";
498
+ }>>;
499
+ }, z.core.$strict>>>;
500
+ tracks: z.ZodArray<z.ZodObject<{
501
+ id: z.ZodString;
502
+ file: z.ZodObject<{
503
+ source: z.ZodObject<{
504
+ storeId: z.ZodUUID;
505
+ objectId: z.ZodUUID;
506
+ versionId: z.ZodUUID;
507
+ }, z.core.$strict>;
508
+ fileId: z.ZodUUID;
509
+ }, z.core.$strict>;
510
+ role: z.ZodEnum<{
511
+ narration: "narration";
512
+ music: "music";
513
+ sfx: "sfx";
514
+ }>;
515
+ atMs: z.ZodNumber;
516
+ inMs: z.ZodOptional<z.ZodNumber>;
517
+ outMs: z.ZodOptional<z.ZodNumber>;
518
+ gainDb: z.ZodOptional<z.ZodNumber>;
519
+ fadeInMs: z.ZodOptional<z.ZodNumber>;
520
+ fadeOutMs: z.ZodOptional<z.ZodNumber>;
521
+ }, z.core.$strict>>;
522
+ ducking: z.ZodOptional<z.ZodBoolean>;
523
+ loudness: z.ZodOptional<z.ZodEnum<{
524
+ "studio-web-v1": "studio-web-v1";
525
+ off: "off";
526
+ }>>;
527
+ }, z.core.$strict>;
528
+ type AudioMix = z.infer<typeof audioMix>;
529
+ declare const maxSequenceInputs = 64;
530
+ declare const audioQuery: z.ZodObject<{
531
+ inputs: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
532
+ kind: z.ZodLiteral<"source">;
533
+ file: z.ZodObject<{
534
+ source: z.ZodObject<{
535
+ storeId: z.ZodUUID;
536
+ objectId: z.ZodUUID;
537
+ versionId: z.ZodUUID;
538
+ }, z.core.$strict>;
539
+ fileId: z.ZodUUID;
540
+ }, z.core.$strict>;
541
+ trimEndMs: z.ZodOptional<z.ZodNumber>;
542
+ }, z.core.$strict>, z.ZodObject<{
543
+ kind: z.ZodLiteral<"edit">;
544
+ editRef: z.ZodObject<{
545
+ storeId: z.ZodUUID;
546
+ objectId: z.ZodUUID;
547
+ versionId: z.ZodUUID;
548
+ }, z.core.$strict>;
549
+ }, z.core.$strict>], "kind">>;
550
+ }, z.core.$strict>;
551
+ declare const previewQuery: z.ZodObject<{
552
+ inputs: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
553
+ kind: z.ZodLiteral<"source">;
554
+ file: z.ZodObject<{
555
+ source: z.ZodObject<{
556
+ storeId: z.ZodUUID;
557
+ objectId: z.ZodUUID;
558
+ versionId: z.ZodUUID;
559
+ }, z.core.$strict>;
560
+ fileId: z.ZodUUID;
561
+ }, z.core.$strict>;
562
+ trimEndMs: z.ZodOptional<z.ZodNumber>;
563
+ }, z.core.$strict>, z.ZodObject<{
564
+ kind: z.ZodLiteral<"edit">;
565
+ editRef: z.ZodObject<{
566
+ storeId: z.ZodUUID;
567
+ objectId: z.ZodUUID;
568
+ versionId: z.ZodUUID;
569
+ }, z.core.$strict>;
570
+ }, z.core.$strict>], "kind">>;
571
+ knownRevision: z.ZodOptional<z.ZodNumber>;
572
+ }, z.core.$strict>;
573
+ declare const audioPreviewResult: z.ZodDiscriminatedUnion<[z.ZodObject<{
574
+ state: z.ZodLiteral<"original">;
575
+ revision: z.ZodNumber;
576
+ }, z.core.$strip>, z.ZodObject<{
577
+ state: z.ZodLiteral<"unchanged">;
578
+ }, z.core.$strip>, z.ZodObject<{
579
+ state: z.ZodLiteral<"preparing">;
580
+ }, z.core.$strip>, z.ZodObject<{
581
+ state: z.ZodLiteral<"ready">;
582
+ revision: z.ZodNumber;
583
+ file: z.ZodNullable<z.ZodType<`vivix-resource://file/${string}`, unknown, z.core.$ZodTypeInternals<`vivix-resource://file/${string}`, unknown>>>;
584
+ segments: z.ZodArray<z.ZodObject<{
585
+ startMs: z.ZodNumber;
586
+ durationMs: z.ZodNumber;
587
+ }, z.core.$strip>>;
588
+ }, z.core.$strip>], "state">;
589
+ type AudioPreviewResult = z.infer<typeof audioPreviewResult>;
590
+ declare const saveAudio: z.ZodObject<{
591
+ inputs: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
592
+ kind: z.ZodLiteral<"source">;
593
+ file: z.ZodObject<{
594
+ source: z.ZodObject<{
595
+ storeId: z.ZodUUID;
596
+ objectId: z.ZodUUID;
597
+ versionId: z.ZodUUID;
598
+ }, z.core.$strict>;
599
+ fileId: z.ZodUUID;
600
+ }, z.core.$strict>;
601
+ trimEndMs: z.ZodOptional<z.ZodNumber>;
602
+ }, z.core.$strict>, z.ZodObject<{
603
+ kind: z.ZodLiteral<"edit">;
604
+ editRef: z.ZodObject<{
605
+ storeId: z.ZodUUID;
606
+ objectId: z.ZodUUID;
607
+ versionId: z.ZodUUID;
608
+ }, z.core.$strict>;
609
+ }, z.core.$strict>], "kind">>;
610
+ expectedRevision: z.ZodNumber;
611
+ mix: z.ZodNullable<z.ZodObject<{
612
+ version: z.ZodLiteral<1>;
613
+ originalGainDb: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
614
+ originals: z.ZodOptional<z.ZodArray<z.ZodObject<{
615
+ inputIndex: z.ZodNumber;
616
+ gainDb: z.ZodNullable<z.ZodNumber>;
617
+ role: z.ZodOptional<z.ZodEnum<{
618
+ dialogue: "dialogue";
619
+ ambience: "ambience";
620
+ }>>;
621
+ }, z.core.$strict>>>;
622
+ tracks: z.ZodArray<z.ZodObject<{
623
+ id: z.ZodString;
624
+ file: z.ZodObject<{
625
+ source: z.ZodObject<{
626
+ storeId: z.ZodUUID;
627
+ objectId: z.ZodUUID;
628
+ versionId: z.ZodUUID;
629
+ }, z.core.$strict>;
630
+ fileId: z.ZodUUID;
631
+ }, z.core.$strict>;
632
+ role: z.ZodEnum<{
633
+ narration: "narration";
634
+ music: "music";
635
+ sfx: "sfx";
636
+ }>;
637
+ atMs: z.ZodNumber;
638
+ inMs: z.ZodOptional<z.ZodNumber>;
639
+ outMs: z.ZodOptional<z.ZodNumber>;
640
+ gainDb: z.ZodOptional<z.ZodNumber>;
641
+ fadeInMs: z.ZodOptional<z.ZodNumber>;
642
+ fadeOutMs: z.ZodOptional<z.ZodNumber>;
643
+ }, z.core.$strict>>;
644
+ ducking: z.ZodOptional<z.ZodBoolean>;
645
+ loudness: z.ZodOptional<z.ZodEnum<{
646
+ "studio-web-v1": "studio-web-v1";
647
+ off: "off";
648
+ }>>;
649
+ }, z.core.$strict>>;
650
+ }, z.core.$strict>;
467
651
  declare const processVideo: z.ZodObject<{
468
652
  input: z.ZodDiscriminatedUnion<[z.ZodObject<{
469
653
  kind: z.ZodLiteral<"source">;
@@ -485,6 +669,53 @@ declare const processVideo: z.ZodObject<{
485
669
  }, z.core.$strict>], "kind">;
486
670
  outputName: z.ZodString;
487
671
  retryOfJobId: z.ZodOptional<z.ZodUUID>;
672
+ remix: z.ZodOptional<z.ZodObject<{
673
+ basis: z.ZodEnum<{
674
+ sources: "sources";
675
+ master: "master";
676
+ }>;
677
+ mix: z.ZodObject<{
678
+ version: z.ZodLiteral<1>;
679
+ originalGainDb: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
680
+ originals: z.ZodOptional<z.ZodArray<z.ZodObject<{
681
+ inputIndex: z.ZodNumber;
682
+ gainDb: z.ZodNullable<z.ZodNumber>;
683
+ role: z.ZodOptional<z.ZodEnum<{
684
+ dialogue: "dialogue";
685
+ ambience: "ambience";
686
+ }>>;
687
+ }, z.core.$strict>>>;
688
+ tracks: z.ZodArray<z.ZodObject<{
689
+ id: z.ZodString;
690
+ file: z.ZodObject<{
691
+ source: z.ZodObject<{
692
+ storeId: z.ZodUUID;
693
+ objectId: z.ZodUUID;
694
+ versionId: z.ZodUUID;
695
+ }, z.core.$strict>;
696
+ fileId: z.ZodUUID;
697
+ }, z.core.$strict>;
698
+ role: z.ZodEnum<{
699
+ narration: "narration";
700
+ music: "music";
701
+ sfx: "sfx";
702
+ }>;
703
+ atMs: z.ZodNumber;
704
+ inMs: z.ZodOptional<z.ZodNumber>;
705
+ outMs: z.ZodOptional<z.ZodNumber>;
706
+ gainDb: z.ZodOptional<z.ZodNumber>;
707
+ fadeInMs: z.ZodOptional<z.ZodNumber>;
708
+ fadeOutMs: z.ZodOptional<z.ZodNumber>;
709
+ }, z.core.$strict>>;
710
+ ducking: z.ZodOptional<z.ZodBoolean>;
711
+ loudness: z.ZodOptional<z.ZodEnum<{
712
+ "studio-web-v1": "studio-web-v1";
713
+ off: "off";
714
+ }>>;
715
+ }, z.core.$strict>;
716
+ expectedAssetRevision: z.ZodNumber;
717
+ expectedMixRevision: z.ZodNumber;
718
+ }, z.core.$strict>>;
488
719
  }, z.core.$strict>;
489
720
  declare const canvas: z.ZodObject<{
490
721
  width: z.ZodNumber;
@@ -513,9 +744,9 @@ declare const exportSettings: z.ZodObject<{
513
744
  resolution: z.ZodUnion<readonly [z.ZodLiteral<"source">, z.ZodLiteral<480>, z.ZodLiteral<720>, z.ZodLiteral<1080>, z.ZodLiteral<2160>]>;
514
745
  frameRate: z.ZodUnion<readonly [z.ZodLiteral<"source">, z.ZodLiteral<24>, z.ZodLiteral<25>, z.ZodLiteral<30>, z.ZodLiteral<50>, z.ZodLiteral<60>]>;
515
746
  quality: z.ZodEnum<{
516
- small: "small";
517
747
  high: "high";
518
748
  standard: "standard";
749
+ small: "small";
519
750
  }>;
520
751
  audio: z.ZodBoolean;
521
752
  }, z.core.$strict>;
@@ -563,9 +794,9 @@ declare const processSequence: z.ZodObject<{
563
794
  resolution: z.ZodUnion<readonly [z.ZodLiteral<"source">, z.ZodLiteral<480>, z.ZodLiteral<720>, z.ZodLiteral<1080>, z.ZodLiteral<2160>]>;
564
795
  frameRate: z.ZodUnion<readonly [z.ZodLiteral<"source">, z.ZodLiteral<24>, z.ZodLiteral<25>, z.ZodLiteral<30>, z.ZodLiteral<50>, z.ZodLiteral<60>]>;
565
796
  quality: z.ZodEnum<{
566
- small: "small";
567
797
  high: "high";
568
798
  standard: "standard";
799
+ small: "small";
569
800
  }>;
570
801
  audio: z.ZodBoolean;
571
802
  }, z.core.$strict>>;
@@ -603,6 +834,53 @@ declare const mediaRequest: z.ZodDiscriminatedUnion<[z.ZodObject<{
603
834
  }, z.core.$strict>], "kind">;
604
835
  outputName: z.ZodString;
605
836
  retryOfJobId: z.ZodOptional<z.ZodUUID>;
837
+ remix: z.ZodOptional<z.ZodObject<{
838
+ basis: z.ZodEnum<{
839
+ sources: "sources";
840
+ master: "master";
841
+ }>;
842
+ mix: z.ZodObject<{
843
+ version: z.ZodLiteral<1>;
844
+ originalGainDb: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
845
+ originals: z.ZodOptional<z.ZodArray<z.ZodObject<{
846
+ inputIndex: z.ZodNumber;
847
+ gainDb: z.ZodNullable<z.ZodNumber>;
848
+ role: z.ZodOptional<z.ZodEnum<{
849
+ dialogue: "dialogue";
850
+ ambience: "ambience";
851
+ }>>;
852
+ }, z.core.$strict>>>;
853
+ tracks: z.ZodArray<z.ZodObject<{
854
+ id: z.ZodString;
855
+ file: z.ZodObject<{
856
+ source: z.ZodObject<{
857
+ storeId: z.ZodUUID;
858
+ objectId: z.ZodUUID;
859
+ versionId: z.ZodUUID;
860
+ }, z.core.$strict>;
861
+ fileId: z.ZodUUID;
862
+ }, z.core.$strict>;
863
+ role: z.ZodEnum<{
864
+ narration: "narration";
865
+ music: "music";
866
+ sfx: "sfx";
867
+ }>;
868
+ atMs: z.ZodNumber;
869
+ inMs: z.ZodOptional<z.ZodNumber>;
870
+ outMs: z.ZodOptional<z.ZodNumber>;
871
+ gainDb: z.ZodOptional<z.ZodNumber>;
872
+ fadeInMs: z.ZodOptional<z.ZodNumber>;
873
+ fadeOutMs: z.ZodOptional<z.ZodNumber>;
874
+ }, z.core.$strict>>;
875
+ ducking: z.ZodOptional<z.ZodBoolean>;
876
+ loudness: z.ZodOptional<z.ZodEnum<{
877
+ "studio-web-v1": "studio-web-v1";
878
+ off: "off";
879
+ }>>;
880
+ }, z.core.$strict>;
881
+ expectedAssetRevision: z.ZodNumber;
882
+ expectedMixRevision: z.ZodNumber;
883
+ }, z.core.$strict>>;
606
884
  }, z.core.$strict>;
607
885
  }, z.core.$strict>, z.ZodObject<{
608
886
  operation: z.ZodLiteral<"sequence.process">;
@@ -649,9 +927,9 @@ declare const mediaRequest: z.ZodDiscriminatedUnion<[z.ZodObject<{
649
927
  resolution: z.ZodUnion<readonly [z.ZodLiteral<"source">, z.ZodLiteral<480>, z.ZodLiteral<720>, z.ZodLiteral<1080>, z.ZodLiteral<2160>]>;
650
928
  frameRate: z.ZodUnion<readonly [z.ZodLiteral<"source">, z.ZodLiteral<24>, z.ZodLiteral<25>, z.ZodLiteral<30>, z.ZodLiteral<50>, z.ZodLiteral<60>]>;
651
929
  quality: z.ZodEnum<{
652
- small: "small";
653
930
  high: "high";
654
931
  standard: "standard";
932
+ small: "small";
655
933
  }>;
656
934
  audio: z.ZodBoolean;
657
935
  }, z.core.$strict>>;
@@ -710,6 +988,53 @@ declare const jobsQuery: z.ZodObject<{
710
988
  }, z.core.$strict>], "kind">;
711
989
  outputName: z.ZodString;
712
990
  retryOfJobId: z.ZodOptional<z.ZodUUID>;
991
+ remix: z.ZodOptional<z.ZodObject<{
992
+ basis: z.ZodEnum<{
993
+ sources: "sources";
994
+ master: "master";
995
+ }>;
996
+ mix: z.ZodObject<{
997
+ version: z.ZodLiteral<1>;
998
+ originalGainDb: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
999
+ originals: z.ZodOptional<z.ZodArray<z.ZodObject<{
1000
+ inputIndex: z.ZodNumber;
1001
+ gainDb: z.ZodNullable<z.ZodNumber>;
1002
+ role: z.ZodOptional<z.ZodEnum<{
1003
+ dialogue: "dialogue";
1004
+ ambience: "ambience";
1005
+ }>>;
1006
+ }, z.core.$strict>>>;
1007
+ tracks: z.ZodArray<z.ZodObject<{
1008
+ id: z.ZodString;
1009
+ file: z.ZodObject<{
1010
+ source: z.ZodObject<{
1011
+ storeId: z.ZodUUID;
1012
+ objectId: z.ZodUUID;
1013
+ versionId: z.ZodUUID;
1014
+ }, z.core.$strict>;
1015
+ fileId: z.ZodUUID;
1016
+ }, z.core.$strict>;
1017
+ role: z.ZodEnum<{
1018
+ narration: "narration";
1019
+ music: "music";
1020
+ sfx: "sfx";
1021
+ }>;
1022
+ atMs: z.ZodNumber;
1023
+ inMs: z.ZodOptional<z.ZodNumber>;
1024
+ outMs: z.ZodOptional<z.ZodNumber>;
1025
+ gainDb: z.ZodOptional<z.ZodNumber>;
1026
+ fadeInMs: z.ZodOptional<z.ZodNumber>;
1027
+ fadeOutMs: z.ZodOptional<z.ZodNumber>;
1028
+ }, z.core.$strict>>;
1029
+ ducking: z.ZodOptional<z.ZodBoolean>;
1030
+ loudness: z.ZodOptional<z.ZodEnum<{
1031
+ "studio-web-v1": "studio-web-v1";
1032
+ off: "off";
1033
+ }>>;
1034
+ }, z.core.$strict>;
1035
+ expectedAssetRevision: z.ZodNumber;
1036
+ expectedMixRevision: z.ZodNumber;
1037
+ }, z.core.$strict>>;
713
1038
  }, z.core.$strict>, z.ZodObject<{
714
1039
  inputs: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
715
1040
  kind: z.ZodLiteral<"source">;
@@ -753,9 +1078,9 @@ declare const jobsQuery: z.ZodObject<{
753
1078
  resolution: z.ZodUnion<readonly [z.ZodLiteral<"source">, z.ZodLiteral<480>, z.ZodLiteral<720>, z.ZodLiteral<1080>, z.ZodLiteral<2160>]>;
754
1079
  frameRate: z.ZodUnion<readonly [z.ZodLiteral<"source">, z.ZodLiteral<24>, z.ZodLiteral<25>, z.ZodLiteral<30>, z.ZodLiteral<50>, z.ZodLiteral<60>]>;
755
1080
  quality: z.ZodEnum<{
756
- small: "small";
757
1081
  high: "high";
758
1082
  standard: "standard";
1083
+ small: "small";
759
1084
  }>;
760
1085
  audio: z.ZodBoolean;
761
1086
  }, z.core.$strict>>;
@@ -849,4 +1174,4 @@ interface MediaToolsClient {
849
1174
  resolve(input: VideoInput): Promise<ResolvedVideo>;
850
1175
  }
851
1176
 
852
- export { type AcceptedJob, type CompareSlot, Config, type EditDescriptor, type EditReadData, type ExportSettings, type Geometry, type JobPage, type JobState, type MediaJob, type MediaJobsProps, type MediaRequest, type MediaToolsClient, type MediaToolsConfig, type MediaToolsService, type PixelRect, type ProcessSequence, type ProcessVideo, type Recipe, type ResolvedVideo, type SaveEdit, type SavedEdit, type SequenceVideoInput, type VideoCompareProps, type VideoEditorProps, type VideoExportProps, type VideoFileRef, type VideoInput, type VideoMetadata, canvas, colorAdjustment, editDescriptor, exportFormat, exportSettings, geometry, jobStates, jobsQuery, mediaError, mediaRequest, metadata, neutralColor, normalizeRecipe, packageVersion, processSequence, processVideo, readSavedEdit, recipe, recipeDurationMs, sameFile, saveEdit, versionRef, videoEditorTitles, videoFileRef, videoInput };
1177
+ export { type AcceptedJob, type AudioMix, type AudioPreviewResult, type CompareSlot, Config, type EditDescriptor, type EditReadData, type ExportSettings, type Geometry, type JobPage, type JobState, type MediaJob, type MediaJobsProps, type MediaRequest, type MediaToolsClient, type MediaToolsConfig, type MediaToolsService, type PixelRect, type ProcessSequence, type ProcessVideo, type Recipe, type ResolvedVideo, type SaveEdit, type SavedEdit, type SequenceSound, type SequenceVideoInput, type VideoCompareProps, type VideoEditorProps, type VideoExportProps, type VideoFileRef, type VideoInput, type VideoMetadata, audioMix, audioPreviewResult, audioQuery, canvas, colorAdjustment, editDescriptor, exportFormat, exportSettings, geometry, jobStates, jobsQuery, maxSequenceInputs, mediaError, mediaRequest, metadata, neutralColor, normalizeRecipe, packageVersion, previewQuery, processSequence, processVideo, readSavedEdit, recipe, recipeDurationMs, sameFile, saveAudio, saveEdit, sequenceVideoInput, versionRef, videoEditorTitles, videoFileRef, videoInput, watchSequenceSound };
package/dist/shared.js CHANGED
@@ -1,3 +1,76 @@
1
+ // packages/media-tools/src/watch-sequence-sound.ts
2
+ function watchSequenceSound(client, instanceId, getInputs, update) {
3
+ const abort = new AbortController();
4
+ let inputs, revision, url;
5
+ let timer, running = false;
6
+ const release = () => {
7
+ if (url) URL.revokeObjectURL(url);
8
+ url = void 0;
9
+ };
10
+ async function refresh() {
11
+ clearTimeout(timer);
12
+ if (running || abort.signal.aborted) return;
13
+ running = true;
14
+ let delay = 4e3;
15
+ try {
16
+ inputs ??= await getInputs();
17
+ if (abort.signal.aborted) return;
18
+ const result = await client.invoke(
19
+ { instanceId, operationId: "sequence.audio.preview" },
20
+ { inputs, ...revision !== void 0 && { knownRevision: revision } }
21
+ );
22
+ if (abort.signal.aborted) return;
23
+ if (result.state === "preparing") {
24
+ release();
25
+ delay = 600;
26
+ update({ state: "loading" });
27
+ } else if (result.state === "original") {
28
+ release();
29
+ revision = result.revision;
30
+ update({ state: "original" });
31
+ } else if (result.state === "ready") {
32
+ let blob;
33
+ if (result.file) {
34
+ const response = await fetch(client.transfers.forInstance(instanceId).url(result.file), {
35
+ signal: abort.signal
36
+ });
37
+ if (!response.ok) throw Error("Could not load the mixed audio preview.");
38
+ blob = await response.blob();
39
+ }
40
+ if (abort.signal.aborted) return;
41
+ release();
42
+ url = blob && URL.createObjectURL(blob);
43
+ revision = result.revision;
44
+ update({ state: "mixed", ...url && { url }, segments: result.segments });
45
+ }
46
+ } catch (error) {
47
+ if (!abort.signal.aborted) {
48
+ revision = void 0;
49
+ update({
50
+ state: "error",
51
+ message: error instanceof Error ? error.message : "Could not load the mixed audio preview."
52
+ });
53
+ }
54
+ } finally {
55
+ running = false;
56
+ if (!abort.signal.aborted && !document.hidden) timer = setTimeout(refresh, delay);
57
+ }
58
+ }
59
+ const visible = () => {
60
+ if (!document.hidden) void refresh();
61
+ };
62
+ document.addEventListener("visibilitychange", visible);
63
+ window.addEventListener("focus", visible);
64
+ void refresh();
65
+ return () => {
66
+ abort.abort();
67
+ clearTimeout(timer);
68
+ release();
69
+ document.removeEventListener("visibilitychange", visible);
70
+ window.removeEventListener("focus", visible);
71
+ };
72
+ }
73
+
1
74
  // packages/media-tools/src/export-settings.ts
2
75
  var exportProfiles = {
3
76
  h264: {
@@ -32,7 +105,7 @@ var exportAspects = ["source", "16:9", "9:16", "1:1", "4:3", "3:4", "21:9"];
32
105
  var exportQualities = ["high", "standard", "small"];
33
106
 
34
107
  // packages/media-tools/src/shared.ts
35
- import { z, PluginError } from "vivix-studio/sdk/shared";
108
+ import { z, PluginError, studioFileRef } from "vivix-studio/sdk/shared";
36
109
  var packageVersion = "0.1.22-ecommerce.20261110.1";
37
110
  var Config = z.object({
38
111
  dataInstance: z.string().min(1).default("user:data"),
@@ -120,7 +193,66 @@ var saveEdit = z.object({
120
193
  c.addIssue({ code: "custom", message: "An edit update requires its revision." });
121
194
  });
122
195
  var outputName = z.string().trim().min(1).max(200);
123
- var processVideo = z.object({ input: videoInput, outputName, retryOfJobId: z.uuid().optional() }).strict();
196
+ var gain = z.number().finite().min(-96).max(24);
197
+ var milliseconds = z.number().int().min(0).max(6e5);
198
+ var audioMix = z.object({
199
+ version: z.literal(1),
200
+ originalGainDb: gain.nullable().optional(),
201
+ originals: z.array(
202
+ z.object({
203
+ inputIndex: z.number().int().min(0).max(63),
204
+ gainDb: gain.nullable(),
205
+ role: z.enum(["dialogue", "ambience"]).optional()
206
+ }).strict()
207
+ ).max(64).optional(),
208
+ tracks: z.array(
209
+ z.object({
210
+ id: z.string().trim().min(1).max(128),
211
+ file: videoFileRef,
212
+ role: z.enum(["narration", "music", "sfx"]),
213
+ atMs: milliseconds,
214
+ inMs: milliseconds.optional(),
215
+ outMs: milliseconds.optional(),
216
+ gainDb: gain.optional(),
217
+ fadeInMs: milliseconds.optional(),
218
+ fadeOutMs: milliseconds.optional()
219
+ }).strict()
220
+ ).max(32),
221
+ ducking: z.boolean().optional(),
222
+ loudness: z.enum(["studio-web-v1", "off"]).optional()
223
+ }).strict();
224
+ var maxSequenceInputs = 64;
225
+ var audioQuery = z.object({ inputs: z.array(sequenceVideoInput).min(1).max(maxSequenceInputs) }).strict();
226
+ var previewQuery = audioQuery.extend({
227
+ knownRevision: z.number().int().nonnegative().optional()
228
+ });
229
+ var audioPreviewResult = z.discriminatedUnion("state", [
230
+ z.object({ state: z.literal("original"), revision: z.number() }),
231
+ z.object({ state: z.literal("unchanged") }),
232
+ z.object({ state: z.literal("preparing") }),
233
+ z.object({
234
+ state: z.literal("ready"),
235
+ revision: z.number(),
236
+ file: studioFileRef().nullable(),
237
+ segments: z.array(z.object({ startMs: z.number(), durationMs: z.number().positive() }))
238
+ })
239
+ ]);
240
+ var saveAudio = audioQuery.extend({
241
+ expectedRevision: z.number().int().nonnegative(),
242
+ mix: audioMix.nullable()
243
+ });
244
+ var remixRequest = z.object({
245
+ basis: z.enum(["sources", "master"]),
246
+ mix: audioMix,
247
+ expectedAssetRevision: z.number().int().positive(),
248
+ expectedMixRevision: z.number().int().nonnegative()
249
+ }).strict();
250
+ var processVideo = z.object({
251
+ input: videoInput,
252
+ outputName,
253
+ retryOfJobId: z.uuid().optional(),
254
+ remix: remixRequest.optional()
255
+ }).strict().refine((v) => !v.remix || v.input.kind === "source", "Remix requires a fixed source file.");
124
256
  var canvas = z.object({ width: z.number().int().min(2).max(3840), height: z.number().int().min(2).max(3840) }).strict().refine(
125
257
  (v) => v.width % 2 === 0 && v.height % 2 === 0 && Math.min(v.width, v.height) <= 2160,
126
258
  "Canvas dimensions must be even and within 3840 by 2160."
@@ -150,7 +282,7 @@ var exportSettings = z.object({
150
282
  audio: z.boolean()
151
283
  }).strict();
152
284
  var processSequence = z.object({
153
- inputs: z.array(sequenceVideoInput).min(1).max(64),
285
+ inputs: z.array(sequenceVideoInput).min(1).max(maxSequenceInputs),
154
286
  outputName,
155
287
  canvas,
156
288
  settings: exportSettings.optional(),
@@ -272,6 +404,9 @@ function readSavedEdit(data, raw) {
272
404
  }
273
405
  export {
274
406
  Config,
407
+ audioMix,
408
+ audioPreviewResult,
409
+ audioQuery,
275
410
  canvas,
276
411
  colorAdjustment,
277
412
  editDescriptor,
@@ -280,21 +415,26 @@ export {
280
415
  geometry,
281
416
  jobStates,
282
417
  jobsQuery,
418
+ maxSequenceInputs,
283
419
  mediaError,
284
420
  mediaRequest,
285
421
  metadata,
286
422
  neutralColor,
287
423
  normalizeRecipe,
288
424
  packageVersion,
425
+ previewQuery,
289
426
  processSequence,
290
427
  processVideo,
291
428
  readSavedEdit,
292
429
  recipe,
293
430
  recipeDurationMs,
294
431
  sameFile,
432
+ saveAudio,
295
433
  saveEdit,
434
+ sequenceVideoInput,
296
435
  versionRef,
297
436
  videoEditorTitles,
298
437
  videoFileRef,
299
- videoInput
438
+ videoInput,
439
+ watchSequenceSound
300
440
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vivix-labs/media-tools",
3
- "version": "1.0.0-beta.20",
3
+ "version": "1.0.0-beta.21",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -2,7 +2,7 @@
2
2
  "manifestVersion": "0.2",
3
3
  "id": "media-tools",
4
4
  "requirements": {
5
- "studioPluginApi": "0.2.0"
5
+ "studioPluginApi": "^0.2.7"
6
6
  },
7
7
  "requestedAccess": []
8
8
  }