sanity-plugin-mux-input 2.3.3 → 2.3.5

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.
@@ -160,8 +160,7 @@ function hasMorePages(pageResult) {
160
160
  function useMuxAssets({ secrets, enabled }) {
161
161
  const [state, setState] = React.useState({ loading: !0, pageNum: FIRST_PAGE });
162
162
  return React.useEffect(() => {
163
- if (!enabled)
164
- return;
163
+ if (!enabled) return;
165
164
  const subscription = rxjs.defer(
166
165
  () => fetchMuxAssetsPage(
167
166
  secrets,
@@ -190,7 +189,7 @@ function useMuxAssets({ secrets, enabled }) {
190
189
  return () => subscription.unsubscribe();
191
190
  }, [enabled]), state;
192
191
  }
193
- const name = "mux-input", cacheNs = "sanity-plugin-mux-input", muxSecretsDocumentId = "secrets.mux", DIALOGS_Z_INDEX = 6e4, THUMBNAIL_ASPECT_RATIO = 1.7777777777777777, MIN_ASPECT_RATIO = 5 / 4, path$1 = ["token", "secretKey", "enableSignedUrls", "signingKeyId", "signingKeyPrivate"], useSecretsDocumentValues = () => {
192
+ const name = "mux-input", cacheNs = "sanity-plugin-mux-input", muxSecretsDocumentId = "secrets.mux", DIALOGS_Z_INDEX = 6e4, THUMBNAIL_ASPECT_RATIO = 1.7777777777777777, MIN_ASPECT_RATIO = 5 / 4, AUDIO_ASPECT_RATIO = 5 / 1, path$1 = ["token", "secretKey", "enableSignedUrls", "signingKeyId", "signingKeyPrivate"], useSecretsDocumentValues = () => {
194
193
  const { error, isLoading, value } = sanity.useDocumentValues(
195
194
  muxSecretsDocumentId,
196
195
  path$1
@@ -224,7 +223,7 @@ function useImportMuxAssets() {
224
223
  };
225
224
  async function importAssets() {
226
225
  setImportState("importing");
227
- const documents = selectedAssets.map(muxAssetToSanityDocument), tx = client.transaction();
226
+ const documents = selectedAssets.flatMap((asset) => muxAssetToSanityDocument(asset) || []), tx = client.transaction();
228
227
  documents.forEach((doc) => tx.create(doc));
229
228
  try {
230
229
  await tx.commit({ returnDocuments: !1 }), setSelectedAssets([]), setImportState("done");
@@ -249,17 +248,19 @@ function useImportMuxAssets() {
249
248
  }
250
249
  function muxAssetToSanityDocument(asset) {
251
250
  var _a;
252
- return {
253
- _id: uuid.uuid(),
254
- _type: "mux.videoAsset",
255
- _updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
256
- _createdAt: parseMuxDate(asset.created_at).toISOString(),
257
- assetId: asset.id,
258
- playbackId: (_a = asset.playback_ids.find((p) => p.id)) == null ? void 0 : _a.id,
259
- filename: `Asset #${sanity.truncateString(asset.id, 15)}`,
260
- status: asset.status,
261
- data: asset
262
- };
251
+ const playbackId = (_a = (asset.playback_ids || []).find((p) => p.id)) == null ? void 0 : _a.id;
252
+ if (playbackId)
253
+ return {
254
+ _id: uuid.uuid(),
255
+ _type: "mux.videoAsset",
256
+ _updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
257
+ _createdAt: parseMuxDate(asset.created_at).toISOString(),
258
+ assetId: asset.id,
259
+ playbackId,
260
+ filename: `Asset #${sanity.truncateString(asset.id, 15)}`,
261
+ status: asset.status,
262
+ data: asset
263
+ };
263
264
  }
264
265
  const useAssetsInSanity = sanity.createHookFromObservableFactory(
265
266
  (documentStore) => documentStore.listenQuery(
@@ -282,8 +283,7 @@ function assetExistsInSanity(asset, existingAssets) {
282
283
  function useInView(options = {}) {
283
284
  const [inView, setInView] = React.useState(!1), ref = React.useRef(null);
284
285
  return React.useEffect(() => {
285
- if (!ref.current)
286
- return;
286
+ if (!ref.current) return;
287
287
  const observer = new IntersectionObserver(([entry], obs) => {
288
288
  var _a;
289
289
  const nowInView = entry.isIntersecting && obs.thresholds.some((threshold) => entry.intersectionRatio >= threshold);
@@ -321,9 +321,9 @@ function readSecrets(client) {
321
321
  function generateJwt(client, playbackId, aud, payload) {
322
322
  const { signingKeyId, signingKeyPrivate } = readSecrets(client);
323
323
  if (!signingKeyId)
324
- throw new TypeError("Missing signingKeyId");
324
+ throw new TypeError("Missing `signingKeyId`.\n Check your plugin's configuration");
325
325
  if (!signingKeyPrivate)
326
- throw new TypeError("Missing signingKeyPrivate");
326
+ throw new TypeError("Missing `signingKeyPrivate`.\n Check your plugin's configuration");
327
327
  const { default: sign } = suspendReact.suspend(() => import("jsonwebtoken-esm/sign"), ["jsonwebtoken-esm/sign"]);
328
328
  return sign(
329
329
  payload ? JSON.parse(JSON.stringify(payload, (_, v) => v != null ? v : void 0)) : {},
@@ -774,7 +774,7 @@ function VideoPlayer({
774
774
  ...props
775
775
  }) {
776
776
  var _a, _b;
777
- const client = useClient(), { src: videoSrc, error } = React.useMemo(() => {
777
+ const client = useClient(), isAudio = assetIsAudio(asset), { src: videoSrc, error } = React.useMemo(() => {
778
778
  try {
779
779
  const src = (asset == null ? void 0 : asset.playbackId) && getVideoSrc({ client, asset });
780
780
  return src ? { src } : { error: new TypeError("Asset has no playback ID") };
@@ -787,8 +787,12 @@ function VideoPlayer({
787
787
  } catch {
788
788
  return !1;
789
789
  }
790
- }, [videoSrc]), [width, height] = ((_b = (_a = asset == null ? void 0 : asset.data) == null ? void 0 : _a.aspect_ratio) != null ? _b : "16:9").split(":").map(Number), targetAspectRatio = props.forceAspectRatio || (Number.isNaN(width) ? 16 / 9 : width / height), aspectRatio = Math.max(MIN_ASPECT_RATIO, targetAspectRatio);
791
- return /* @__PURE__ */ jsxRuntime.jsxs(ui.Card, { tone: "transparent", style: { aspectRatio, position: "relative" }, children: [
790
+ }, [videoSrc]), [width, height] = ((_b = (_a = asset == null ? void 0 : asset.data) == null ? void 0 : _a.aspect_ratio) != null ? _b : "16:9").split(":").map(Number), targetAspectRatio = props.forceAspectRatio || (Number.isNaN(width) ? 16 / 9 : width / height);
791
+ let aspectRatio = Math.max(MIN_ASPECT_RATIO, targetAspectRatio);
792
+ return isAudio && (aspectRatio = props.forceAspectRatio ? (
793
+ // Make it wider when forcing aspect ratio to balance with videos' rendering height (audio players overflow a bit)
794
+ props.forceAspectRatio * 1.2
795
+ ) : AUDIO_ASPECT_RATIO), /* @__PURE__ */ jsxRuntime.jsxs(ui.Card, { tone: "transparent", style: { aspectRatio, position: "relative" }, children: [
792
796
  videoSrc && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
793
797
  /* @__PURE__ */ jsxRuntime.jsx(
794
798
  MuxPlayer__default.default,
@@ -801,9 +805,10 @@ function VideoPlayer({
801
805
  crossOrigin: "anonymous",
802
806
  metadata: {
803
807
  player_name: "Sanity Admin Dashboard",
804
- player_version: "2.3.3",
808
+ player_version: "2.3.5",
805
809
  page_type: "Preview Player"
806
810
  },
811
+ audio: isAudio,
807
812
  style: {
808
813
  height: "100%",
809
814
  width: "100%",
@@ -832,6 +837,10 @@ function VideoPlayer({
832
837
  children
833
838
  ] });
834
839
  }
840
+ function assetIsAudio(asset) {
841
+ var _a;
842
+ return ((_a = asset.data) == null ? void 0 : _a.max_stored_resolution) === "Audio only";
843
+ }
835
844
  function deleteAssetOnMux(client, assetId) {
836
845
  const { dataset } = client.config();
837
846
  return client.request({
@@ -845,8 +854,7 @@ async function deleteAsset({
845
854
  asset,
846
855
  deleteOnMux
847
856
  }) {
848
- if (!(asset != null && asset._id))
849
- return !0;
857
+ if (!(asset != null && asset._id)) return !0;
850
858
  try {
851
859
  await client.delete(asset._id);
852
860
  } catch {
@@ -1037,8 +1045,7 @@ function DeleteDialog({
1037
1045
  state !== "checkingReferences" || referencesLoading || setState(references != null && references.length ? "cantDelete" : "confirm");
1038
1046
  }, [state, references, referencesLoading]);
1039
1047
  async function confirmDelete() {
1040
- if (state !== "confirm")
1041
- return;
1048
+ if (state !== "confirm") return;
1042
1049
  setState("processing_deletion");
1043
1050
  const worked = await deleteAsset({ client, asset, deleteOnMux });
1044
1051
  worked === !0 ? (toast.push({ title: "Successfully deleted video", status: "success" }), succeededDeleting()) : worked === "failed-mux" ? (toast.push({
@@ -1627,7 +1634,25 @@ function VideoInBrowser({
1627
1634
  children: [
1628
1635
  renderVideo ? /* @__PURE__ */ jsxRuntime.jsx(VideoPlayer, { asset, autoPlay: !0, forceAspectRatio: THUMBNAIL_ASPECT_RATIO }) : /* @__PURE__ */ jsxRuntime.jsxs(PlayButton, { onClick: () => setRenderVideo(!0), children: [
1629
1636
  /* @__PURE__ */ jsxRuntime.jsx("div", { "data-play": !0, children: /* @__PURE__ */ jsxRuntime.jsx(icons.PlayIcon, {}) }),
1630
- /* @__PURE__ */ jsxRuntime.jsx(VideoThumbnail, { asset })
1637
+ assetIsAudio(asset) ? /* @__PURE__ */ jsxRuntime.jsx(
1638
+ "div",
1639
+ {
1640
+ style: {
1641
+ aspectRatio: THUMBNAIL_ASPECT_RATIO,
1642
+ display: "flex",
1643
+ alignItems: "center",
1644
+ justifyContent: "center"
1645
+ },
1646
+ children: /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "3em", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsxRuntime.jsx(
1647
+ "path",
1648
+ {
1649
+ fill: "currentColor",
1650
+ style: { opacity: "0.65" },
1651
+ d: "M10.75 19q.95 0 1.6-.65t.65-1.6V13h3v-2h-4v3.875q-.275-.2-.587-.288t-.663-.087q-.95 0-1.6.65t-.65 1.6t.65 1.6t1.6.65M6 22q-.825 0-1.412-.587T4 20V4q0-.825.588-1.412T6 2h8l6 6v12q0 .825-.587 1.413T18 22zm7-13V4H6v16h12V9zM6 4v5zv16z"
1652
+ }
1653
+ ) })
1654
+ }
1655
+ ) : /* @__PURE__ */ jsxRuntime.jsx(VideoThumbnail, { asset })
1631
1656
  ] }),
1632
1657
  /* @__PURE__ */ jsxRuntime.jsx(VideoMetadata, { asset }),
1633
1658
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -3359,47 +3384,45 @@ const ALL_LANGUAGE_CODES = LanguagesList__default.default.getAllCodes().map((cod
3359
3384
  })),
3360
3385
  subtitles: ALL_LANGUAGE_CODES,
3361
3386
  captions: ALL_LANGUAGE_CODES
3362
- }, TRACK_TYPES = [
3363
- { value: "autogenerated", label: "Auto-generated Subtitles" }
3364
- // {value: 'subtitles', label: 'Subtitles'},
3365
- // {value: 'captions', label: 'Closed Captions'},
3366
- ];
3367
- function TrackEditor({
3368
- canAutoGenerate,
3369
- track,
3370
- dispatch
3387
+ };
3388
+ function TextTracksEditor({
3389
+ tracks,
3390
+ dispatch,
3391
+ defaultLang
3371
3392
  }) {
3372
- const { _id: id, type } = track, dispatchTrackAction = (args) => dispatch({ action: "track", id, ...args }), trackTypes = TRACK_TYPES.filter(
3373
- ({ value }) => !(value === "autogenerated" && !canAutoGenerate)
3374
- );
3375
- return trackTypes.length === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { border: !0, padding: 3, radius: 2, style: { position: "relative" }, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
3376
- trackTypes.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(sanity.FormField, { title: "Auto-generated subtitles", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { gap: 3, children: trackTypes.map(({ value, label }) => {
3377
- const inputId = `${id}--type-${value}`;
3378
- return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", gap: 2, children: [
3379
- /* @__PURE__ */ jsxRuntime.jsx(
3380
- ui.Radio,
3381
- {
3382
- checked: type === value,
3383
- name: "track-type",
3384
- onChange: (e) => dispatchTrackAction({
3385
- subAction: "update",
3393
+ const track = tracks[0];
3394
+ return /* @__PURE__ */ jsxRuntime.jsx(sanity.FormField, { title: "Auto-generated subtitle or caption", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 2, children: [
3395
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", children: [
3396
+ /* @__PURE__ */ jsxRuntime.jsx(
3397
+ ui.Checkbox,
3398
+ {
3399
+ id: "include-autogenerated-track",
3400
+ style: { display: "block" },
3401
+ checked: !!(track != null && track.language_code),
3402
+ onChange: () => {
3403
+ dispatch(track ? { action: "track", id: track._id, subAction: "delete" } : {
3404
+ action: "track",
3405
+ id: uuid.uuid(),
3406
+ subAction: "add",
3386
3407
  value: {
3387
- type: e.currentTarget.value
3408
+ type: "autogenerated",
3409
+ name: defaultLang || void 0,
3410
+ language_code: defaultLang || void 0
3388
3411
  }
3389
- }),
3390
- value,
3391
- id: inputId
3412
+ });
3392
3413
  }
3393
- ),
3394
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "label", htmlFor: inputId, children: label })
3395
- ] }, value);
3396
- }) }) }),
3397
- /* @__PURE__ */ jsxRuntime.jsx(
3414
+ }
3415
+ ),
3416
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, paddingLeft: 3, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "checkbox", children: "Generate captions" }) }) })
3417
+ ] }),
3418
+ track && /* @__PURE__ */ jsxRuntime.jsx(
3398
3419
  ui.Autocomplete,
3399
3420
  {
3400
- id: `${id}--language`,
3421
+ id: "text-tract-editor--language",
3401
3422
  value: track.language_code,
3402
- onChange: (newValue) => dispatchTrackAction({
3423
+ onChange: (newValue) => dispatch({
3424
+ action: "track",
3425
+ id: track._id,
3403
3426
  subAction: "update",
3404
3427
  value: {
3405
3428
  language_code: newValue,
@@ -3422,54 +3445,9 @@ function TrackEditor({
3422
3445
  ")"
3423
3446
  ] }) })
3424
3447
  }
3425
- ),
3426
- /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
3427
- ui.Button,
3428
- {
3429
- icon: icons.TrashIcon,
3430
- tone: "critical",
3431
- mode: "ghost",
3432
- onClick: () => dispatchTrackAction({ subAction: "delete" }),
3433
- text: "Delete"
3434
- }
3435
- ) })
3448
+ )
3436
3449
  ] }) });
3437
3450
  }
3438
- function TextTracksEditor({
3439
- canAutoGenerate,
3440
- tracks,
3441
- dispatch
3442
- }) {
3443
- return TRACK_TYPES.filter(
3444
- ({ value }) => !(value === "autogenerated" && !canAutoGenerate)
3445
- ).length === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(
3446
- sanity.FormField,
3447
- {
3448
- title: "Captions & Subtitles",
3449
- description: "Provide text tracks for video accessibility.",
3450
- children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 2, children: [
3451
- tracks.map((track) => /* @__PURE__ */ jsxRuntime.jsx(
3452
- TrackEditor,
3453
- {
3454
- canAutoGenerate,
3455
- track,
3456
- dispatch
3457
- },
3458
- track._id
3459
- )),
3460
- /* @__PURE__ */ jsxRuntime.jsx(
3461
- ui.Button,
3462
- {
3463
- icon: icons.AddIcon,
3464
- onClick: () => dispatch({ action: "track", id: uuid.uuid(), subAction: "add" }),
3465
- text: "New caption/subtitle",
3466
- mode: "ghost"
3467
- }
3468
- )
3469
- ] })
3470
- }
3471
- );
3472
- }
3473
3451
  const ENCODING_OPTIONS = [
3474
3452
  { value: "smart", label: "Smart" },
3475
3453
  { value: "baseline", label: "Baseline" }
@@ -3485,26 +3463,25 @@ function UploadConfiguration({
3485
3463
  startUpload,
3486
3464
  onClose
3487
3465
  }) {
3488
- var _a;
3489
3466
  const id = React.useId(), autoTextTracks = React.useRef(
3490
- pluginConfig.encoding_tier === "smart" && ((_a = pluginConfig.defaultAutogeneratedSubtitleLangs) == null ? void 0 : _a.map(
3491
- (language_code) => ({
3467
+ pluginConfig.encoding_tier === "smart" && pluginConfig.defaultAutogeneratedSubtitleLang ? [
3468
+ {
3492
3469
  _id: uuid.uuid(),
3493
3470
  type: "autogenerated",
3494
- language_code,
3495
- name: LanguagesList__default.default.getNativeName(language_code)
3496
- })
3497
- )) || []
3471
+ language_code: pluginConfig.defaultAutogeneratedSubtitleLang,
3472
+ name: LanguagesList__default.default.getNativeName(pluginConfig.defaultAutogeneratedSubtitleLang)
3473
+ }
3474
+ ] : []
3498
3475
  ).current, [config, dispatch] = React.useReducer(
3499
3476
  (prev, action) => {
3500
- var _a2;
3477
+ var _a;
3501
3478
  switch (action.action) {
3502
3479
  case "encoding_tier":
3503
3480
  return action.value === "baseline" ? Object.assign({}, prev, {
3504
3481
  encoding_tier: action.value,
3505
3482
  mp4_support: "none",
3506
3483
  max_resolution_tier: "1080p",
3507
- text_tracks: (_a2 = prev.text_tracks) == null ? void 0 : _a2.filter(({ type }) => type !== "autogenerated")
3484
+ text_tracks: (_a = prev.text_tracks) == null ? void 0 : _a.filter(({ type }) => type !== "autogenerated")
3508
3485
  }) : Object.assign({}, prev, {
3509
3486
  encoding_tier: action.value,
3510
3487
  mp4_support: pluginConfig.mp4_support,
@@ -3520,23 +3497,21 @@ function UploadConfiguration({
3520
3497
  const text_tracks = [...prev.text_tracks], target_track_i = text_tracks.findIndex(({ _id: _id2 }) => _id2 === action.id);
3521
3498
  switch (action.subAction) {
3522
3499
  case "add":
3523
- if (target_track_i !== -1)
3524
- break;
3525
- text_tracks.push(
3526
- prev.encoding_tier === "smart" ? { _id: action.id, type: "autogenerated" } : { _id: action.id, type: "subtitles" }
3527
- );
3500
+ if (target_track_i !== -1) break;
3501
+ text_tracks.push({
3502
+ _id: action.id,
3503
+ ...action.value
3504
+ });
3528
3505
  break;
3529
3506
  case "update":
3530
- if (target_track_i === -1)
3531
- break;
3507
+ if (target_track_i === -1) break;
3532
3508
  text_tracks[target_track_i] = {
3533
3509
  ...text_tracks[target_track_i],
3534
3510
  ...action.value
3535
3511
  };
3536
3512
  break;
3537
3513
  case "delete":
3538
- if (target_track_i === -1)
3539
- break;
3514
+ if (target_track_i === -1) break;
3540
3515
  text_tracks.splice(target_track_i, 1);
3541
3516
  break;
3542
3517
  }
@@ -3557,8 +3532,7 @@ function UploadConfiguration({
3557
3532
  ), { disableTextTrackConfig, disableUploadConfig } = pluginConfig, skipConfig = disableTextTrackConfig && disableUploadConfig;
3558
3533
  if (React.useEffect(() => {
3559
3534
  skipConfig && startUpload(formatUploadConfig(config));
3560
- }, []), skipConfig)
3561
- return null;
3535
+ }, []), skipConfig) return null;
3562
3536
  const maxSupportedResolution = RESOLUTION_TIERS.findIndex(
3563
3537
  (rt) => rt.value === pluginConfig.max_resolution_tier
3564
3538
  );
@@ -3707,15 +3681,15 @@ function UploadConfiguration({
3707
3681
  ] })
3708
3682
  ] }) })
3709
3683
  ] }),
3710
- !disableTextTrackConfig && /* @__PURE__ */ jsxRuntime.jsx(
3684
+ !disableTextTrackConfig && config.encoding_tier === "smart" && /* @__PURE__ */ jsxRuntime.jsx(
3711
3685
  TextTracksEditor,
3712
3686
  {
3713
- canAutoGenerate: config.encoding_tier === "smart",
3714
3687
  tracks: config.text_tracks,
3715
- dispatch
3688
+ dispatch,
3689
+ defaultLang: pluginConfig.defaultAutogeneratedSubtitleLang
3716
3690
  }
3717
3691
  ),
3718
- /* @__PURE__ */ jsxRuntime.jsx(
3692
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(
3719
3693
  ui.Button,
3720
3694
  {
3721
3695
  icon: icons.UploadIcon,
@@ -3723,7 +3697,7 @@ function UploadConfiguration({
3723
3697
  tone: "positive",
3724
3698
  onClick: () => startUpload(formatUploadConfig(config))
3725
3699
  }
3726
- )
3700
+ ) })
3727
3701
  ] })
3728
3702
  }
3729
3703
  );
@@ -3981,8 +3955,7 @@ function Uploader(props) {
3981
3955
  }, []);
3982
3956
  const startUpload = (settings) => {
3983
3957
  const { stagedUpload } = state;
3984
- if (!stagedUpload || uploadRef.current)
3985
- return;
3958
+ if (!stagedUpload || uploadRef.current) return;
3986
3959
  dispatch({ action: "commitUpload" });
3987
3960
  let uploadObservable;
3988
3961
  switch (stagedUpload.type) {
@@ -4205,7 +4178,7 @@ function muxVideoCustomRendering(config) {
4205
4178
  }
4206
4179
  };
4207
4180
  }
4208
- const muxVideo = {
4181
+ const muxVideoSchema = {
4209
4182
  name: "mux.video",
4210
4183
  type: "object",
4211
4184
  title: "Video asset reference",
@@ -4218,6 +4191,122 @@ const muxVideo = {
4218
4191
  to: [{ type: "mux.videoAsset" }]
4219
4192
  }
4220
4193
  ]
4194
+ }, muxTrack = {
4195
+ name: "mux.track",
4196
+ type: "object",
4197
+ fields: [
4198
+ { type: "string", name: "id" },
4199
+ { type: "string", name: "type" },
4200
+ { type: "number", name: "max_width" },
4201
+ { type: "number", name: "max_frame_rate" },
4202
+ { type: "number", name: "duration" },
4203
+ { type: "number", name: "max_height" }
4204
+ ]
4205
+ }, muxPlaybackId = {
4206
+ name: "mux.playbackId",
4207
+ type: "object",
4208
+ fields: [
4209
+ { type: "string", name: "id" },
4210
+ { type: "string", name: "policy" }
4211
+ ]
4212
+ }, muxStaticRenditionFile = {
4213
+ name: "mux.staticRenditionFile",
4214
+ type: "object",
4215
+ fields: [
4216
+ { type: "string", name: "ext" },
4217
+ { type: "string", name: "name" },
4218
+ { type: "number", name: "width" },
4219
+ { type: "number", name: "bitrate" },
4220
+ { type: "number", name: "filesize" },
4221
+ { type: "number", name: "height" }
4222
+ ]
4223
+ }, muxStaticRenditions = {
4224
+ name: "mux.staticRenditions",
4225
+ type: "object",
4226
+ fields: [
4227
+ { type: "string", name: "status" },
4228
+ {
4229
+ name: "files",
4230
+ type: "array",
4231
+ of: [{ type: "mux.staticRenditionFile" }]
4232
+ }
4233
+ ]
4234
+ }, muxAssetData = {
4235
+ name: "mux.assetData",
4236
+ title: "Mux asset data",
4237
+ type: "object",
4238
+ fields: [
4239
+ {
4240
+ type: "string",
4241
+ name: "resolution_tier"
4242
+ },
4243
+ {
4244
+ type: "string",
4245
+ name: "upload_id"
4246
+ },
4247
+ {
4248
+ type: "string",
4249
+ name: "created_at"
4250
+ },
4251
+ {
4252
+ type: "string",
4253
+ name: "id"
4254
+ },
4255
+ {
4256
+ type: "string",
4257
+ name: "status"
4258
+ },
4259
+ {
4260
+ type: "string",
4261
+ name: "max_stored_resolution"
4262
+ },
4263
+ {
4264
+ type: "string",
4265
+ name: "passthrough"
4266
+ },
4267
+ {
4268
+ type: "string",
4269
+ name: "encoding_tier"
4270
+ },
4271
+ {
4272
+ type: "string",
4273
+ name: "master_access"
4274
+ },
4275
+ {
4276
+ type: "string",
4277
+ name: "aspect_ratio"
4278
+ },
4279
+ {
4280
+ type: "number",
4281
+ name: "duration"
4282
+ },
4283
+ {
4284
+ type: "number",
4285
+ name: "max_stored_frame_rate"
4286
+ },
4287
+ {
4288
+ type: "string",
4289
+ name: "mp4_support"
4290
+ },
4291
+ {
4292
+ type: "string",
4293
+ name: "max_resolution_tier"
4294
+ },
4295
+ {
4296
+ name: "tracks",
4297
+ type: "array",
4298
+ of: [{ type: "mux.track" }]
4299
+ },
4300
+ {
4301
+ name: "playback_ids",
4302
+ type: "array",
4303
+ of: [{ type: "mux.playbackId" }]
4304
+ },
4305
+ {
4306
+ name: "static_renditions",
4307
+ type: "mux.staticRenditions"
4308
+ }
4309
+ ]
4221
4310
  }, muxVideoAsset = {
4222
4311
  name: "mux.videoAsset",
4223
4312
  type: "object",
@@ -4242,9 +4331,20 @@ const muxVideo = {
4242
4331
  {
4243
4332
  type: "number",
4244
4333
  name: "thumbTime"
4334
+ },
4335
+ {
4336
+ type: "mux.assetData",
4337
+ name: "data"
4245
4338
  }
4246
4339
  ]
4247
- }, defaultConfig = {
4340
+ }, schemaTypes = [
4341
+ muxTrack,
4342
+ muxPlaybackId,
4343
+ muxStaticRenditionFile,
4344
+ muxStaticRenditions,
4345
+ muxAssetData,
4346
+ muxVideoAsset
4347
+ ], defaultConfig = {
4248
4348
  mp4_support: "none",
4249
4349
  encoding_tier: "smart",
4250
4350
  max_resolution_tier: "1080p",
@@ -4257,9 +4357,9 @@ const muxVideo = {
4257
4357
  name: "mux-input",
4258
4358
  schema: {
4259
4359
  types: [
4260
- muxVideoAsset,
4360
+ ...schemaTypes,
4261
4361
  {
4262
- ...muxVideo,
4362
+ ...muxVideoSchema,
4263
4363
  ...muxVideoCustomRendering(config)
4264
4364
  }
4265
4365
  ]
@@ -4269,4 +4369,4 @@ const muxVideo = {
4269
4369
  });
4270
4370
  exports.defaultConfig = defaultConfig;
4271
4371
  exports.muxInput = muxInput;
4272
- //# sourceMappingURL=index.cjs.map
4372
+ //# sourceMappingURL=index.js.map