sanity-plugin-mux-input 2.11.2 → 2.12.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 CHANGED
@@ -198,21 +198,65 @@ sanity documents delete secrets.mux
198
198
 
199
199
  More information on signed URLs is available on Mux's [docs](https://docs.mux.com/docs/headless-cms-sanity#advanced-signed-urls)
200
200
 
201
- ### MP4 support (downloadable videos or offline viewing)
201
+ ### Static Renditions (downloadable videos or offline viewing)
202
202
 
203
- To enable [static MP4 renditions](https://docs.mux.com/guides/video/enable-static-mp4-renditions), add `mp4_support: 'standard'` to the `options` of your `mux.video` schema type.
203
+ To enable [static MP4 renditions](https://docs.mux.com/guides/video/enable-static-mp4-renditions), add `static_renditions` to your plugin configuration. This allows users to download videos for offline viewing.
204
+
205
+ #### Standard Mode (Recommended)
204
206
 
205
207
  ```js
206
208
  import {muxInput} from 'sanity-plugin-mux-input'
207
209
 
208
210
  export default defineConfig({
209
- plugins: [muxInput({mp4_support: 'standard'})],
211
+ plugins: [
212
+ muxInput({
213
+ static_renditions: ['highest'], // Enables MP4 downloads at the highest quality (up to 4K)
214
+ // or
215
+ static_renditions: ['highest', 'audio-only'], // Also includes audio-only (M4A) downloads
216
+ }),
217
+ ],
210
218
  })
211
219
  ```
212
220
 
213
- If MP4 support is enabled in the plugin's configuration, editors can still choose to enable MP4 renditions on a per-video basis when uploading new assets.
221
+ **Standard mode options:**
222
+ - `'highest'`: Produces an MP4 file with video resolution up to 4K (2160p)
223
+ - `'audio-only'`: Produces an M4A (audio-only MP4) file
224
+
225
+ #### Advanced Mode (Specific Resolutions)
226
+
227
+ For more control, you can specify exact resolutions:
228
+
229
+ ```js
230
+ import {muxInput} from 'sanity-plugin-mux-input'
231
+
232
+ export default defineConfig({
233
+ plugins: [
234
+ muxInput({
235
+ static_renditions: ['1080p', '720p', 'audio-only'],
236
+ }),
237
+ ],
238
+ })
239
+ ```
240
+
241
+ **Advanced mode options:**
242
+ - Specific resolutions: `'270p'`, `'360p'`, `'480p'`, `'540p'`, `'720p'`, `'1080p'`, `'1440p'`, `'2160p'`
243
+ - `'audio-only'`: M4A file
244
+
245
+ **Important notes:**
246
+ - You cannot mix `'highest'` with specific resolutions (e.g., `['highest', '1080p']` is invalid)
247
+ - Mux will not upscale videos - renditions requiring upscaling are automatically skipped
248
+ - When uploading new assets, editors can choose different rendition settings on a per-video basis
249
+
250
+ #### Backward Compatibility
251
+
252
+ The deprecated `mp4_support` field is still supported for backward compatibility:
253
+
254
+ ```js
255
+ // ⚠️ Deprecated - use static_renditions instead
256
+ muxInput({mp4_support: 'standard'}) // Equivalent to static_renditions: ['highest']
257
+ ```
214
258
 
215
- MP4 allows users to download videos for later or offline viewing. More information can be found on Mux's [documentation](https://docs.mux.com/guides/enable-static-mp4-renditions).
259
+ More information can be found on Mux's [documentation](https://docs.mux.com/guides/enable-static-mp4-renditions).
216
260
 
217
261
  ### Video resolution (max_resolution_tier)
218
262
 
package/dist/index.d.mts CHANGED
@@ -30,12 +30,18 @@ declare interface MuxAsset {
30
30
  static_renditions?: {
31
31
  status: 'ready' | 'preparing' | 'disabled' | 'errored'
32
32
  files: {
33
- name: 'low.mp4' | 'medium.mp4' | 'high.mp4' | 'audio.m4a'
33
+ name: string
34
34
  ext: 'mp4' | 'm4a'
35
35
  height: number
36
36
  width: number
37
37
  bitrate: number
38
- filesize: number
38
+ filesize: string
39
+ type: 'standard' | 'advanced'
40
+ status: 'ready' | 'preparing' | 'skipped' | 'errored'
41
+ resolution_tier?: string
42
+ resolution?: string
43
+ id: string
44
+ passthrough?: string
39
45
  }[]
40
46
  }
41
47
  recording_times?: {
@@ -78,6 +84,19 @@ export declare const muxInput: Plugin_2<void | Partial<PluginConfig>>
78
84
 
79
85
  declare interface MuxInputConfig {
80
86
  /**
87
+ * Enable static renditions by default. Can be overwritten on a per-asset basis.
88
+ * Supports:
89
+ * - Standard mode: 'highest' (up to 4K MP4) and/or 'audio-only' (M4A)
90
+ * - Advanced mode: Specific resolutions ('270p', '360p', '480p', '540p', '720p', '1080p', '1440p', '2160p') and/or 'audio-only'
91
+ *
92
+ * **Important**: 'highest' cannot be mixed with specific resolutions. If both are provided, only 'highest' will be used.
93
+ *
94
+ * @see {@link https://docs.mux.com/guides/video/enable-static-mp4-renditions}
95
+ * @defaultValue []
96
+ */
97
+ static_renditions: StaticRenditionResolution[]
98
+ /**
99
+ * @deprecated Use `static_renditions` instead. This field is kept for backward compatibility.
81
100
  * Enable static renditions by setting this to 'standard'. Can be overwritten on a per-asset basis.
82
101
  * Requires `"video_quality": "plus"`
83
102
  * @see {@link https://docs.mux.com/guides/video/enable-static-mp4-renditions#why-enable-mp4-support}
@@ -195,6 +214,21 @@ declare interface PluginConfig extends MuxInputConfig {
195
214
  allowedRolesForConfiguration: string[]
196
215
  }
197
216
 
217
+ /**
218
+ * All static rendition resolution options supported by Mux
219
+ */
220
+ declare type StaticRenditionResolution =
221
+ | 'highest'
222
+ | 'audio-only'
223
+ | '270p'
224
+ | '360p'
225
+ | '480p'
226
+ | '540p'
227
+ | '720p'
228
+ | '1080p'
229
+ | '1440p'
230
+ | '2160p'
231
+
198
232
  declare const SUPPORTED_MUX_LANGUAGES_VALUES: (
199
233
  | 'en'
200
234
  | 'es'
package/dist/index.d.ts CHANGED
@@ -30,12 +30,18 @@ declare interface MuxAsset {
30
30
  static_renditions?: {
31
31
  status: 'ready' | 'preparing' | 'disabled' | 'errored'
32
32
  files: {
33
- name: 'low.mp4' | 'medium.mp4' | 'high.mp4' | 'audio.m4a'
33
+ name: string
34
34
  ext: 'mp4' | 'm4a'
35
35
  height: number
36
36
  width: number
37
37
  bitrate: number
38
- filesize: number
38
+ filesize: string
39
+ type: 'standard' | 'advanced'
40
+ status: 'ready' | 'preparing' | 'skipped' | 'errored'
41
+ resolution_tier?: string
42
+ resolution?: string
43
+ id: string
44
+ passthrough?: string
39
45
  }[]
40
46
  }
41
47
  recording_times?: {
@@ -78,6 +84,19 @@ export declare const muxInput: Plugin_2<void | Partial<PluginConfig>>
78
84
 
79
85
  declare interface MuxInputConfig {
80
86
  /**
87
+ * Enable static renditions by default. Can be overwritten on a per-asset basis.
88
+ * Supports:
89
+ * - Standard mode: 'highest' (up to 4K MP4) and/or 'audio-only' (M4A)
90
+ * - Advanced mode: Specific resolutions ('270p', '360p', '480p', '540p', '720p', '1080p', '1440p', '2160p') and/or 'audio-only'
91
+ *
92
+ * **Important**: 'highest' cannot be mixed with specific resolutions. If both are provided, only 'highest' will be used.
93
+ *
94
+ * @see {@link https://docs.mux.com/guides/video/enable-static-mp4-renditions}
95
+ * @defaultValue []
96
+ */
97
+ static_renditions: StaticRenditionResolution[]
98
+ /**
99
+ * @deprecated Use `static_renditions` instead. This field is kept for backward compatibility.
81
100
  * Enable static renditions by setting this to 'standard'. Can be overwritten on a per-asset basis.
82
101
  * Requires `"video_quality": "plus"`
83
102
  * @see {@link https://docs.mux.com/guides/video/enable-static-mp4-renditions#why-enable-mp4-support}
@@ -195,6 +214,21 @@ declare interface PluginConfig extends MuxInputConfig {
195
214
  allowedRolesForConfiguration: string[]
196
215
  }
197
216
 
217
+ /**
218
+ * All static rendition resolution options supported by Mux
219
+ */
220
+ declare type StaticRenditionResolution =
221
+ | 'highest'
222
+ | 'audio-only'
223
+ | '270p'
224
+ | '360p'
225
+ | '480p'
226
+ | '540p'
227
+ | '720p'
228
+ | '1080p'
229
+ | '1440p'
230
+ | '2160p'
231
+
198
232
  declare const SUPPORTED_MUX_LANGUAGES_VALUES: (
199
233
  | 'en'
200
234
  | 'es'
package/dist/index.js CHANGED
@@ -1527,7 +1527,7 @@ function VideoPlayer({
1527
1527
  crossOrigin: "anonymous",
1528
1528
  metadata: {
1529
1529
  player_name: "Sanity Admin Dashboard",
1530
- player_version: "2.11.2",
1530
+ player_version: "2.12.0",
1531
1531
  page_type: "Preview Player"
1532
1532
  },
1533
1533
  audio: isAudio,
@@ -2437,9 +2437,14 @@ const useAccessControl = (config) => {
2437
2437
  sanity.isReference(asset) ? asset._ref : "",
2438
2438
  path
2439
2439
  ), useMuxPolling = (asset) => {
2440
- const client = useClient(), projectId = sanity.useProjectId(), dataset = sanity.useDataset(), shouldFetch = React.useMemo(
2441
- () => !!asset?.assetId && (asset?.status === "preparing" || asset?.data?.static_renditions?.status === "preparing"),
2442
- [asset?.assetId, asset?.data?.static_renditions?.status, asset?.status]
2440
+ const client = useClient(), projectId = sanity.useProjectId(), dataset = sanity.useDataset(), isPreparingStaticRenditions = React.useMemo(() => {
2441
+ if (asset?.data?.static_renditions?.status && asset?.data?.static_renditions?.status !== "disabled")
2442
+ return !1;
2443
+ const files = asset?.data?.static_renditions?.files;
2444
+ return !files || files.length === 0 ? !1 : files.some((file) => file.status === "preparing");
2445
+ }, [asset?.data?.static_renditions?.status, asset?.data?.static_renditions?.files]), shouldFetch = React.useMemo(
2446
+ () => !!asset?.assetId && (asset?.status === "preparing" || isPreparingStaticRenditions),
2447
+ [asset?.assetId, asset?.status, isPreparingStaticRenditions]
2443
2448
  );
2444
2449
  return useSWR__default.default(
2445
2450
  shouldFetch ? `/${projectId}/addons/mux/assets/${dataset}/data/${asset?.assetId}` : null,
@@ -2928,7 +2933,12 @@ const TopControls = styledComponents.styled.div`
2928
2933
  ) : null
2929
2934
  ] }) });
2930
2935
  }, Player = ({ asset, buttons, readOnly, onChange }) => {
2931
- const isLoading = React.useMemo(() => asset?.status === "preparing" ? "Preparing the video" : asset?.status === "waiting_for_upload" ? "Waiting for upload to start" : asset?.status === "waiting" ? "Processing upload" : !(asset?.status === "ready" || typeof asset?.status > "u"), [asset]), isPreparingStaticRenditions = React.useMemo(() => asset?.data?.static_renditions?.status === "preparing", [asset?.data?.static_renditions?.status]), playRef = React.useRef(null), muteRef = React.useRef(null), handleCancelUpload = useCancelUpload(asset, onChange);
2936
+ const isLoading = React.useMemo(() => asset?.status === "preparing" ? "Preparing the video" : asset?.status === "waiting_for_upload" ? "Waiting for upload to start" : asset?.status === "waiting" ? "Processing upload" : !(asset?.status === "ready" || typeof asset?.status > "u"), [asset]), isPreparingStaticRenditions = React.useMemo(() => {
2937
+ if (asset?.data?.static_renditions?.status && asset?.data?.static_renditions?.status !== "disabled")
2938
+ return !1;
2939
+ const files = asset?.data?.static_renditions?.files;
2940
+ return !files || files.length === 0 ? !1 : files.some((file) => file.status === "preparing");
2941
+ }, [asset?.data?.static_renditions?.status, asset?.data?.static_renditions?.files]), playRef = React.useRef(null), muteRef = React.useRef(null), handleCancelUpload = useCancelUpload(asset, onChange);
2932
2942
  return React.useEffect(() => {
2933
2943
  const style = document.createElement("style");
2934
2944
  style.innerHTML = "button svg { vertical-align: middle; }", playRef.current?.shadowRoot && playRef.current.shadowRoot.appendChild(style), muteRef?.current?.shadowRoot && muteRef.current.shadowRoot.appendChild(style.cloneNode(!0));
@@ -3349,7 +3359,20 @@ const VIDEO_QUALITY_LEVELS = [
3349
3359
  { value: "1080p", label: "1080p" },
3350
3360
  { value: "1440p", label: "1440p (2k)" },
3351
3361
  { value: "2160p", label: "2160p (4k)" }
3362
+ ], ADVANCED_RESOLUTIONS = [
3363
+ { value: "270p", label: "270p" },
3364
+ { value: "360p", label: "360p" },
3365
+ { value: "480p", label: "480p" },
3366
+ { value: "540p", label: "540p" },
3367
+ { value: "720p", label: "720p" },
3368
+ { value: "1080p", label: "1080p" },
3369
+ { value: "1440p", label: "1440p" },
3370
+ { value: "2160p", label: "2160p" }
3352
3371
  ];
3372
+ function sanitizeStaticRenditions(renditions) {
3373
+ const hasHighest = renditions.includes("highest"), hasSpecificResolutions = renditions.some((r) => r !== "highest" && r !== "audio-only");
3374
+ return hasHighest && hasSpecificResolutions ? renditions.filter((r) => r === "highest" || r === "audio-only") : renditions;
3375
+ }
3353
3376
  function UploadConfiguration({
3354
3377
  stagedUpload,
3355
3378
  secrets,
@@ -3372,18 +3395,18 @@ function UploadConfiguration({
3372
3395
  case "video_quality":
3373
3396
  return action.value === "basic" ? Object.assign({}, prev, {
3374
3397
  video_quality: action.value,
3375
- mp4_support: "none",
3398
+ static_renditions: [],
3376
3399
  max_resolution_tier: "1080p",
3377
3400
  text_tracks: prev.text_tracks?.filter(({ type }) => type !== "autogenerated"),
3378
3401
  public_policy: !0,
3379
3402
  signed_policy: !1
3380
3403
  }) : Object.assign({}, prev, {
3381
3404
  video_quality: action.value,
3382
- mp4_support: pluginConfig.mp4_support,
3405
+ static_renditions: sanitizeStaticRenditions(pluginConfig.static_renditions || []),
3383
3406
  max_resolution_tier: pluginConfig.max_resolution_tier,
3384
3407
  text_tracks: [...autoTextTracks, ...prev.text_tracks || []]
3385
3408
  });
3386
- case "mp4_support":
3409
+ case "static_renditions":
3387
3410
  case "max_resolution_tier":
3388
3411
  case "normalize_audio":
3389
3412
  case "signed_policy":
@@ -3422,13 +3445,34 @@ function UploadConfiguration({
3422
3445
  {
3423
3446
  video_quality: pluginConfig.video_quality,
3424
3447
  max_resolution_tier: pluginConfig.max_resolution_tier,
3425
- mp4_support: pluginConfig.mp4_support,
3448
+ static_renditions: sanitizeStaticRenditions(pluginConfig.static_renditions || []),
3426
3449
  signed_policy: secrets.enableSignedUrls && pluginConfig.defaultSigned,
3427
3450
  public_policy: pluginConfig.defaultPublic,
3428
3451
  normalize_audio: pluginConfig.normalize_audio,
3429
3452
  text_tracks: autoTextTracks
3430
3453
  }
3431
- ), { disableTextTrackConfig, disableUploadConfig } = pluginConfig, skipConfig = disableTextTrackConfig && disableUploadConfig;
3454
+ ), isAdvancedMode = React.useMemo(() => config.static_renditions.filter(
3455
+ (r) => r !== "highest" && r !== "audio-only"
3456
+ ).length > 0, [config.static_renditions]), [renditionMode, setRenditionMode] = React.useState(
3457
+ isAdvancedMode ? "advanced" : "standard"
3458
+ ), toggleRendition = (rendition) => {
3459
+ const current = config.static_renditions, hasRendition = current.includes(rendition);
3460
+ dispatch(hasRendition ? {
3461
+ action: "static_renditions",
3462
+ value: current.filter((r) => r !== rendition)
3463
+ } : {
3464
+ action: "static_renditions",
3465
+ value: [...current, rendition]
3466
+ });
3467
+ }, handleModeChange = (mode) => {
3468
+ setRenditionMode(mode), dispatch(mode === "standard" ? {
3469
+ action: "static_renditions",
3470
+ value: config.static_renditions.filter((r) => r === "highest" || r === "audio-only")
3471
+ } : {
3472
+ action: "static_renditions",
3473
+ value: config.static_renditions.filter((r) => r !== "highest")
3474
+ });
3475
+ }, { disableTextTrackConfig, disableUploadConfig } = pluginConfig, skipConfig = disableTextTrackConfig && disableUploadConfig;
3432
3476
  if (React.useEffect(() => {
3433
3477
  skipConfig && startUpload(formatUploadConfig(config));
3434
3478
  }, []), skipConfig) return null;
@@ -3543,25 +3587,101 @@ function UploadConfiguration({
3543
3587
  }) })
3544
3588
  }
3545
3589
  ),
3546
- !basicConfig && /* @__PURE__ */ jsxRuntime.jsx(sanity.FormField, { title: "Additional Configuration", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 2, children: [
3590
+ !basicConfig && /* @__PURE__ */ jsxRuntime.jsx(sanity.FormField, { title: "Additional Configuration", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
3547
3591
  /* @__PURE__ */ jsxRuntime.jsx(PlaybackPolicy, { id, config, secrets, dispatch }),
3548
- !basicConfig && /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", gap: 2, padding: [0, 2], children: [
3549
- /* @__PURE__ */ jsxRuntime.jsx(
3550
- ui.Checkbox,
3551
- {
3552
- id: `${id}--mp4_support`,
3553
- style: { display: "block" },
3554
- name: "mp4_support",
3555
- required: !0,
3556
- checked: config.mp4_support === "standard",
3557
- onChange: (e) => dispatch({
3558
- action: "mp4_support",
3559
- value: e.currentTarget.checked ? "standard" : "none"
3560
- })
3561
- }
3562
- ),
3563
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: `${id}--mp4_support`, children: "MP4 support (allow downloading)" }) })
3564
- ] })
3592
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { space: 3, children: /* @__PURE__ */ jsxRuntime.jsx(
3593
+ sanity.FormField,
3594
+ {
3595
+ title: "Static Renditions",
3596
+ description: "Generate downloadable MP4 or M4A files. Note: Mux will not upscale to produce MP4 renditions - renditions that would cause upscaling are skipped.",
3597
+ children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
3598
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 3, children: [
3599
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", gap: 2, children: [
3600
+ /* @__PURE__ */ jsxRuntime.jsx(
3601
+ ui.Radio,
3602
+ {
3603
+ checked: renditionMode === "standard",
3604
+ name: "rendition-mode",
3605
+ onChange: () => handleModeChange("standard"),
3606
+ value: "standard",
3607
+ id: `${id}--mode-standard`
3608
+ }
3609
+ ),
3610
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "label", htmlFor: `${id}--mode-standard`, children: "Standard" })
3611
+ ] }),
3612
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", gap: 2, children: [
3613
+ /* @__PURE__ */ jsxRuntime.jsx(
3614
+ ui.Radio,
3615
+ {
3616
+ checked: renditionMode === "advanced",
3617
+ name: "rendition-mode",
3618
+ onChange: () => handleModeChange("advanced"),
3619
+ value: "advanced",
3620
+ id: `${id}--mode-advanced`
3621
+ }
3622
+ ),
3623
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "label", htmlFor: `${id}--mode-advanced`, children: "Advanced" })
3624
+ ] })
3625
+ ] }),
3626
+ renditionMode === "standard" && /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 2, children: [
3627
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", gap: 2, padding: [0, 2], children: [
3628
+ /* @__PURE__ */ jsxRuntime.jsx(
3629
+ ui.Checkbox,
3630
+ {
3631
+ id: `${id}--highest`,
3632
+ style: { display: "block" },
3633
+ checked: config.static_renditions.includes("highest"),
3634
+ onChange: () => toggleRendition("highest")
3635
+ }
3636
+ ),
3637
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "label", htmlFor: `${id}--highest`, children: "Highest Resolution (up to 4K)" })
3638
+ ] }),
3639
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", gap: 2, padding: [0, 2], children: [
3640
+ /* @__PURE__ */ jsxRuntime.jsx(
3641
+ ui.Checkbox,
3642
+ {
3643
+ id: `${id}--audio-only-standard`,
3644
+ style: { display: "block" },
3645
+ checked: config.static_renditions.includes("audio-only"),
3646
+ onChange: () => toggleRendition("audio-only")
3647
+ }
3648
+ ),
3649
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "label", htmlFor: `${id}--audio-only-standard`, children: "Audio Only (M4A)" })
3650
+ ] })
3651
+ ] }),
3652
+ renditionMode === "advanced" && /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 2, children: [
3653
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { size: 1, muted: !0, children: "Select specific resolutions:" }),
3654
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { gap: 2, wrap: "wrap", children: ADVANCED_RESOLUTIONS.map(({ value, label }) => {
3655
+ const inputId = `${id}--resolution-${value}`;
3656
+ return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", gap: 2, children: [
3657
+ /* @__PURE__ */ jsxRuntime.jsx(
3658
+ ui.Checkbox,
3659
+ {
3660
+ id: inputId,
3661
+ style: { display: "block" },
3662
+ checked: config.static_renditions.includes(value),
3663
+ onChange: () => toggleRendition(value)
3664
+ }
3665
+ ),
3666
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "label", htmlFor: inputId, size: 1, children: label })
3667
+ ] }, value);
3668
+ }) }),
3669
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", gap: 2, padding: [2, 2, 0, 2], children: [
3670
+ /* @__PURE__ */ jsxRuntime.jsx(
3671
+ ui.Checkbox,
3672
+ {
3673
+ id: `${id}--audio-only-advanced`,
3674
+ style: { display: "block" },
3675
+ checked: config.static_renditions.includes("audio-only"),
3676
+ onChange: () => toggleRendition("audio-only")
3677
+ }
3678
+ ),
3679
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "label", htmlFor: `${id}--audio-only-advanced`, children: "Audio Only (M4A)" })
3680
+ ] })
3681
+ ] })
3682
+ ] })
3683
+ }
3684
+ ) })
3565
3685
  ] }) })
3566
3686
  ] }),
3567
3687
  !disableTextTrackConfig && !basicConfig && /* @__PURE__ */ jsxRuntime.jsx(
@@ -3613,7 +3733,7 @@ function formatUploadConfig(config) {
3613
3733
  []
3614
3734
  )
3615
3735
  ],
3616
- mp4_support: config.mp4_support,
3736
+ static_renditions: config.static_renditions.length > 0 ? config.static_renditions.map((resolution) => ({ resolution })) : void 0,
3617
3737
  playback_policy: setPlaybackPolicy(config),
3618
3738
  max_resolution_tier: config.max_resolution_tier,
3619
3739
  video_quality: config.video_quality,
@@ -4116,12 +4236,18 @@ const muxVideoSchema = {
4116
4236
  name: "mux.staticRenditionFile",
4117
4237
  type: "object",
4118
4238
  fields: [
4119
- { type: "string", name: "ext" },
4120
4239
  { type: "string", name: "name" },
4240
+ { type: "string", name: "ext" },
4241
+ { type: "number", name: "height" },
4121
4242
  { type: "number", name: "width" },
4122
4243
  { type: "number", name: "bitrate" },
4123
- { type: "number", name: "filesize" },
4124
- { type: "number", name: "height" }
4244
+ { type: "string", name: "filesize" },
4245
+ { type: "string", name: "type" },
4246
+ { type: "string", name: "status" },
4247
+ { type: "string", name: "resolution_tier" },
4248
+ { type: "string", name: "resolution" },
4249
+ { type: "string", name: "id" },
4250
+ { type: "string", name: "passthrough" }
4125
4251
  ]
4126
4252
  }, muxStaticRenditions = {
4127
4253
  name: "mux.staticRenditions",
@@ -4252,6 +4378,7 @@ const muxVideoSchema = {
4252
4378
  muxAssetData,
4253
4379
  muxVideoAsset
4254
4380
  ], defaultConfig = {
4381
+ static_renditions: [],
4255
4382
  mp4_support: "none",
4256
4383
  video_quality: "plus",
4257
4384
  max_resolution_tier: "1080p",
@@ -4260,12 +4387,20 @@ const muxVideoSchema = {
4260
4387
  defaultSigned: !1,
4261
4388
  tool: DEFAULT_TOOL_CONFIG,
4262
4389
  allowedRolesForConfiguration: []
4263
- }, muxInput = sanity.definePlugin((userConfig) => {
4390
+ };
4391
+ function convertLegacyConfig(config) {
4392
+ return config.static_renditions && config.static_renditions.length > 0 ? { static_renditions: config.static_renditions } : config.mp4_support === "standard" ? { static_renditions: ["highest"] } : { static_renditions: [] };
4393
+ }
4394
+ const muxInput = sanity.definePlugin((userConfig) => {
4264
4395
  if (typeof userConfig == "object" && "encoding_tier" in userConfig) {
4265
4396
  const deprecated_encoding_tier = userConfig.encoding_tier;
4266
4397
  userConfig.video_quality || (deprecated_encoding_tier === "baseline" && (userConfig.video_quality = "basic"), deprecated_encoding_tier === "smart" && (userConfig.video_quality = "plus"));
4267
4398
  }
4268
- const config = { ...defaultConfig, ...userConfig || {} };
4399
+ const config = {
4400
+ ...defaultConfig,
4401
+ ...userConfig || {},
4402
+ ...convertLegacyConfig(userConfig || {})
4403
+ };
4269
4404
  return {
4270
4405
  name: "mux-input",
4271
4406
  schema: {