sonilo 0.16.5 → 0.18.0
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/README.md +59 -0
- package/dist/index.cjs +37 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +108 -3
- package/dist/index.d.ts +108 -3
- package/dist/index.js +37 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -538,6 +538,65 @@ type DubbingLanguage = "en" | "zh_cn" | "ja" | "ko" | "pt"
|
|
|
538
538
|
| "es_419" | "de" | "fr" | "it" | "ru" | "th"
|
|
539
539
|
/** Unqualified Arabic, not one of the country dialects. */
|
|
540
540
|
| "ar" | "tr" | "vi" | "id" | (string & {});
|
|
541
|
+
/**
|
|
542
|
+
* One target-language subtitle script for /v1/dubbing.
|
|
543
|
+
*
|
|
544
|
+
* A string starting with `https://` (case-insensitive) travels as a URL; any
|
|
545
|
+
* other string is a local file path (Node.js only), read and uploaded. The
|
|
546
|
+
* split is unambiguous — a real path cannot start with `https://` — and it
|
|
547
|
+
* matches how `video` already accepts a path string. A `File` is accepted for
|
|
548
|
+
* browsers, where paths do not exist; its `.name` supplies the filename.
|
|
549
|
+
*
|
|
550
|
+
* Blobs, byte arrays and streams are deliberately NOT accepted, unlike
|
|
551
|
+
* `VideoInput`: the server requires an uploaded part's filename to end in
|
|
552
|
+
* `.srt` or `.vtt`, and those types carry no name to derive one from.
|
|
553
|
+
*/
|
|
554
|
+
type SubtitleInput = string | File;
|
|
555
|
+
/** One language's entry in the `subtitle_preflight` map: what the pipeline
|
|
556
|
+
* made of that script before anything was charged. The pipeline returns these
|
|
557
|
+
* numbers as strings on a finished task, so every numeric field is typed
|
|
558
|
+
* `number | string` — read them through `Number(...)`. */
|
|
559
|
+
interface SubtitlePreflightReport {
|
|
560
|
+
/** `ok`, `review_required` or `blocked`. Open for values added later. */
|
|
561
|
+
status?: "ok" | "review_required" | "blocked" | (string & {});
|
|
562
|
+
cue_count?: number | string;
|
|
563
|
+
issues?: string[];
|
|
564
|
+
changes_count?: number | string;
|
|
565
|
+
/** `null`, not absent, when there is no report to link to: the key is
|
|
566
|
+
* always written. Test the value, never just the key's presence. */
|
|
567
|
+
report_url?: string | null;
|
|
568
|
+
[key: string]: unknown;
|
|
569
|
+
}
|
|
570
|
+
/** One language's entry in the `subtitle_export` map: how the re-timed SRT
|
|
571
|
+
* for that language came out. A `blocked` export does not fail the task — the
|
|
572
|
+
* dubbed videos are still delivered, and `subtitles` simply lacks that
|
|
573
|
+
* language. Numbers may arrive as strings, as in `SubtitlePreflightReport`. */
|
|
574
|
+
interface SubtitleExportReport {
|
|
575
|
+
/** `exported`, `exported_review_required` or `blocked`. Open for values
|
|
576
|
+
* added later. */
|
|
577
|
+
status?: "exported" | "exported_review_required" | "blocked" | (string & {});
|
|
578
|
+
/** How far the re-timed cues drifted from the delivered audio during forced
|
|
579
|
+
* alignment. Lower is better. */
|
|
580
|
+
alignment_loss?: number | string;
|
|
581
|
+
issues?: string[];
|
|
582
|
+
error?: string;
|
|
583
|
+
/** `null`, not absent, when there is no report to link to: the key is
|
|
584
|
+
* always written. Test the value, never just the key's presence. */
|
|
585
|
+
report_url?: string | null;
|
|
586
|
+
[key: string]: unknown;
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* The 202 acknowledgement from /v1/dubbing. Additive over the `SfxTask` every
|
|
590
|
+
* other endpoint returns — that shape is shared and stays untouched — because
|
|
591
|
+
* this one endpoint answers with a preflight report per submitted script.
|
|
592
|
+
*
|
|
593
|
+
* A `review_required` status here means the pipeline altered lines in the
|
|
594
|
+
* script that was submitted. It is the one moment a caller who never polls
|
|
595
|
+
* the task can still learn that, so it is worth surfacing.
|
|
596
|
+
*/
|
|
597
|
+
interface DubbingTask extends SfxTask {
|
|
598
|
+
subtitle_preflight?: Record<string, SubtitlePreflightReport>;
|
|
599
|
+
}
|
|
541
600
|
interface DubbingParams {
|
|
542
601
|
/** Exactly one of `video` / `videoUrl`. */
|
|
543
602
|
video?: VideoInput;
|
|
@@ -554,6 +613,38 @@ interface DubbingParams {
|
|
|
554
613
|
* always kept, at a constant level unless this is `true`. Free.
|
|
555
614
|
*/
|
|
556
615
|
ducking?: boolean;
|
|
616
|
+
/**
|
|
617
|
+
* Whether the speaker's mouth is re-rendered to match the dubbed speech.
|
|
618
|
+
* Default ON server-side — the behaviour every dubbing task had before this
|
|
619
|
+
* parameter existed.
|
|
620
|
+
*
|
|
621
|
+
* `false` leaves the picture completely untouched: the video comes back at
|
|
622
|
+
* its original resolution and frame rate rather than re-rendered, and only
|
|
623
|
+
* the audio is replaced — so the mouths keep moving to the original
|
|
624
|
+
* language. Worth it for footage with no on-camera speaker, or when
|
|
625
|
+
* preserving the exact original picture matters more than matching lip
|
|
626
|
+
* movement. The background bed is rebuilt either way, so `ducking` is
|
|
627
|
+
* unaffected.
|
|
628
|
+
*/
|
|
629
|
+
lipsync?: boolean;
|
|
630
|
+
/**
|
|
631
|
+
* One subtitle script per target language, keyed by language code:
|
|
632
|
+
* `{ ja: "./ja.srt", es: "https://example.com/es.vtt" }`.
|
|
633
|
+
*
|
|
634
|
+
* These are TARGET-language scripts carrying the lines you want spoken, not
|
|
635
|
+
* source-language transcripts. The key set must match `languages` exactly —
|
|
636
|
+
* that rule is enforced server-side, before anything is charged, and is
|
|
637
|
+
* deliberately not duplicated here: a local copy would also break a caller
|
|
638
|
+
* who relies on the server default `["zh_cn", "es", "fr"]` without passing
|
|
639
|
+
* `languages` at all.
|
|
640
|
+
*/
|
|
641
|
+
subtitles?: Record<string, SubtitleInput>;
|
|
642
|
+
/**
|
|
643
|
+
* Return a re-timed SRT per language alongside the dubbed videos. Requires
|
|
644
|
+
* `subtitles`. The delivered audio of each language is force-aligned
|
|
645
|
+
* against that language's script, keeping its lines verbatim.
|
|
646
|
+
*/
|
|
647
|
+
exportSrt?: boolean;
|
|
557
648
|
}
|
|
558
649
|
interface DubbingResult extends BaseTaskResult {
|
|
559
650
|
/**
|
|
@@ -562,6 +653,15 @@ interface DubbingResult extends BaseTaskResult {
|
|
|
562
653
|
* `video` slot — a dubbing task renders N artifacts, one per language.
|
|
563
654
|
*/
|
|
564
655
|
outputs?: Record<string, string>;
|
|
656
|
+
/**
|
|
657
|
+
* One re-timed `.srt` URL per language. Only present when the request set
|
|
658
|
+
* `exportSrt`, and a language whose export was blocked is simply absent.
|
|
659
|
+
*/
|
|
660
|
+
subtitles?: Record<string, string>;
|
|
661
|
+
/** What the pipeline made of each submitted script, keyed by language. */
|
|
662
|
+
subtitle_preflight?: Record<string, SubtitlePreflightReport>;
|
|
663
|
+
/** How each language's re-timed SRT came out, keyed by language. */
|
|
664
|
+
subtitle_export?: Record<string, SubtitleExportReport>;
|
|
565
665
|
}
|
|
566
666
|
interface VideoAnalysisParams {
|
|
567
667
|
/** Exactly one of `video` / `videoUrl`. */
|
|
@@ -740,7 +840,12 @@ declare class AudioDucking {
|
|
|
740
840
|
declare class Dubbing {
|
|
741
841
|
private readonly client;
|
|
742
842
|
constructor(client: SoniloClient);
|
|
743
|
-
|
|
843
|
+
/** The acknowledgement carries `subtitle_preflight` when scripts were sent,
|
|
844
|
+
* which is why this returns `DubbingTask` rather than the shared `SfxTask`:
|
|
845
|
+
* a `review_required` preflight means the pipeline altered lines in the
|
|
846
|
+
* script that was submitted, and typing it away hides that from every
|
|
847
|
+
* caller who only ever sees the 202. */
|
|
848
|
+
submit(params: DubbingParams): Promise<DubbingTask>;
|
|
744
849
|
generate(params: DubbingParams, opts?: WaitOptions): Promise<DubbingResult>;
|
|
745
850
|
}
|
|
746
851
|
|
|
@@ -887,6 +992,6 @@ declare class RequestTimeoutError extends SoniloError {
|
|
|
887
992
|
declare function download(media: SfxMedia | string | undefined, fetchFn?: typeof globalThis.fetch, timeout?: number): Promise<Uint8Array>;
|
|
888
993
|
|
|
889
994
|
/** The SDK's own version. Generated by scripts/sync-versions.mjs — do not edit. */
|
|
890
|
-
declare const VERSION = "0.
|
|
995
|
+
declare const VERSION = "0.18.0";
|
|
891
996
|
|
|
892
|
-
export { APIError, type AccountServices, type AnalysisSegment, type AnalysisVariation, type AudioChunkEvent, type AudioDuckingParams, AuthenticationError, BadRequestError, type BaseTaskResult, type CompleteEvent, type CostEvent, type CostInfo, DEFAULT_TIMEOUT_MS, type DailyUsage, type DubbingLanguage, type DubbingParams, type DubbingResult, type DuckingResult, type ErrorEvent, GenerationError, type MusicMediaEntry, type MusicMuxEntry, type MusicTaskResult, type MusicTitle, PaymentRequiredError, RateLimitError, RequestTimeoutError, type Segment, type SegmentLabel, type SfxAudioFormat, type SfxError, type SfxMedia, type SfxResult, type SfxSegment, type SfxTask, SoniloClient, type SoniloClientOptions, SoniloError, type SoundOutputEntry, type SoundResult, type StemsEntry, type StreamEvent, TaskFailedError, TaskTimeoutError, type TextToMusicParams, type TextToSfxParams, type TitleEvent, type Track, TrialExhaustedError, type TrialQuota, type UnknownEvent, type UsageResponse, type UsageSummary, VERSION, type VideoAnalysisParams, type VideoAnalysisResult, type VideoInput, type VideoResult, type VideoToMusicParams, type VideoToSfxParams, type VideoToSoundParams, type VideoToVideoMusicParams, type VideoToVideoSfxParams, type VideoToVideoSoundParams, type WaitOptions, download, isAudioChunkEvent, isErrorEvent };
|
|
997
|
+
export { APIError, type AccountServices, type AnalysisSegment, type AnalysisVariation, type AudioChunkEvent, type AudioDuckingParams, AuthenticationError, BadRequestError, type BaseTaskResult, type CompleteEvent, type CostEvent, type CostInfo, DEFAULT_TIMEOUT_MS, type DailyUsage, type DubbingLanguage, type DubbingParams, type DubbingResult, type DubbingTask, type DuckingResult, type ErrorEvent, GenerationError, type MusicMediaEntry, type MusicMuxEntry, type MusicTaskResult, type MusicTitle, PaymentRequiredError, RateLimitError, RequestTimeoutError, type Segment, type SegmentLabel, type SfxAudioFormat, type SfxError, type SfxMedia, type SfxResult, type SfxSegment, type SfxTask, SoniloClient, type SoniloClientOptions, SoniloError, type SoundOutputEntry, type SoundResult, type StemsEntry, type StreamEvent, type SubtitleExportReport, type SubtitleInput, type SubtitlePreflightReport, TaskFailedError, TaskTimeoutError, type TextToMusicParams, type TextToSfxParams, type TitleEvent, type Track, TrialExhaustedError, type TrialQuota, type UnknownEvent, type UsageResponse, type UsageSummary, VERSION, type VideoAnalysisParams, type VideoAnalysisResult, type VideoInput, type VideoResult, type VideoToMusicParams, type VideoToSfxParams, type VideoToSoundParams, type VideoToVideoMusicParams, type VideoToVideoSfxParams, type VideoToVideoSoundParams, type WaitOptions, download, isAudioChunkEvent, isErrorEvent };
|
package/dist/index.d.ts
CHANGED
|
@@ -538,6 +538,65 @@ type DubbingLanguage = "en" | "zh_cn" | "ja" | "ko" | "pt"
|
|
|
538
538
|
| "es_419" | "de" | "fr" | "it" | "ru" | "th"
|
|
539
539
|
/** Unqualified Arabic, not one of the country dialects. */
|
|
540
540
|
| "ar" | "tr" | "vi" | "id" | (string & {});
|
|
541
|
+
/**
|
|
542
|
+
* One target-language subtitle script for /v1/dubbing.
|
|
543
|
+
*
|
|
544
|
+
* A string starting with `https://` (case-insensitive) travels as a URL; any
|
|
545
|
+
* other string is a local file path (Node.js only), read and uploaded. The
|
|
546
|
+
* split is unambiguous — a real path cannot start with `https://` — and it
|
|
547
|
+
* matches how `video` already accepts a path string. A `File` is accepted for
|
|
548
|
+
* browsers, where paths do not exist; its `.name` supplies the filename.
|
|
549
|
+
*
|
|
550
|
+
* Blobs, byte arrays and streams are deliberately NOT accepted, unlike
|
|
551
|
+
* `VideoInput`: the server requires an uploaded part's filename to end in
|
|
552
|
+
* `.srt` or `.vtt`, and those types carry no name to derive one from.
|
|
553
|
+
*/
|
|
554
|
+
type SubtitleInput = string | File;
|
|
555
|
+
/** One language's entry in the `subtitle_preflight` map: what the pipeline
|
|
556
|
+
* made of that script before anything was charged. The pipeline returns these
|
|
557
|
+
* numbers as strings on a finished task, so every numeric field is typed
|
|
558
|
+
* `number | string` — read them through `Number(...)`. */
|
|
559
|
+
interface SubtitlePreflightReport {
|
|
560
|
+
/** `ok`, `review_required` or `blocked`. Open for values added later. */
|
|
561
|
+
status?: "ok" | "review_required" | "blocked" | (string & {});
|
|
562
|
+
cue_count?: number | string;
|
|
563
|
+
issues?: string[];
|
|
564
|
+
changes_count?: number | string;
|
|
565
|
+
/** `null`, not absent, when there is no report to link to: the key is
|
|
566
|
+
* always written. Test the value, never just the key's presence. */
|
|
567
|
+
report_url?: string | null;
|
|
568
|
+
[key: string]: unknown;
|
|
569
|
+
}
|
|
570
|
+
/** One language's entry in the `subtitle_export` map: how the re-timed SRT
|
|
571
|
+
* for that language came out. A `blocked` export does not fail the task — the
|
|
572
|
+
* dubbed videos are still delivered, and `subtitles` simply lacks that
|
|
573
|
+
* language. Numbers may arrive as strings, as in `SubtitlePreflightReport`. */
|
|
574
|
+
interface SubtitleExportReport {
|
|
575
|
+
/** `exported`, `exported_review_required` or `blocked`. Open for values
|
|
576
|
+
* added later. */
|
|
577
|
+
status?: "exported" | "exported_review_required" | "blocked" | (string & {});
|
|
578
|
+
/** How far the re-timed cues drifted from the delivered audio during forced
|
|
579
|
+
* alignment. Lower is better. */
|
|
580
|
+
alignment_loss?: number | string;
|
|
581
|
+
issues?: string[];
|
|
582
|
+
error?: string;
|
|
583
|
+
/** `null`, not absent, when there is no report to link to: the key is
|
|
584
|
+
* always written. Test the value, never just the key's presence. */
|
|
585
|
+
report_url?: string | null;
|
|
586
|
+
[key: string]: unknown;
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* The 202 acknowledgement from /v1/dubbing. Additive over the `SfxTask` every
|
|
590
|
+
* other endpoint returns — that shape is shared and stays untouched — because
|
|
591
|
+
* this one endpoint answers with a preflight report per submitted script.
|
|
592
|
+
*
|
|
593
|
+
* A `review_required` status here means the pipeline altered lines in the
|
|
594
|
+
* script that was submitted. It is the one moment a caller who never polls
|
|
595
|
+
* the task can still learn that, so it is worth surfacing.
|
|
596
|
+
*/
|
|
597
|
+
interface DubbingTask extends SfxTask {
|
|
598
|
+
subtitle_preflight?: Record<string, SubtitlePreflightReport>;
|
|
599
|
+
}
|
|
541
600
|
interface DubbingParams {
|
|
542
601
|
/** Exactly one of `video` / `videoUrl`. */
|
|
543
602
|
video?: VideoInput;
|
|
@@ -554,6 +613,38 @@ interface DubbingParams {
|
|
|
554
613
|
* always kept, at a constant level unless this is `true`. Free.
|
|
555
614
|
*/
|
|
556
615
|
ducking?: boolean;
|
|
616
|
+
/**
|
|
617
|
+
* Whether the speaker's mouth is re-rendered to match the dubbed speech.
|
|
618
|
+
* Default ON server-side — the behaviour every dubbing task had before this
|
|
619
|
+
* parameter existed.
|
|
620
|
+
*
|
|
621
|
+
* `false` leaves the picture completely untouched: the video comes back at
|
|
622
|
+
* its original resolution and frame rate rather than re-rendered, and only
|
|
623
|
+
* the audio is replaced — so the mouths keep moving to the original
|
|
624
|
+
* language. Worth it for footage with no on-camera speaker, or when
|
|
625
|
+
* preserving the exact original picture matters more than matching lip
|
|
626
|
+
* movement. The background bed is rebuilt either way, so `ducking` is
|
|
627
|
+
* unaffected.
|
|
628
|
+
*/
|
|
629
|
+
lipsync?: boolean;
|
|
630
|
+
/**
|
|
631
|
+
* One subtitle script per target language, keyed by language code:
|
|
632
|
+
* `{ ja: "./ja.srt", es: "https://example.com/es.vtt" }`.
|
|
633
|
+
*
|
|
634
|
+
* These are TARGET-language scripts carrying the lines you want spoken, not
|
|
635
|
+
* source-language transcripts. The key set must match `languages` exactly —
|
|
636
|
+
* that rule is enforced server-side, before anything is charged, and is
|
|
637
|
+
* deliberately not duplicated here: a local copy would also break a caller
|
|
638
|
+
* who relies on the server default `["zh_cn", "es", "fr"]` without passing
|
|
639
|
+
* `languages` at all.
|
|
640
|
+
*/
|
|
641
|
+
subtitles?: Record<string, SubtitleInput>;
|
|
642
|
+
/**
|
|
643
|
+
* Return a re-timed SRT per language alongside the dubbed videos. Requires
|
|
644
|
+
* `subtitles`. The delivered audio of each language is force-aligned
|
|
645
|
+
* against that language's script, keeping its lines verbatim.
|
|
646
|
+
*/
|
|
647
|
+
exportSrt?: boolean;
|
|
557
648
|
}
|
|
558
649
|
interface DubbingResult extends BaseTaskResult {
|
|
559
650
|
/**
|
|
@@ -562,6 +653,15 @@ interface DubbingResult extends BaseTaskResult {
|
|
|
562
653
|
* `video` slot — a dubbing task renders N artifacts, one per language.
|
|
563
654
|
*/
|
|
564
655
|
outputs?: Record<string, string>;
|
|
656
|
+
/**
|
|
657
|
+
* One re-timed `.srt` URL per language. Only present when the request set
|
|
658
|
+
* `exportSrt`, and a language whose export was blocked is simply absent.
|
|
659
|
+
*/
|
|
660
|
+
subtitles?: Record<string, string>;
|
|
661
|
+
/** What the pipeline made of each submitted script, keyed by language. */
|
|
662
|
+
subtitle_preflight?: Record<string, SubtitlePreflightReport>;
|
|
663
|
+
/** How each language's re-timed SRT came out, keyed by language. */
|
|
664
|
+
subtitle_export?: Record<string, SubtitleExportReport>;
|
|
565
665
|
}
|
|
566
666
|
interface VideoAnalysisParams {
|
|
567
667
|
/** Exactly one of `video` / `videoUrl`. */
|
|
@@ -740,7 +840,12 @@ declare class AudioDucking {
|
|
|
740
840
|
declare class Dubbing {
|
|
741
841
|
private readonly client;
|
|
742
842
|
constructor(client: SoniloClient);
|
|
743
|
-
|
|
843
|
+
/** The acknowledgement carries `subtitle_preflight` when scripts were sent,
|
|
844
|
+
* which is why this returns `DubbingTask` rather than the shared `SfxTask`:
|
|
845
|
+
* a `review_required` preflight means the pipeline altered lines in the
|
|
846
|
+
* script that was submitted, and typing it away hides that from every
|
|
847
|
+
* caller who only ever sees the 202. */
|
|
848
|
+
submit(params: DubbingParams): Promise<DubbingTask>;
|
|
744
849
|
generate(params: DubbingParams, opts?: WaitOptions): Promise<DubbingResult>;
|
|
745
850
|
}
|
|
746
851
|
|
|
@@ -887,6 +992,6 @@ declare class RequestTimeoutError extends SoniloError {
|
|
|
887
992
|
declare function download(media: SfxMedia | string | undefined, fetchFn?: typeof globalThis.fetch, timeout?: number): Promise<Uint8Array>;
|
|
888
993
|
|
|
889
994
|
/** The SDK's own version. Generated by scripts/sync-versions.mjs — do not edit. */
|
|
890
|
-
declare const VERSION = "0.
|
|
995
|
+
declare const VERSION = "0.18.0";
|
|
891
996
|
|
|
892
|
-
export { APIError, type AccountServices, type AnalysisSegment, type AnalysisVariation, type AudioChunkEvent, type AudioDuckingParams, AuthenticationError, BadRequestError, type BaseTaskResult, type CompleteEvent, type CostEvent, type CostInfo, DEFAULT_TIMEOUT_MS, type DailyUsage, type DubbingLanguage, type DubbingParams, type DubbingResult, type DuckingResult, type ErrorEvent, GenerationError, type MusicMediaEntry, type MusicMuxEntry, type MusicTaskResult, type MusicTitle, PaymentRequiredError, RateLimitError, RequestTimeoutError, type Segment, type SegmentLabel, type SfxAudioFormat, type SfxError, type SfxMedia, type SfxResult, type SfxSegment, type SfxTask, SoniloClient, type SoniloClientOptions, SoniloError, type SoundOutputEntry, type SoundResult, type StemsEntry, type StreamEvent, TaskFailedError, TaskTimeoutError, type TextToMusicParams, type TextToSfxParams, type TitleEvent, type Track, TrialExhaustedError, type TrialQuota, type UnknownEvent, type UsageResponse, type UsageSummary, VERSION, type VideoAnalysisParams, type VideoAnalysisResult, type VideoInput, type VideoResult, type VideoToMusicParams, type VideoToSfxParams, type VideoToSoundParams, type VideoToVideoMusicParams, type VideoToVideoSfxParams, type VideoToVideoSoundParams, type WaitOptions, download, isAudioChunkEvent, isErrorEvent };
|
|
997
|
+
export { APIError, type AccountServices, type AnalysisSegment, type AnalysisVariation, type AudioChunkEvent, type AudioDuckingParams, AuthenticationError, BadRequestError, type BaseTaskResult, type CompleteEvent, type CostEvent, type CostInfo, DEFAULT_TIMEOUT_MS, type DailyUsage, type DubbingLanguage, type DubbingParams, type DubbingResult, type DubbingTask, type DuckingResult, type ErrorEvent, GenerationError, type MusicMediaEntry, type MusicMuxEntry, type MusicTaskResult, type MusicTitle, PaymentRequiredError, RateLimitError, RequestTimeoutError, type Segment, type SegmentLabel, type SfxAudioFormat, type SfxError, type SfxMedia, type SfxResult, type SfxSegment, type SfxTask, SoniloClient, type SoniloClientOptions, SoniloError, type SoundOutputEntry, type SoundResult, type StemsEntry, type StreamEvent, type SubtitleExportReport, type SubtitleInput, type SubtitlePreflightReport, TaskFailedError, TaskTimeoutError, type TextToMusicParams, type TextToSfxParams, type TitleEvent, type Track, TrialExhaustedError, type TrialQuota, type UnknownEvent, type UsageResponse, type UsageSummary, VERSION, type VideoAnalysisParams, type VideoAnalysisResult, type VideoInput, type VideoResult, type VideoToMusicParams, type VideoToSfxParams, type VideoToSoundParams, type VideoToVideoMusicParams, type VideoToVideoSfxParams, type VideoToVideoSoundParams, type WaitOptions, download, isAudioChunkEvent, isErrorEvent };
|
package/dist/index.js
CHANGED
|
@@ -714,6 +714,17 @@ var AudioDucking = class {
|
|
|
714
714
|
};
|
|
715
715
|
|
|
716
716
|
// src/resources/dubbing.ts
|
|
717
|
+
var SUBTITLE_EXTENSIONS = [".srt", ".vtt"];
|
|
718
|
+
async function toSubtitleBlob(language, value) {
|
|
719
|
+
const name = typeof value === "string" ? value : value?.name ?? "";
|
|
720
|
+
const lowered = name.toLowerCase();
|
|
721
|
+
if (!SUBTITLE_EXTENSIONS.some((ext) => lowered.endsWith(ext))) {
|
|
722
|
+
throw new SoniloError(
|
|
723
|
+
`subtitles[${language}]: "${name}" must be an .srt or .vtt file, or an https:// URL`
|
|
724
|
+
);
|
|
725
|
+
}
|
|
726
|
+
return toUploadBlob(value);
|
|
727
|
+
}
|
|
717
728
|
async function buildDubbingForm(params) {
|
|
718
729
|
if (params.video === void 0 === (params.videoUrl === void 0)) {
|
|
719
730
|
throw new SoniloError("Provide exactly one of video or videoUrl");
|
|
@@ -737,12 +748,37 @@ async function buildDubbingForm(params) {
|
|
|
737
748
|
if (params.ducking !== void 0) {
|
|
738
749
|
form.set("ducking", String(params.ducking));
|
|
739
750
|
}
|
|
751
|
+
if (params.lipsync !== void 0) {
|
|
752
|
+
form.set("lipsync", String(params.lipsync));
|
|
753
|
+
}
|
|
754
|
+
if (params.subtitles !== void 0) {
|
|
755
|
+
for (const [language, value] of Object.entries(params.subtitles)) {
|
|
756
|
+
const field = `subtitles[${language}]`;
|
|
757
|
+
if (typeof value === "string" && value.toLowerCase().startsWith("https://")) {
|
|
758
|
+
form.set(field, value);
|
|
759
|
+
continue;
|
|
760
|
+
}
|
|
761
|
+
const { blob, filename } = await toSubtitleBlob(language, value);
|
|
762
|
+
form.set(field, blob, filename);
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
if (params.exportSrt !== void 0) {
|
|
766
|
+
if (params.exportSrt && Object.keys(params.subtitles ?? {}).length === 0) {
|
|
767
|
+
throw new SoniloError("exportSrt requires subtitles \u2014 there is nothing to align against");
|
|
768
|
+
}
|
|
769
|
+
form.set("export_srt", String(params.exportSrt));
|
|
770
|
+
}
|
|
740
771
|
return form;
|
|
741
772
|
}
|
|
742
773
|
var Dubbing = class {
|
|
743
774
|
constructor(client) {
|
|
744
775
|
this.client = client;
|
|
745
776
|
}
|
|
777
|
+
/** The acknowledgement carries `subtitle_preflight` when scripts were sent,
|
|
778
|
+
* which is why this returns `DubbingTask` rather than the shared `SfxTask`:
|
|
779
|
+
* a `review_required` preflight means the pipeline altered lines in the
|
|
780
|
+
* script that was submitted, and typing it away hides that from every
|
|
781
|
+
* caller who only ever sees the 202. */
|
|
746
782
|
async submit(params) {
|
|
747
783
|
const res = await this.client.request("/v1/dubbing", {
|
|
748
784
|
method: "POST",
|
|
@@ -789,7 +825,7 @@ var VideoAnalysis = class {
|
|
|
789
825
|
};
|
|
790
826
|
|
|
791
827
|
// src/version.ts
|
|
792
|
-
var VERSION = "0.
|
|
828
|
+
var VERSION = "0.18.0";
|
|
793
829
|
|
|
794
830
|
// src/client.ts
|
|
795
831
|
var DEFAULT_BASE_URL = "https://api.sonilo.com";
|