Skip to content

Commit 33ceef2

Browse files
feat: Add passthrough field on static renditions (#320) (#543)
1 parent bddd452 commit 33ceef2

File tree

4 files changed

+137
-8
lines changed

4 files changed

+137
-8
lines changed

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 88
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mux%2Fmux-17b941b5b216d2110d6b40c186362a7224f49e543241af6b52a712f99f1085df.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mux%2Fmux-72563ba7ef6a58c08fb7e4297f8fdd741538a0380c6c9f813ab655ab1fcbc05d.yml

src/resources/video/assets.ts

+134-7
Original file line numberDiff line numberDiff line change
@@ -535,13 +535,20 @@ export namespace Asset {
535535
files?: Array<StaticRenditions.File>;
536536

537537
/**
538-
* Indicates the status of downloadable MP4 versions of this asset.
538+
* Indicates the status of downloadable MP4 versions of this asset. This field is
539+
* only valid when `mp4_support` is enabled
539540
*/
540541
status?: 'ready' | 'preparing' | 'disabled' | 'errored';
541542
}
542543

543544
export namespace StaticRenditions {
544545
export interface File {
546+
/**
547+
* The ID of this static rendition, used in managing this static rendition. This
548+
* field is only valid for `static_renditions`, not for `mp4_support`.
549+
*/
550+
id?: string;
551+
545552
/**
546553
* The bitrate in bits per second
547554
*/
@@ -562,7 +569,73 @@ export namespace Asset {
562569
*/
563570
height?: number;
564571

565-
name?: 'low.mp4' | 'medium.mp4' | 'high.mp4' | 'audio.m4a' | 'capped-1080p.mp4';
572+
/**
573+
* Name of the static rendition file
574+
*/
575+
name?:
576+
| 'low.mp4'
577+
| 'medium.mp4'
578+
| 'high.mp4'
579+
| 'highest.mp4'
580+
| 'audio.m4a'
581+
| 'capped-1080p.mp4'
582+
| '2160p.mp4'
583+
| '1440p.mp4'
584+
| '1080p.mp4'
585+
| '720p.mp4'
586+
| '540p.mp4'
587+
| '480p.mp4'
588+
| '360p.mp4'
589+
| '270p.mp4';
590+
591+
/**
592+
* Arbitrary user-supplied metadata set for the static rendition. Max 255
593+
* characters.
594+
*/
595+
passthrough?: string;
596+
597+
/**
598+
* Indicates the resolution of this specific MP4 version of this asset. This field
599+
* is only valid for `static_renditions`, not for `mp4_support`.
600+
*/
601+
resolution?:
602+
| 'highest'
603+
| 'audio-only'
604+
| '2160p'
605+
| '1440p'
606+
| '1080p'
607+
| '720p'
608+
| '540p'
609+
| '480p'
610+
| '360p'
611+
| '270p';
612+
613+
/**
614+
* Indicates the resolution tier of this specific MP4 version of this asset. This
615+
* field is only valid for `static_renditions`, not for `mp4_support`.
616+
*/
617+
resolution_tier?: '2160p' | '1440p' | '1080p' | '720p';
618+
619+
/**
620+
* Indicates the status of this specific MP4 version of this asset. This field is
621+
* only valid for `static_renditions`, not for `mp4_support`.
622+
*
623+
* - `ready` indicates the MP4 has been generated and is ready for download
624+
* - `preparing` indicates the asset has not been ingested or the static rendition
625+
* is still being generated after an asset is ready
626+
* - `skipped` indicates the static rendition will not be generated because the
627+
* requested resolution conflicts with the asset attributes after the asset has
628+
* been ingested
629+
* - `errored` indicates the static rendition cannot be generated. For example, an
630+
* asset could not be ingested
631+
*/
632+
status?: 'ready' | 'preparing' | 'skipped' | 'errored';
633+
634+
/**
635+
* Indicates the static rendition type of this specific MP4 version of this asset.
636+
* This field is only valid for `static_renditions`, not for `mp4_support`.
637+
*/
638+
type?: 'standard' | 'advanced';
566639

567640
/**
568641
* The width of the static rendition's file in pixels
@@ -610,7 +683,8 @@ export interface AssetOptions {
610683
max_resolution_tier?: '1080p' | '1440p' | '2160p';
611684

612685
/**
613-
* Specify what level of support for mp4 playback.
686+
* Specify what level of support for mp4 playback. You may not enable both
687+
* `mp4_support` and `static_renditions`.
614688
*
615689
* - The `capped-1080p` option produces a single MP4 file, called
616690
* `capped-1080p.mp4`, with the video resolution capped at 1080p. This option
@@ -669,6 +743,12 @@ export interface AssetOptions {
669743
*/
670744
playback_policy?: Array<Shared.PlaybackPolicy>;
671745

746+
/**
747+
* An array of static renditions to create for this asset. You may not enable both
748+
* `static_renditions` and `mp4_support`
749+
*/
750+
static_renditions?: Array<AssetOptions.StaticRendition>;
751+
672752
/**
673753
* Marks the asset as a test asset when the value is set to true. A Test asset can
674754
* help evaluate the Mux Video APIs without incurring any cost. There is no limit
@@ -769,7 +849,7 @@ export namespace AssetOptions {
769849
overlay_settings?: Input.OverlaySettings;
770850

771851
/**
772-
* This optional parameter should be used tracks with `type` of `text` and
852+
* This optional parameter should be used for tracks with `type` of `text` and
773853
* `text_type` set to `subtitles`.
774854
*/
775855
passthrough?: string;
@@ -921,6 +1001,26 @@ export namespace AssetOptions {
9211001
width?: string;
9221002
}
9231003
}
1004+
1005+
export interface StaticRendition {
1006+
resolution:
1007+
| 'highest'
1008+
| 'audio-only'
1009+
| '2160p'
1010+
| '1440p'
1011+
| '1080p'
1012+
| '720p'
1013+
| '540p'
1014+
| '480p'
1015+
| '360p'
1016+
| '270p';
1017+
1018+
/**
1019+
* Arbitrary user-supplied metadata set for the static rendition. Max 255
1020+
* characters.
1021+
*/
1022+
passthrough?: string;
1023+
}
9241024
}
9251025

9261026
export interface AssetResponse {
@@ -1027,7 +1127,7 @@ export namespace InputInfo {
10271127
overlay_settings?: Settings.OverlaySettings;
10281128

10291129
/**
1030-
* This optional parameter should be used tracks with `type` of `text` and
1130+
* This optional parameter should be used for tracks with `type` of `text` and
10311131
* `text_type` set to `subtitles`.
10321132
*/
10331133
passthrough?: string;
@@ -1342,7 +1442,8 @@ export interface AssetCreateParams {
13421442
max_resolution_tier?: '1080p' | '1440p' | '2160p';
13431443

13441444
/**
1345-
* Specify what level of support for mp4 playback.
1445+
* Specify what level of support for mp4 playback. You may not enable both
1446+
* `mp4_support` and `static_renditions`.
13461447
*
13471448
* - The `capped-1080p` option produces a single MP4 file, called
13481449
* `capped-1080p.mp4`, with the video resolution capped at 1080p. This option
@@ -1398,6 +1499,12 @@ export interface AssetCreateParams {
13981499
*/
13991500
playback_policy?: Array<Shared.PlaybackPolicy>;
14001501

1502+
/**
1503+
* An array of static renditions to create for this asset. You may not enable both
1504+
* `static_renditions` and `mp4_support`
1505+
*/
1506+
static_renditions?: Array<AssetCreateParams.StaticRendition>;
1507+
14011508
/**
14021509
* Marks the asset as a test asset when the value is set to true. A Test asset can
14031510
* help evaluate the Mux Video APIs without incurring any cost. There is no limit
@@ -1476,7 +1583,7 @@ export namespace AssetCreateParams {
14761583
overlay_settings?: Input.OverlaySettings;
14771584

14781585
/**
1479-
* This optional parameter should be used tracks with `type` of `text` and
1586+
* This optional parameter should be used for tracks with `type` of `text` and
14801587
* `text_type` set to `subtitles`.
14811588
*/
14821589
passthrough?: string;
@@ -1650,6 +1757,26 @@ export namespace AssetCreateParams {
16501757
*/
16511758
policy?: Shared.PlaybackPolicy;
16521759
}
1760+
1761+
export interface StaticRendition {
1762+
resolution:
1763+
| 'highest'
1764+
| 'audio-only'
1765+
| '2160p'
1766+
| '1440p'
1767+
| '1080p'
1768+
| '720p'
1769+
| '540p'
1770+
| '480p'
1771+
| '360p'
1772+
| '270p';
1773+
1774+
/**
1775+
* Arbitrary user-supplied metadata set for the static rendition. Max 255
1776+
* characters.
1777+
*/
1778+
passthrough?: string;
1779+
}
16531780
}
16541781

16551782
export interface AssetUpdateParams {

tests/api-resources/video/assets.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ describe('resource assets', () => {
5555
passthrough: 'passthrough',
5656
per_title_encode: true,
5757
playback_policy: ['public'],
58+
static_renditions: [{ resolution: 'highest', passthrough: 'passthrough' }],
5859
test: true,
5960
video_quality: 'basic',
6061
});

tests/api-resources/video/uploads.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ describe('resource uploads', () => {
5757
passthrough: 'passthrough',
5858
per_title_encode: true,
5959
playback_policy: ['public'],
60+
static_renditions: [{ resolution: 'highest', passthrough: 'passthrough' }],
6061
test: true,
6162
video_quality: 'basic',
6263
},

0 commit comments

Comments
 (0)