diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2722edf6..f2264585 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,4 +63,3 @@ jobs: - name: Run tests run: ./scripts/test - diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 1c369874..4981afac 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "10.1.0" + ".": "11.0.0" } diff --git a/.stats.yml b/.stats.yml index a5e42a66..dcc11d9d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,4 @@ configured_endpoints: 88 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mux%2Fmux-5f3a1cefec239fb0daed651397851795841e0d4b17d242968b946002d8feaa19.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mux%2Fmux-2689f5dc4d269f2e3c35e7775b2f342d0a790d5c70f2baf4ddf779cf35a45473.yml +openapi_spec_hash: 538747fd9fd542128cba80f547dfa1a3 +config_hash: 46f10626d043984a33d2324b9409c702 diff --git a/CHANGELOG.md b/CHANGELOG.md index a003a678..02d9a737 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,38 @@ # Changelog +## 11.0.0 (2025-03-27) + +Full Changelog: [v10.1.0...v11.0.0](https://github.com/muxinc/mux-node-sdk/compare/v10.1.0...v11.0.0) + +### ⚠ BREAKING CHANGES + +* Fix type of `new_asset_settings` in Direct Uploads, and inline `UpdateReferrerDomainRestrictionRequest` ([#331](https://github.com/muxinc/mux-node-sdk/issues/331)) (#563) +* Changes the type of `new_asset_settings` to be a `CreateAssetRequest`, which exposes the correct set of fields to control asset creation +* Replaces `input` on `CreateAssetRequest` with `inputs`, which accepts the same type, and added deprecation notices +* Replaces `playback_policy` on `CreateAssetRequest` with `playback_policies`, which accepts the same type, and added deprecation notices + +### Features + +* add SKIP_BREW env var to ./scripts/bootstrap ([#556](https://github.com/muxinc/mux-node-sdk/issues/556)) ([d7b9122](https://github.com/muxinc/mux-node-sdk/commit/d7b91226ab8174fbdc836f7f2348a6915f3e15f9)) +* Replace input with inputs and playback_policy with playback_policies ([#335](https://github.com/muxinc/mux-node-sdk/issues/335)) ([#565](https://github.com/muxinc/mux-node-sdk/issues/565)) ([f477926](https://github.com/muxinc/mux-node-sdk/commit/f4779269b5b0939ac22d917bfccfdcaf56a73347)) + + +### Bug Fixes + +* avoid type error in certain environments ([#564](https://github.com/muxinc/mux-node-sdk/issues/564)) ([d57d25d](https://github.com/muxinc/mux-node-sdk/commit/d57d25d7e6693978e9fb06e0517aa1f9c9d57f54)) +* **exports:** add missing type exports ([#566](https://github.com/muxinc/mux-node-sdk/issues/566)) ([94654c9](https://github.com/muxinc/mux-node-sdk/commit/94654c940956c4f7744441612b1ef45567ff6802)) +* **exports:** ensure resource imports don't require /index ([#560](https://github.com/muxinc/mux-node-sdk/issues/560)) ([31a9554](https://github.com/muxinc/mux-node-sdk/commit/31a95542229094432ec901f763ee566f684bfda7)) +* Fix type of new_asset_settings in Direct Uploads, and inline UpdateReferrerDomainRestrictionRequest ([#331](https://github.com/muxinc/mux-node-sdk/issues/331)) ([#563](https://github.com/muxinc/mux-node-sdk/issues/563)) ([f8342e9](https://github.com/muxinc/mux-node-sdk/commit/f8342e9cfd33ac1d720f0649cc9043ad3920e44f)) +* **internal:** work around https://github.com/vercel/next.js/issues/76881 ([#567](https://github.com/muxinc/mux-node-sdk/issues/567)) ([6305af8](https://github.com/muxinc/mux-node-sdk/commit/6305af861e3a79eb6b74fc7958d1346fecf4e54c)) + + +### Chores + +* **exports:** cleaner resource index imports ([#561](https://github.com/muxinc/mux-node-sdk/issues/561)) ([7a71c93](https://github.com/muxinc/mux-node-sdk/commit/7a71c9309c6bcc22841ae404c068b84bbb0ef226)) +* **exports:** stop using path fallbacks ([#562](https://github.com/muxinc/mux-node-sdk/issues/562)) ([ab7f871](https://github.com/muxinc/mux-node-sdk/commit/ab7f8717b6e3b521eeefef13ab69918cab8bd3a7)) +* **internal:** codegen related update ([#558](https://github.com/muxinc/mux-node-sdk/issues/558)) ([a1a797a](https://github.com/muxinc/mux-node-sdk/commit/a1a797a82b0183e087824fc9b05cecd82a8bec1e)) +* **internal:** remove extra empty newlines ([#559](https://github.com/muxinc/mux-node-sdk/issues/559)) ([407398f](https://github.com/muxinc/mux-node-sdk/commit/407398fd5eb873af96860ebd267de81a5f9b91c7)) + ## 10.1.0 (2025-03-06) Full Changelog: [v10.0.0...v10.1.0](https://github.com/muxinc/mux-node-sdk/compare/v10.0.0...v10.1.0) diff --git a/package.json b/package.json index 1e7df26a..f50c6325 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mux/mux-node", - "version": "10.1.0", + "version": "11.0.0", "description": "The official TypeScript library for the Mux API", "author": "Mux ", "types": "dist/index.d.ts", @@ -108,38 +108,17 @@ "default": "./dist/index.mjs" }, "./*.mjs": { - "types": [ - "./dist/*.d.ts", - "./dist/*/index.d.ts" - ], - "default": [ - "./dist/*.mjs", - "./dist/*/index.mjs" - ] + "types": "./dist/*.d.ts", + "default": "./dist/*.mjs" }, "./*.js": { - "types": [ - "./dist/*.d.ts", - "./dist/*/index.d.ts" - ], - "default": [ - "./dist/*.js", - "./dist/*/index.js" - ] + "types": "./dist/*.d.ts", + "default": "./dist/*.js" }, "./*": { - "types": [ - "./dist/*.d.ts", - "./dist/*/index.d.ts" - ], - "require": [ - "./dist/*.js", - "./dist/*/index.js" - ], - "default": [ - "./dist/*.mjs", - "./dist/*/index.mjs" - ] + "types": "./dist/*.d.ts", + "require": "./dist/*.js", + "default": "./dist/*.mjs" } } } diff --git a/scripts/bootstrap b/scripts/bootstrap index 05dd47a6..0af58e25 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -4,7 +4,7 @@ set -e cd "$(dirname "$0")/.." -if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then +if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ]; then brew bundle check >/dev/null 2>&1 || { echo "==> Installing Homebrew dependencies…" brew bundle diff --git a/src/_shims/index-deno.ts b/src/_shims/index-deno.ts index 53a099b4..b73b8eec 100644 --- a/src/_shims/index-deno.ts +++ b/src/_shims/index-deno.ts @@ -108,3 +108,5 @@ export declare class FsReadStream extends Readable { const _ReadableStream = ReadableStream; type _ReadableStream = ReadableStream; export { _ReadableStream as ReadableStream }; + +export const init = () => {}; diff --git a/src/_shims/index.d.ts b/src/_shims/index.d.ts index c0a5994a..c2576459 100644 --- a/src/_shims/index.d.ts +++ b/src/_shims/index.d.ts @@ -79,3 +79,5 @@ export function fileFromPath(path: string, options?: FileFromPathOptions): Promi export function fileFromPath(path: string, filename?: string, options?: FileFromPathOptions): Promise; export function isFsReadStream(value: any): value is FsReadStream; + +export const init: () => void; diff --git a/src/_shims/index.js b/src/_shims/index.js index 9c22b548..8e74942d 100644 --- a/src/_shims/index.js +++ b/src/_shims/index.js @@ -3,7 +3,9 @@ */ const shims = require('./registry'); const auto = require('@mux/mux-node/_shims/auto/runtime'); -if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true }); +exports.init = () => { + if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true }); +}; for (const property of Object.keys(shims)) { Object.defineProperty(exports, property, { get() { @@ -11,3 +13,5 @@ for (const property of Object.keys(shims)) { }, }); } + +exports.init(); diff --git a/src/_shims/index.mjs b/src/_shims/index.mjs index 79a679b0..a90067da 100644 --- a/src/_shims/index.mjs +++ b/src/_shims/index.mjs @@ -3,5 +3,9 @@ */ import * as shims from './registry.mjs'; import * as auto from '@mux/mux-node/_shims/auto/runtime'; -if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true }); +export const init = () => { + if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true }); +}; export * from './registry.mjs'; + +init(); diff --git a/src/core.ts b/src/core.ts index d0731041..d72f93c1 100644 --- a/src/core.ts +++ b/src/core.ts @@ -16,7 +16,12 @@ import { type RequestInit, type Response, type HeadersInit, + init, } from './_shims/index'; + +// try running side effects outside of _shims/index to workaround https://github.com/vercel/next.js/issues/76881 +init(); + export { type Response }; import { isMultipartBody } from './uploads'; export { @@ -48,8 +53,8 @@ async function defaultParseResponse(props: APIResponseProps): Promise { } const contentType = response.headers.get('content-type'); - const isJSON = - contentType?.includes('application/json') || contentType?.includes('application/vnd.api+json'); + const mediaType = contentType?.split(';')[0]?.trim(); + const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json'); if (isJSON) { const json = await response.json(); @@ -381,7 +386,7 @@ export abstract class APIClient { !headers ? {} : Symbol.iterator in headers ? Object.fromEntries(Array.from(headers as Iterable).map((header) => [...header])) - : { ...headers } + : { ...(headers as any as Record) } ); } diff --git a/src/resources.ts b/src/resources.ts new file mode 100644 index 00000000..b283d578 --- /dev/null +++ b/src/resources.ts @@ -0,0 +1 @@ +export * from './resources/index'; diff --git a/src/resources/data.ts b/src/resources/data.ts new file mode 100644 index 00000000..fbaec7b4 --- /dev/null +++ b/src/resources/data.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './data/index'; diff --git a/src/resources/data/monitoring.ts b/src/resources/data/monitoring.ts new file mode 100644 index 00000000..fa03af2c --- /dev/null +++ b/src/resources/data/monitoring.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './monitoring/index'; diff --git a/src/resources/system.ts b/src/resources/system.ts new file mode 100644 index 00000000..83909562 --- /dev/null +++ b/src/resources/system.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './system/index'; diff --git a/src/resources/video.ts b/src/resources/video.ts new file mode 100644 index 00000000..a5897f89 --- /dev/null +++ b/src/resources/video.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './video/index'; diff --git a/src/resources/video/assets.ts b/src/resources/video/assets.ts index bb13facb..46b3a452 100644 --- a/src/resources/video/assets.ts +++ b/src/resources/video/assets.ts @@ -304,6 +304,12 @@ export interface Asset { */ max_stored_resolution?: 'Audio only' | 'SD' | 'HD' | 'FHD' | 'UHD'; + /** + * Customer provided metadata about this asset. + * + * Note: This metadata may be publicly available via the video player. Do not + * include PII or sensitive information. + */ meta?: Asset.Meta; /** @@ -435,6 +441,12 @@ export namespace Asset { url?: string; } + /** + * Customer provided metadata about this asset. + * + * Note: This metadata may be publicly available via the video player. Do not + * include PII or sensitive information. + */ export interface Meta { /** * This is an identifier you provide to keep track of the creator of the video. Max @@ -678,7 +690,7 @@ export interface AssetOptions { /** * An array of playback policy objects that you want applied to this asset and * available through `playback_ids`. `advanced_playback_policies` must be used - * instead of `playback_policy` when creating a DRM playback ID. + * instead of `playback_policies` when creating a DRM playback ID. */ advanced_playback_policies?: Array; @@ -690,12 +702,17 @@ export interface AssetOptions { */ encoding_tier?: 'smart' | 'baseline' | 'premium'; + /** + * @deprecated Deprecated. Use `inputs` instead, which accepts an identical type. + */ + input?: Array; + /** * An array of objects that each describe an input file to be used to create the * asset. As a shortcut, input can also be a string URL for a file when only one * input file is used. See `input[].url` for requirements. */ - input?: Array; + inputs?: Array; /** * Specify what level (if any) of support for master access. Master access can be @@ -711,6 +728,12 @@ export interface AssetOptions { */ max_resolution_tier?: '1080p' | '1440p' | '2160p'; + /** + * Customer provided metadata about this asset. + * + * Note: This metadata may be publicly available via the video player. Do not + * include PII or sensitive information. + */ meta?: AssetOptions.Meta; /** @@ -773,10 +796,16 @@ export interface AssetOptions { * - `"public"` (anyone with the playback URL can stream the asset). * - `"signed"` (an additional access token is required to play the asset). * - * If no `playback_policy` is set, the asset will have no playback IDs and will + * If no `playback_policies` are set, the asset will have no playback IDs and will * therefore not be playable. For simplicity, a single string name can be used in * place of the array in the case of only one playback policy. */ + playback_policies?: Array; + + /** + * @deprecated Deprecated. Use `playback_policies` instead, which accepts an + * identical type. + */ playback_policy?: Array; /** @@ -1038,6 +1067,225 @@ export namespace AssetOptions { } } + /** + * An array of objects that each describe an input file to be used to create the + * asset. As a shortcut, `input` can also be a string URL for a file when only one + * input file is used. See `input[].url` for requirements. + */ + export interface Input { + /** + * Indicates the track provides Subtitles for the Deaf or Hard-of-hearing (SDH). + * This optional parameter should be used for tracks with `type` of `text` and + * `text_type` set to `subtitles`. + */ + closed_captions?: boolean; + + /** + * The time offset in seconds from the beginning of the video, indicating the + * clip's ending marker. The default value is the duration of the video when not + * included. This parameter is only applicable for creating clips when `input.url` + * has `mux://assets/{asset_id}` format. + */ + end_time?: number; + + /** + * Generate subtitle tracks using automatic speech recognition with this + * configuration. This may only be provided for the first input object (the main + * input file). For direct uploads, this first input should omit the url parameter, + * as the main input file is provided via the direct upload. This will create + * subtitles based on the audio track ingested from that main input file. Note that + * subtitle generation happens after initial ingest, so the generated tracks will + * be in the `preparing` state when the asset transitions to `ready`. + */ + generated_subtitles?: Array; + + /** + * The language code value must be a valid + * [BCP 47](https://tools.ietf.org/html/bcp47) specification compliant value. For + * example, `en` for English or `en-US` for the US version of English. This + * parameter is required for `text` and `audio` track types. + */ + language_code?: string; + + /** + * The name of the track containing a human-readable description. This value must + * be unique within each group of `text` or `audio` track types. The HLS manifest + * will associate a subtitle text track with this value. For example, the value + * should be "English" for a subtitle text track with `language_code` set to `en`. + * This optional parameter should be used only for `text` and `audio` type tracks. + * This parameter can be optionally provided for the first video input to denote + * the name of the muxed audio track if present. If this parameter is not included, + * Mux will auto-populate based on the `input[].language_code` value. + */ + name?: string; + + /** + * An object that describes how the image file referenced in URL should be placed + * over the video (i.e. watermarking). Ensure that the URL is active and persists + * the entire lifespan of the video object. + */ + overlay_settings?: Input.OverlaySettings; + + /** + * This optional parameter should be used for tracks with `type` of `text` and + * `text_type` set to `subtitles`. + */ + passthrough?: string; + + /** + * The time offset in seconds from the beginning of the video indicating the clip's + * starting marker. The default value is 0 when not included. This parameter is + * only applicable for creating clips when `input.url` has + * `mux://assets/{asset_id}` format. + */ + start_time?: number; + + /** + * Type of text track. This parameter only supports subtitles value. For more + * information on Subtitles / Closed Captions, + * [see this blog post](https://mux.com/blog/subtitles-captions-webvtt-hls-and-those-magic-flags/). + * This parameter is required for `text` type tracks. + */ + text_type?: 'subtitles'; + + /** + * This parameter is required for `text` type tracks. + */ + type?: 'video' | 'audio' | 'text'; + + /** + * The URL of the file that Mux should download and use. + * + * - For the main input file, this should be the URL to the muxed file for Mux to + * download, for example an MP4, MOV, MKV, or TS file. Mux supports most + * audio/video file formats and codecs, but for fastest processing, you should + * [use standard inputs wherever possible](https://docs.mux.com/guides/minimize-processing-time). + * - For `audio` tracks, the URL is the location of the audio file for Mux to + * download, for example an M4A, WAV, or MP3 file. Mux supports most audio file + * formats and codecs, but for fastest processing, you should + * [use standard inputs wherever possible](https://docs.mux.com/guides/minimize-processing-time). + * - For `text` tracks, the URL is the location of subtitle/captions file. Mux + * supports [SubRip Text (SRT)](https://en.wikipedia.org/wiki/SubRip) and + * [Web Video Text Tracks](https://www.w3.org/TR/webvtt1/) formats for ingesting + * Subtitles and Closed Captions. + * - For Watermarking or Overlay, the URL is the location of the watermark image. + * The maximum size is 4096x4096. + * - When creating clips from existing Mux assets, the URL is defined with + * `mux://assets/{asset_id}` template where `asset_id` is the Asset Identifier + * for creating the clip from. The url property may be omitted on the first input + * object when providing asset settings for LiveStream and Upload objects, in + * order to configure settings related to the primary (live stream or direct + * upload) input. + */ + url?: string; + } + + export namespace Input { + export interface GeneratedSubtitle { + /** + * The language to generate subtitles in. + */ + language_code?: + | 'en' + | 'es' + | 'it' + | 'pt' + | 'de' + | 'fr' + | 'pl' + | 'ru' + | 'nl' + | 'ca' + | 'tr' + | 'sv' + | 'uk' + | 'no' + | 'fi' + | 'sk' + | 'el' + | 'cs' + | 'hr' + | 'da' + | 'ro' + | 'bg'; + + /** + * A name for this subtitle track. + */ + name?: string; + + /** + * Arbitrary metadata set for the subtitle track. Max 255 characters. + */ + passthrough?: string; + } + + /** + * An object that describes how the image file referenced in URL should be placed + * over the video (i.e. watermarking). Ensure that the URL is active and persists + * the entire lifespan of the video object. + */ + export interface OverlaySettings { + /** + * How tall the overlay should appear. Can be expressed as a percent ("10%") or as + * a pixel value ("100px"). If both width and height are left blank the height will + * be the true pixels of the image, applied as if the video has been scaled to fit + * a 1920x1080 frame. If width is supplied with no height, the height will scale + * proportionally to the width. + */ + height?: string; + + /** + * Where the horizontal positioning of the overlay/watermark should begin from. + */ + horizontal_align?: 'left' | 'center' | 'right'; + + /** + * The distance from the horizontal_align starting point and the image's closest + * edge. Can be expressed as a percent ("10%") or as a pixel value ("100px"). + * Negative values will move the overlay offscreen. In the case of 'center', a + * positive value will shift the image towards the right and and a negative value + * will shift it towards the left. + */ + horizontal_margin?: string; + + /** + * How opaque the overlay should appear, expressed as a percent. (Default 100%) + */ + opacity?: string; + + /** + * Where the vertical positioning of the overlay/watermark should begin from. + * Defaults to `"top"` + */ + vertical_align?: 'top' | 'middle' | 'bottom'; + + /** + * The distance from the vertical_align starting point and the image's closest + * edge. Can be expressed as a percent ("10%") or as a pixel value ("100px"). + * Negative values will move the overlay offscreen. In the case of 'middle', a + * positive value will shift the overlay towards the bottom and and a negative + * value will shift it towards the top. + */ + vertical_margin?: string; + + /** + * How wide the overlay should appear. Can be expressed as a percent ("10%") or as + * a pixel value ("100px"). If both width and height are left blank the width will + * be the true pixels of the image, applied as if the video has been scaled to fit + * a 1920x1080 frame. If height is supplied with no width, the width will scale + * proportionally to the height. + */ + width?: string; + } + } + + /** + * Customer provided metadata about this asset. + * + * Note: This metadata may be publicly available via the video player. Do not + * include PII or sensitive information. + */ export interface Meta { /** * This is an identifier you provide to keep track of the creator of the video. Max @@ -1461,16 +1709,14 @@ export type AssetRetrieveInputInfoResponse = Array; export interface AssetCreateParams { /** - * An array of objects that each describe an input file to be used to create the - * asset. As a shortcut, input can also be a string URL for a file when only one - * input file is used. See `input[].url` for requirements. + * Deprecated. Use `inputs` instead, which accepts an identical type. */ input: Array; /** * An array of playback policy objects that you want applied to this asset and * available through `playback_ids`. `advanced_playback_policies` must be used - * instead of `playback_policy` when creating a DRM playback ID. + * instead of `playback_policies` when creating a DRM playback ID. */ advanced_playback_policies?: Array; @@ -1482,6 +1728,13 @@ export interface AssetCreateParams { */ encoding_tier?: 'smart' | 'baseline' | 'premium'; + /** + * An array of objects that each describe an input file to be used to create the + * asset. As a shortcut, input can also be a string URL for a file when only one + * input file is used. See `input[].url` for requirements. + */ + inputs?: Array; + /** * Specify what level (if any) of support for master access. Master access can be * enabled temporarily for your asset to be downloaded. See the @@ -1496,6 +1749,12 @@ export interface AssetCreateParams { */ max_resolution_tier?: '1080p' | '1440p' | '2160p'; + /** + * Customer provided metadata about this asset. + * + * Note: This metadata may be publicly available via the video player. Do not + * include PII or sensitive information. + */ meta?: AssetCreateParams.Meta; /** @@ -1555,10 +1814,15 @@ export interface AssetCreateParams { * - `"public"` (anyone with the playback URL can stream the asset). * - `"signed"` (an additional access token is required to play the asset). * - * If no `playback_policy` is set, the asset will have no playback IDs and will + * If no `playback_policies` are set, the asset will have no playback IDs and will * therefore not be playable. For simplicity, a single string name can be used in * place of the array in the case of only one playback policy. */ + playback_policies?: Array; + + /** + * Deprecated. Use `playback_policies` instead, which accepts an identical type. + */ playback_policy?: Array; /** @@ -1820,6 +2084,225 @@ export namespace AssetCreateParams { policy?: Shared.PlaybackPolicy; } + /** + * An array of objects that each describe an input file to be used to create the + * asset. As a shortcut, `input` can also be a string URL for a file when only one + * input file is used. See `input[].url` for requirements. + */ + export interface Input { + /** + * Indicates the track provides Subtitles for the Deaf or Hard-of-hearing (SDH). + * This optional parameter should be used for tracks with `type` of `text` and + * `text_type` set to `subtitles`. + */ + closed_captions?: boolean; + + /** + * The time offset in seconds from the beginning of the video, indicating the + * clip's ending marker. The default value is the duration of the video when not + * included. This parameter is only applicable for creating clips when `input.url` + * has `mux://assets/{asset_id}` format. + */ + end_time?: number; + + /** + * Generate subtitle tracks using automatic speech recognition with this + * configuration. This may only be provided for the first input object (the main + * input file). For direct uploads, this first input should omit the url parameter, + * as the main input file is provided via the direct upload. This will create + * subtitles based on the audio track ingested from that main input file. Note that + * subtitle generation happens after initial ingest, so the generated tracks will + * be in the `preparing` state when the asset transitions to `ready`. + */ + generated_subtitles?: Array; + + /** + * The language code value must be a valid + * [BCP 47](https://tools.ietf.org/html/bcp47) specification compliant value. For + * example, `en` for English or `en-US` for the US version of English. This + * parameter is required for `text` and `audio` track types. + */ + language_code?: string; + + /** + * The name of the track containing a human-readable description. This value must + * be unique within each group of `text` or `audio` track types. The HLS manifest + * will associate a subtitle text track with this value. For example, the value + * should be "English" for a subtitle text track with `language_code` set to `en`. + * This optional parameter should be used only for `text` and `audio` type tracks. + * This parameter can be optionally provided for the first video input to denote + * the name of the muxed audio track if present. If this parameter is not included, + * Mux will auto-populate based on the `input[].language_code` value. + */ + name?: string; + + /** + * An object that describes how the image file referenced in URL should be placed + * over the video (i.e. watermarking). Ensure that the URL is active and persists + * the entire lifespan of the video object. + */ + overlay_settings?: Input.OverlaySettings; + + /** + * This optional parameter should be used for tracks with `type` of `text` and + * `text_type` set to `subtitles`. + */ + passthrough?: string; + + /** + * The time offset in seconds from the beginning of the video indicating the clip's + * starting marker. The default value is 0 when not included. This parameter is + * only applicable for creating clips when `input.url` has + * `mux://assets/{asset_id}` format. + */ + start_time?: number; + + /** + * Type of text track. This parameter only supports subtitles value. For more + * information on Subtitles / Closed Captions, + * [see this blog post](https://mux.com/blog/subtitles-captions-webvtt-hls-and-those-magic-flags/). + * This parameter is required for `text` type tracks. + */ + text_type?: 'subtitles'; + + /** + * This parameter is required for `text` type tracks. + */ + type?: 'video' | 'audio' | 'text'; + + /** + * The URL of the file that Mux should download and use. + * + * - For the main input file, this should be the URL to the muxed file for Mux to + * download, for example an MP4, MOV, MKV, or TS file. Mux supports most + * audio/video file formats and codecs, but for fastest processing, you should + * [use standard inputs wherever possible](https://docs.mux.com/guides/minimize-processing-time). + * - For `audio` tracks, the URL is the location of the audio file for Mux to + * download, for example an M4A, WAV, or MP3 file. Mux supports most audio file + * formats and codecs, but for fastest processing, you should + * [use standard inputs wherever possible](https://docs.mux.com/guides/minimize-processing-time). + * - For `text` tracks, the URL is the location of subtitle/captions file. Mux + * supports [SubRip Text (SRT)](https://en.wikipedia.org/wiki/SubRip) and + * [Web Video Text Tracks](https://www.w3.org/TR/webvtt1/) formats for ingesting + * Subtitles and Closed Captions. + * - For Watermarking or Overlay, the URL is the location of the watermark image. + * The maximum size is 4096x4096. + * - When creating clips from existing Mux assets, the URL is defined with + * `mux://assets/{asset_id}` template where `asset_id` is the Asset Identifier + * for creating the clip from. The url property may be omitted on the first input + * object when providing asset settings for LiveStream and Upload objects, in + * order to configure settings related to the primary (live stream or direct + * upload) input. + */ + url?: string; + } + + export namespace Input { + export interface GeneratedSubtitle { + /** + * The language to generate subtitles in. + */ + language_code?: + | 'en' + | 'es' + | 'it' + | 'pt' + | 'de' + | 'fr' + | 'pl' + | 'ru' + | 'nl' + | 'ca' + | 'tr' + | 'sv' + | 'uk' + | 'no' + | 'fi' + | 'sk' + | 'el' + | 'cs' + | 'hr' + | 'da' + | 'ro' + | 'bg'; + + /** + * A name for this subtitle track. + */ + name?: string; + + /** + * Arbitrary metadata set for the subtitle track. Max 255 characters. + */ + passthrough?: string; + } + + /** + * An object that describes how the image file referenced in URL should be placed + * over the video (i.e. watermarking). Ensure that the URL is active and persists + * the entire lifespan of the video object. + */ + export interface OverlaySettings { + /** + * How tall the overlay should appear. Can be expressed as a percent ("10%") or as + * a pixel value ("100px"). If both width and height are left blank the height will + * be the true pixels of the image, applied as if the video has been scaled to fit + * a 1920x1080 frame. If width is supplied with no height, the height will scale + * proportionally to the width. + */ + height?: string; + + /** + * Where the horizontal positioning of the overlay/watermark should begin from. + */ + horizontal_align?: 'left' | 'center' | 'right'; + + /** + * The distance from the horizontal_align starting point and the image's closest + * edge. Can be expressed as a percent ("10%") or as a pixel value ("100px"). + * Negative values will move the overlay offscreen. In the case of 'center', a + * positive value will shift the image towards the right and and a negative value + * will shift it towards the left. + */ + horizontal_margin?: string; + + /** + * How opaque the overlay should appear, expressed as a percent. (Default 100%) + */ + opacity?: string; + + /** + * Where the vertical positioning of the overlay/watermark should begin from. + * Defaults to `"top"` + */ + vertical_align?: 'top' | 'middle' | 'bottom'; + + /** + * The distance from the vertical_align starting point and the image's closest + * edge. Can be expressed as a percent ("10%") or as a pixel value ("100px"). + * Negative values will move the overlay offscreen. In the case of 'middle', a + * positive value will shift the overlay towards the bottom and and a negative + * value will shift it towards the top. + */ + vertical_margin?: string; + + /** + * How wide the overlay should appear. Can be expressed as a percent ("10%") or as + * a pixel value ("100px"). If both width and height are left blank the width will + * be the true pixels of the image, applied as if the video has been scaled to fit + * a 1920x1080 frame. If height is supplied with no width, the width will scale + * proportionally to the height. + */ + width?: string; + } + } + + /** + * Customer provided metadata about this asset. + * + * Note: This metadata may be publicly available via the video player. Do not + * include PII or sensitive information. + */ export interface Meta { /** * This is an identifier you provide to keep track of the creator of the video. Max @@ -1861,6 +2344,12 @@ export namespace AssetCreateParams { } export interface AssetUpdateParams { + /** + * Customer provided metadata about this asset. + * + * Note: This metadata may be publicly available via the video player. Do not + * include PII or sensitive information. + */ meta?: AssetUpdateParams.Meta; /** @@ -1874,6 +2363,12 @@ export interface AssetUpdateParams { } export namespace AssetUpdateParams { + /** + * Customer provided metadata about this asset. + * + * Note: This metadata may be publicly available via the video player. Do not + * include PII or sensitive information. + */ export interface Meta { /** * This is an identifier you provide to keep track of the creator of the video. Max diff --git a/src/resources/video/live-streams.ts b/src/resources/video/live-streams.ts index e31d8567..208efd76 100644 --- a/src/resources/video/live-streams.ts +++ b/src/resources/video/live-streams.ts @@ -570,9 +570,9 @@ export interface SimulcastTarget { export interface LiveStreamCreateParams { /** - * An array of playback policy objects that you want applied to this asset and - * available through `playback_ids`. `advanced_playback_policies` must be used - * instead of `playback_policy` when creating a DRM playback ID. + * An array of playback policy objects that you want applied on this live stream + * and available through `playback_ids`. `advanced_playback_policies` must be used + * instead of `playback_policies` when creating a DRM playback ID. */ advanced_playback_policies?: Array; @@ -628,6 +628,22 @@ export interface LiveStreamCreateParams { passthrough?: string; + /** + * An array of playback policy names that you want applied to this live stream and + * available through `playback_ids`. Options include: + * + * - `"public"` (anyone with the playback URL can stream the live stream). + * - `"signed"` (an additional access token is required to play the live stream). + * + * If no `playback_policies` is set, the live stream will have no playback IDs and + * will therefore not be playable. For simplicity, a single string name can be used + * in place of the array in the case of only one playback policy. + */ + playback_policies?: Array; + + /** + * Deprecated. Use `playback_policies` instead, which accepts an identical type. + */ playback_policy?: Array; /** @@ -864,6 +880,12 @@ export namespace LiveStreamUpdateParams { */ master_access?: 'temporary' | 'none'; + /** + * Customer provided metadata about this asset. + * + * Note: This metadata may be publicly available via the video player. Do not + * include PII or sensitive information. + */ meta?: NewAssetSettings.Meta; /** @@ -899,6 +921,12 @@ export namespace LiveStreamUpdateParams { } export namespace NewAssetSettings { + /** + * Customer provided metadata about this asset. + * + * Note: This metadata may be publicly available via the video player. Do not + * include PII or sensitive information. + */ export interface Meta { /** * This is an identifier you provide to keep track of the creator of the video. Max diff --git a/src/resources/video/uploads.ts b/src/resources/video/uploads.ts index 981e56e1..e6eec44f 100644 --- a/src/resources/video/uploads.ts +++ b/src/resources/video/uploads.ts @@ -91,7 +91,7 @@ export interface Upload { */ error?: Upload.Error; - new_asset_settings?: AssetsAPI.Asset; + new_asset_settings?: AssetsAPI.AssetOptions; /** * Indicates if this is a test Direct Upload, in which case the Asset that gets diff --git a/src/resources/webhooks.ts b/src/resources/webhooks.ts index 2ed09f84..b95ca9f6 100644 --- a/src/resources/webhooks.ts +++ b/src/resources/webhooks.ts @@ -726,3 +726,58 @@ export type UnwrapWebhookEvent = | VideoLiveStreamSimulcastTargetDeletedWebhookEvent | VideoLiveStreamSimulcastTargetUpdatedWebhookEvent | VideoDeliveryHighTrafficWebhookEvent; + +export declare namespace Webhooks { + export { + type BaseWebhookEvent as BaseWebhookEvent, + type VideoAssetCreatedWebhookEvent as VideoAssetCreatedWebhookEvent, + type VideoAssetReadyWebhookEvent as VideoAssetReadyWebhookEvent, + type VideoAssetErroredWebhookEvent as VideoAssetErroredWebhookEvent, + type VideoAssetUpdatedWebhookEvent as VideoAssetUpdatedWebhookEvent, + type VideoAssetDeletedWebhookEvent as VideoAssetDeletedWebhookEvent, + type VideoAssetLiveStreamCompletedWebhookEvent as VideoAssetLiveStreamCompletedWebhookEvent, + type VideoAssetStaticRenditionsReadyWebhookEvent as VideoAssetStaticRenditionsReadyWebhookEvent, + type VideoAssetStaticRenditionsPreparingWebhookEvent as VideoAssetStaticRenditionsPreparingWebhookEvent, + type VideoAssetStaticRenditionsDeletedWebhookEvent as VideoAssetStaticRenditionsDeletedWebhookEvent, + type VideoAssetStaticRenditionsErroredWebhookEvent as VideoAssetStaticRenditionsErroredWebhookEvent, + type VideoAssetMasterReadyWebhookEvent as VideoAssetMasterReadyWebhookEvent, + type VideoAssetMasterPreparingWebhookEvent as VideoAssetMasterPreparingWebhookEvent, + type VideoAssetMasterDeletedWebhookEvent as VideoAssetMasterDeletedWebhookEvent, + type VideoAssetMasterErroredWebhookEvent as VideoAssetMasterErroredWebhookEvent, + type VideoAssetTrackCreatedWebhookEvent as VideoAssetTrackCreatedWebhookEvent, + type VideoAssetTrackReadyWebhookEvent as VideoAssetTrackReadyWebhookEvent, + type VideoAssetTrackErroredWebhookEvent as VideoAssetTrackErroredWebhookEvent, + type VideoAssetTrackDeletedWebhookEvent as VideoAssetTrackDeletedWebhookEvent, + type VideoAssetStaticRenditionCreatedWebhookEvent as VideoAssetStaticRenditionCreatedWebhookEvent, + type VideoAssetStaticRenditionReadyWebhookEvent as VideoAssetStaticRenditionReadyWebhookEvent, + type VideoAssetStaticRenditionErroredWebhookEvent as VideoAssetStaticRenditionErroredWebhookEvent, + type VideoAssetStaticRenditionDeletedWebhookEvent as VideoAssetStaticRenditionDeletedWebhookEvent, + type VideoAssetStaticRenditionSkippedWebhookEvent as VideoAssetStaticRenditionSkippedWebhookEvent, + type VideoAssetWarningWebhookEvent as VideoAssetWarningWebhookEvent, + type VideoAssetNonStandardInputDetectedWebhookEvent as VideoAssetNonStandardInputDetectedWebhookEvent, + type VideoUploadAssetCreatedWebhookEvent as VideoUploadAssetCreatedWebhookEvent, + type VideoUploadCancelledWebhookEvent as VideoUploadCancelledWebhookEvent, + type VideoUploadCreatedWebhookEvent as VideoUploadCreatedWebhookEvent, + type VideoUploadErroredWebhookEvent as VideoUploadErroredWebhookEvent, + type VideoLiveStreamCreatedWebhookEvent as VideoLiveStreamCreatedWebhookEvent, + type VideoLiveStreamConnectedWebhookEvent as VideoLiveStreamConnectedWebhookEvent, + type VideoLiveStreamRecordingWebhookEvent as VideoLiveStreamRecordingWebhookEvent, + type VideoLiveStreamActiveWebhookEvent as VideoLiveStreamActiveWebhookEvent, + type VideoLiveStreamDisconnectedWebhookEvent as VideoLiveStreamDisconnectedWebhookEvent, + type VideoLiveStreamIdleWebhookEvent as VideoLiveStreamIdleWebhookEvent, + type VideoLiveStreamUpdatedWebhookEvent as VideoLiveStreamUpdatedWebhookEvent, + type VideoLiveStreamEnabledWebhookEvent as VideoLiveStreamEnabledWebhookEvent, + type VideoLiveStreamDisabledWebhookEvent as VideoLiveStreamDisabledWebhookEvent, + type VideoLiveStreamDeletedWebhookEvent as VideoLiveStreamDeletedWebhookEvent, + type VideoLiveStreamWarningWebhookEvent as VideoLiveStreamWarningWebhookEvent, + type VideoLiveStreamSimulcastTargetCreatedWebhookEvent as VideoLiveStreamSimulcastTargetCreatedWebhookEvent, + type VideoLiveStreamSimulcastTargetIdleWebhookEvent as VideoLiveStreamSimulcastTargetIdleWebhookEvent, + type VideoLiveStreamSimulcastTargetStartingWebhookEvent as VideoLiveStreamSimulcastTargetStartingWebhookEvent, + type VideoLiveStreamSimulcastTargetBroadcastingWebhookEvent as VideoLiveStreamSimulcastTargetBroadcastingWebhookEvent, + type VideoLiveStreamSimulcastTargetErroredWebhookEvent as VideoLiveStreamSimulcastTargetErroredWebhookEvent, + type VideoLiveStreamSimulcastTargetDeletedWebhookEvent as VideoLiveStreamSimulcastTargetDeletedWebhookEvent, + type VideoLiveStreamSimulcastTargetUpdatedWebhookEvent as VideoLiveStreamSimulcastTargetUpdatedWebhookEvent, + type VideoDeliveryHighTrafficWebhookEvent as VideoDeliveryHighTrafficWebhookEvent, + type UnwrapWebhookEvent as UnwrapWebhookEvent, + }; +} diff --git a/src/version.ts b/src/version.ts index e43ff754..dfa3c75c 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '10.1.0'; // x-release-please-version +export const VERSION = '11.0.0'; // x-release-please-version diff --git a/tests/api-resources/video/assets.test.ts b/tests/api-resources/video/assets.test.ts index 8efd5dfa..0de65ec4 100644 --- a/tests/api-resources/video/assets.test.ts +++ b/tests/api-resources/video/assets.test.ts @@ -43,11 +43,34 @@ describe('resource assets', () => { start_time: 0, text_type: 'subtitles', type: 'video', - url: 'https://muxed.s3.amazonaws.com/leds.mp4', + url: 'url', }, ], advanced_playback_policies: [{ drm_configuration_id: 'drm_configuration_id', policy: 'public' }], encoding_tier: 'smart', + inputs: [ + { + closed_captions: true, + end_time: 0, + generated_subtitles: [{ language_code: 'en', name: 'name', passthrough: 'passthrough' }], + language_code: 'language_code', + name: 'name', + overlay_settings: { + height: 'height', + horizontal_align: 'left', + horizontal_margin: 'horizontal_margin', + opacity: 'opacity', + vertical_align: 'top', + vertical_margin: 'vertical_margin', + width: 'width', + }, + passthrough: 'passthrough', + start_time: 0, + text_type: 'subtitles', + type: 'video', + url: 'url', + }, + ], master_access: 'none', max_resolution_tier: '1080p', meta: { creator_id: 'creator_id', external_id: 'external_id', title: 'title' }, @@ -55,6 +78,7 @@ describe('resource assets', () => { normalize_audio: true, passthrough: 'passthrough', per_title_encode: true, + playback_policies: ['public'], playback_policy: ['public'], static_renditions: [{ resolution: 'highest', passthrough: 'passthrough' }], test: true, diff --git a/tests/api-resources/video/uploads.test.ts b/tests/api-resources/video/uploads.test.ts index 897714f8..017d01af 100644 --- a/tests/api-resources/video/uploads.test.ts +++ b/tests/api-resources/video/uploads.test.ts @@ -50,6 +50,29 @@ describe('resource uploads', () => { url: 'url', }, ], + inputs: [ + { + closed_captions: true, + end_time: 0, + generated_subtitles: [{ language_code: 'en', name: 'name', passthrough: 'passthrough' }], + language_code: 'language_code', + name: 'name', + overlay_settings: { + height: 'height', + horizontal_align: 'left', + horizontal_margin: 'horizontal_margin', + opacity: 'opacity', + vertical_align: 'top', + vertical_margin: 'vertical_margin', + width: 'width', + }, + passthrough: 'passthrough', + start_time: 0, + text_type: 'subtitles', + type: 'video', + url: 'url', + }, + ], master_access: 'none', max_resolution_tier: '1080p', meta: { creator_id: 'creator_id', external_id: 'external_id', title: 'title' }, @@ -57,6 +80,7 @@ describe('resource uploads', () => { normalize_audio: true, passthrough: 'passthrough', per_title_encode: true, + playback_policies: ['public'], playback_policy: ['public'], static_renditions: [{ resolution: 'highest', passthrough: 'passthrough' }], test: true,