Skip to content

feat: Add passthrough field on static renditions (#320) #543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 88
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mux%2Fmux-17b941b5b216d2110d6b40c186362a7224f49e543241af6b52a712f99f1085df.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mux%2Fmux-72563ba7ef6a58c08fb7e4297f8fdd741538a0380c6c9f813ab655ab1fcbc05d.yml
141 changes: 134 additions & 7 deletions src/resources/video/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,13 +535,20 @@ export namespace Asset {
files?: Array<StaticRenditions.File>;

/**
* Indicates the status of downloadable MP4 versions of this asset.
* Indicates the status of downloadable MP4 versions of this asset. This field is
* only valid when `mp4_support` is enabled
*/
status?: 'ready' | 'preparing' | 'disabled' | 'errored';
}

export namespace StaticRenditions {
export interface File {
/**
* The ID of this static rendition, used in managing this static rendition. This
* field is only valid for `static_renditions`, not for `mp4_support`.
*/
id?: string;

/**
* The bitrate in bits per second
*/
Expand All @@ -562,7 +569,73 @@ export namespace Asset {
*/
height?: number;

name?: 'low.mp4' | 'medium.mp4' | 'high.mp4' | 'audio.m4a' | 'capped-1080p.mp4';
/**
* Name of the static rendition file
*/
name?:
| 'low.mp4'
| 'medium.mp4'
| 'high.mp4'
| 'highest.mp4'
| 'audio.m4a'
| 'capped-1080p.mp4'
| '2160p.mp4'
| '1440p.mp4'
| '1080p.mp4'
| '720p.mp4'
| '540p.mp4'
| '480p.mp4'
| '360p.mp4'
| '270p.mp4';

/**
* Arbitrary user-supplied metadata set for the static rendition. Max 255
* characters.
*/
passthrough?: string;

/**
* Indicates the resolution of this specific MP4 version of this asset. This field
* is only valid for `static_renditions`, not for `mp4_support`.
*/
resolution?:
| 'highest'
| 'audio-only'
| '2160p'
| '1440p'
| '1080p'
| '720p'
| '540p'
| '480p'
| '360p'
| '270p';

/**
* Indicates the resolution tier of this specific MP4 version of this asset. This
* field is only valid for `static_renditions`, not for `mp4_support`.
*/
resolution_tier?: '2160p' | '1440p' | '1080p' | '720p';

/**
* Indicates the status of this specific MP4 version of this asset. This field is
* only valid for `static_renditions`, not for `mp4_support`.
*
* - `ready` indicates the MP4 has been generated and is ready for download
* - `preparing` indicates the asset has not been ingested or the static rendition
* is still being generated after an asset is ready
* - `skipped` indicates the static rendition will not be generated because the
* requested resolution conflicts with the asset attributes after the asset has
* been ingested
* - `errored` indicates the static rendition cannot be generated. For example, an
* asset could not be ingested
*/
status?: 'ready' | 'preparing' | 'skipped' | 'errored';

/**
* Indicates the static rendition type of this specific MP4 version of this asset.
* This field is only valid for `static_renditions`, not for `mp4_support`.
*/
type?: 'standard' | 'advanced';

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

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

/**
* An array of static renditions to create for this asset. You may not enable both
* `static_renditions` and `mp4_support`
*/
static_renditions?: Array<AssetOptions.StaticRendition>;

/**
* Marks the asset as a test asset when the value is set to true. A Test asset can
* help evaluate the Mux Video APIs without incurring any cost. There is no limit
Expand Down Expand Up @@ -769,7 +849,7 @@ export namespace AssetOptions {
overlay_settings?: Input.OverlaySettings;

/**
* This optional parameter should be used tracks with `type` of `text` and
* This optional parameter should be used for tracks with `type` of `text` and
* `text_type` set to `subtitles`.
*/
passthrough?: string;
Expand Down Expand Up @@ -921,6 +1001,26 @@ export namespace AssetOptions {
width?: string;
}
}

export interface StaticRendition {
resolution:
| 'highest'
| 'audio-only'
| '2160p'
| '1440p'
| '1080p'
| '720p'
| '540p'
| '480p'
| '360p'
| '270p';

/**
* Arbitrary user-supplied metadata set for the static rendition. Max 255
* characters.
*/
passthrough?: string;
}
}

export interface AssetResponse {
Expand Down Expand Up @@ -1027,7 +1127,7 @@ export namespace InputInfo {
overlay_settings?: Settings.OverlaySettings;

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

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

/**
* An array of static renditions to create for this asset. You may not enable both
* `static_renditions` and `mp4_support`
*/
static_renditions?: Array<AssetCreateParams.StaticRendition>;

/**
* Marks the asset as a test asset when the value is set to true. A Test asset can
* help evaluate the Mux Video APIs without incurring any cost. There is no limit
Expand Down Expand Up @@ -1476,7 +1583,7 @@ export namespace AssetCreateParams {
overlay_settings?: Input.OverlaySettings;

/**
* This optional parameter should be used tracks with `type` of `text` and
* This optional parameter should be used for tracks with `type` of `text` and
* `text_type` set to `subtitles`.
*/
passthrough?: string;
Expand Down Expand Up @@ -1650,6 +1757,26 @@ export namespace AssetCreateParams {
*/
policy?: Shared.PlaybackPolicy;
}

export interface StaticRendition {
resolution:
| 'highest'
| 'audio-only'
| '2160p'
| '1440p'
| '1080p'
| '720p'
| '540p'
| '480p'
| '360p'
| '270p';

/**
* Arbitrary user-supplied metadata set for the static rendition. Max 255
* characters.
*/
passthrough?: string;
}
}

export interface AssetUpdateParams {
Expand Down
1 change: 1 addition & 0 deletions tests/api-resources/video/assets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ describe('resource assets', () => {
passthrough: 'passthrough',
per_title_encode: true,
playback_policy: ['public'],
static_renditions: [{ resolution: 'highest', passthrough: 'passthrough' }],
test: true,
video_quality: 'basic',
});
Expand Down
1 change: 1 addition & 0 deletions tests/api-resources/video/uploads.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ describe('resource uploads', () => {
passthrough: 'passthrough',
per_title_encode: true,
playback_policy: ['public'],
static_renditions: [{ resolution: 'highest', passthrough: 'passthrough' }],
test: true,
video_quality: 'basic',
},
Expand Down