sanity-plugin-mux-input 2.10.0 → 2.10.1
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 +8 -8
- package/dist/index.d.mts +13 -5
- package/dist/index.d.ts +13 -5
- package/dist/index.js +32 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/_exports/index.ts +13 -1
- package/src/components/UploadConfiguration.tsx +28 -28
- package/src/schema.ts +4 -0
- package/src/util/types.ts +20 -10
package/dist/index.mjs
CHANGED
|
@@ -1522,7 +1522,7 @@ function VideoPlayer({
|
|
|
1522
1522
|
crossOrigin: "anonymous",
|
|
1523
1523
|
metadata: {
|
|
1524
1524
|
player_name: "Sanity Admin Dashboard",
|
|
1525
|
-
player_version: "2.10.
|
|
1525
|
+
player_version: "2.10.1",
|
|
1526
1526
|
page_type: "Preview Player"
|
|
1527
1527
|
},
|
|
1528
1528
|
audio: isAudio,
|
|
@@ -3331,9 +3331,10 @@ function PlaybackPolicy({
|
|
|
3331
3331
|
noPolicySelected && /* @__PURE__ */ jsx(PlaybackPolicyWarning, {})
|
|
3332
3332
|
] });
|
|
3333
3333
|
}
|
|
3334
|
-
const
|
|
3335
|
-
{ value: "
|
|
3336
|
-
{ value: "
|
|
3334
|
+
const VIDEO_QUALITY_LEVELS = [
|
|
3335
|
+
{ value: "basic", label: "Basic" },
|
|
3336
|
+
{ value: "plus", label: "Plus" },
|
|
3337
|
+
{ value: "premium", label: "Premium" }
|
|
3337
3338
|
], RESOLUTION_TIERS = [
|
|
3338
3339
|
{ value: "1080p", label: "1080p" },
|
|
3339
3340
|
{ value: "1440p", label: "1440p (2k)" },
|
|
@@ -3347,7 +3348,7 @@ function UploadConfiguration({
|
|
|
3347
3348
|
onClose
|
|
3348
3349
|
}) {
|
|
3349
3350
|
const id = useId(), autoTextTracks = useRef(
|
|
3350
|
-
pluginConfig.
|
|
3351
|
+
pluginConfig.video_quality === "plus" && pluginConfig.defaultAutogeneratedSubtitleLang ? [
|
|
3351
3352
|
{
|
|
3352
3353
|
_id: uuid(),
|
|
3353
3354
|
type: "autogenerated",
|
|
@@ -3358,16 +3359,16 @@ function UploadConfiguration({
|
|
|
3358
3359
|
).current, [config, dispatch] = useReducer(
|
|
3359
3360
|
(prev, action) => {
|
|
3360
3361
|
switch (action.action) {
|
|
3361
|
-
case "
|
|
3362
|
-
return action.value === "
|
|
3363
|
-
|
|
3362
|
+
case "video_quality":
|
|
3363
|
+
return action.value === "basic" ? Object.assign({}, prev, {
|
|
3364
|
+
video_quality: action.value,
|
|
3364
3365
|
mp4_support: "none",
|
|
3365
3366
|
max_resolution_tier: "1080p",
|
|
3366
3367
|
text_tracks: prev.text_tracks?.filter(({ type }) => type !== "autogenerated"),
|
|
3367
3368
|
public_policy: !0,
|
|
3368
3369
|
signed_policy: !1
|
|
3369
3370
|
}) : Object.assign({}, prev, {
|
|
3370
|
-
|
|
3371
|
+
video_quality: action.value,
|
|
3371
3372
|
mp4_support: pluginConfig.mp4_support,
|
|
3372
3373
|
max_resolution_tier: pluginConfig.max_resolution_tier,
|
|
3373
3374
|
text_tracks: [...autoTextTracks, ...prev.text_tracks || []]
|
|
@@ -3409,7 +3410,7 @@ function UploadConfiguration({
|
|
|
3409
3410
|
}
|
|
3410
3411
|
},
|
|
3411
3412
|
{
|
|
3412
|
-
|
|
3413
|
+
video_quality: pluginConfig.video_quality,
|
|
3413
3414
|
max_resolution_tier: pluginConfig.max_resolution_tier,
|
|
3414
3415
|
mp4_support: pluginConfig.mp4_support,
|
|
3415
3416
|
signed_policy: secrets.enableSignedUrls && pluginConfig.defaultSigned,
|
|
@@ -3421,7 +3422,7 @@ function UploadConfiguration({
|
|
|
3421
3422
|
if (useEffect(() => {
|
|
3422
3423
|
skipConfig && startUpload(formatUploadConfig(config));
|
|
3423
3424
|
}, []), skipConfig) return null;
|
|
3424
|
-
const maxSupportedResolution = RESOLUTION_TIERS.findIndex(
|
|
3425
|
+
const basicConfig = config.video_quality !== "plus" && config.video_quality !== "premium", maxSupportedResolution = RESOLUTION_TIERS.findIndex(
|
|
3425
3426
|
(rt) => rt.value === pluginConfig.max_resolution_tier
|
|
3426
3427
|
);
|
|
3427
3428
|
return /* @__PURE__ */ jsx(
|
|
@@ -3457,9 +3458,9 @@ function UploadConfiguration({
|
|
|
3457
3458
|
/* @__PURE__ */ jsx(
|
|
3458
3459
|
FormField$2,
|
|
3459
3460
|
{
|
|
3460
|
-
title: "
|
|
3461
|
+
title: "Video Quality Level",
|
|
3461
3462
|
description: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3462
|
-
"The
|
|
3463
|
+
"The video quality level informs the cost, quality, and available platform features for the asset.",
|
|
3463
3464
|
" ",
|
|
3464
3465
|
/* @__PURE__ */ jsx(
|
|
3465
3466
|
"a",
|
|
@@ -3471,16 +3472,16 @@ function UploadConfiguration({
|
|
|
3471
3472
|
}
|
|
3472
3473
|
)
|
|
3473
3474
|
] }),
|
|
3474
|
-
children: /* @__PURE__ */ jsx(Flex, { gap: 3, children:
|
|
3475
|
+
children: /* @__PURE__ */ jsx(Flex, { gap: 3, children: VIDEO_QUALITY_LEVELS.map(({ value, label }) => {
|
|
3475
3476
|
const inputId = `${id}--encodingtier-${value}`;
|
|
3476
3477
|
return /* @__PURE__ */ jsxs(Flex, { align: "center", gap: 2, children: [
|
|
3477
3478
|
/* @__PURE__ */ jsx(
|
|
3478
3479
|
Radio,
|
|
3479
3480
|
{
|
|
3480
|
-
checked: config.
|
|
3481
|
+
checked: config.video_quality === value,
|
|
3481
3482
|
name: "asset-encodingtier",
|
|
3482
3483
|
onChange: (e) => dispatch({
|
|
3483
|
-
action: "
|
|
3484
|
+
action: "video_quality",
|
|
3484
3485
|
value: e.currentTarget.value
|
|
3485
3486
|
}),
|
|
3486
3487
|
value,
|
|
@@ -3492,7 +3493,7 @@ function UploadConfiguration({
|
|
|
3492
3493
|
}) })
|
|
3493
3494
|
}
|
|
3494
3495
|
),
|
|
3495
|
-
|
|
3496
|
+
!basicConfig && maxSupportedResolution > 0 && /* @__PURE__ */ jsx(
|
|
3496
3497
|
FormField$2,
|
|
3497
3498
|
{
|
|
3498
3499
|
title: "Resolution Tier",
|
|
@@ -3532,9 +3533,9 @@ function UploadConfiguration({
|
|
|
3532
3533
|
}) })
|
|
3533
3534
|
}
|
|
3534
3535
|
),
|
|
3535
|
-
|
|
3536
|
+
!basicConfig && /* @__PURE__ */ jsx(FormField$2, { title: "Additional Configuration", children: /* @__PURE__ */ jsxs(Stack, { space: 2, children: [
|
|
3536
3537
|
/* @__PURE__ */ jsx(PlaybackPolicy, { id, config, secrets, dispatch }),
|
|
3537
|
-
|
|
3538
|
+
!basicConfig && /* @__PURE__ */ jsxs(Flex, { align: "center", gap: 2, padding: [0, 2], children: [
|
|
3538
3539
|
/* @__PURE__ */ jsx(
|
|
3539
3540
|
Checkbox,
|
|
3540
3541
|
{
|
|
@@ -3553,7 +3554,7 @@ function UploadConfiguration({
|
|
|
3553
3554
|
] })
|
|
3554
3555
|
] }) })
|
|
3555
3556
|
] }),
|
|
3556
|
-
!disableTextTrackConfig &&
|
|
3557
|
+
!disableTextTrackConfig && !basicConfig && /* @__PURE__ */ jsx(
|
|
3557
3558
|
TextTracksEditor,
|
|
3558
3559
|
{
|
|
3559
3560
|
tracks: config.text_tracks,
|
|
@@ -3564,7 +3565,7 @@ function UploadConfiguration({
|
|
|
3564
3565
|
/* @__PURE__ */ jsx(Box, { marginTop: 4, children: /* @__PURE__ */ jsx(
|
|
3565
3566
|
Button,
|
|
3566
3567
|
{
|
|
3567
|
-
disabled:
|
|
3568
|
+
disabled: !basicConfig && !config.public_policy && !config.signed_policy,
|
|
3568
3569
|
icon: UploadIcon,
|
|
3569
3570
|
text: "Upload",
|
|
3570
3571
|
tone: "positive",
|
|
@@ -3605,7 +3606,7 @@ function formatUploadConfig(config) {
|
|
|
3605
3606
|
mp4_support: config.mp4_support,
|
|
3606
3607
|
playback_policy: setPlaybackPolicy(config),
|
|
3607
3608
|
max_resolution_tier: config.max_resolution_tier,
|
|
3608
|
-
|
|
3609
|
+
video_quality: config.video_quality,
|
|
3609
3610
|
normalize_audio: config.normalize_audio
|
|
3610
3611
|
};
|
|
3611
3612
|
}
|
|
@@ -4146,6 +4147,10 @@ const muxVideoSchema = {
|
|
|
4146
4147
|
type: "string",
|
|
4147
4148
|
name: "encoding_tier"
|
|
4148
4149
|
},
|
|
4150
|
+
{
|
|
4151
|
+
type: "string",
|
|
4152
|
+
name: "video_quality"
|
|
4153
|
+
},
|
|
4149
4154
|
{
|
|
4150
4155
|
type: "string",
|
|
4151
4156
|
name: "master_access"
|
|
@@ -4224,13 +4229,17 @@ const muxVideoSchema = {
|
|
|
4224
4229
|
muxVideoAsset
|
|
4225
4230
|
], defaultConfig = {
|
|
4226
4231
|
mp4_support: "none",
|
|
4227
|
-
|
|
4232
|
+
video_quality: "plus",
|
|
4228
4233
|
max_resolution_tier: "1080p",
|
|
4229
4234
|
normalize_audio: !1,
|
|
4230
4235
|
defaultSigned: !1,
|
|
4231
4236
|
tool: DEFAULT_TOOL_CONFIG,
|
|
4232
4237
|
allowedRolesForConfiguration: []
|
|
4233
4238
|
}, muxInput = definePlugin((userConfig) => {
|
|
4239
|
+
if (typeof userConfig == "object" && "encoding_tier" in userConfig) {
|
|
4240
|
+
const deprecated_encoding_tier = userConfig.encoding_tier;
|
|
4241
|
+
userConfig.video_quality || (deprecated_encoding_tier === "baseline" && (userConfig.video_quality = "basic"), deprecated_encoding_tier === "smart" && (userConfig.video_quality = "plus"));
|
|
4242
|
+
}
|
|
4234
4243
|
const config = { ...defaultConfig, ...userConfig || {} };
|
|
4235
4244
|
return {
|
|
4236
4245
|
name: "mux-input",
|