sanity-plugin-mux-input 2.4.1 → 2.6.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.
@@ -1,463 +1,42 @@
1
- import {useId, useMemo} from 'react'
1
+ import {useTheme_v2} from '@sanity/ui'
2
+ import {CSSProperties, useId, useMemo} from 'react'
2
3
 
3
- // Mapping ids to ensure filter refs are unique, otherwise all Logo instances are hidden if the first SVG is hidden, due to how SVGs deal with relative links and ids
4
- const ids = [
5
- 'title',
6
- 'a',
7
- 'b',
8
- 'c',
9
- 'd',
10
- 'e',
11
- 'f',
12
- 'g',
13
- 'h',
14
- 'i',
15
- 'j',
16
- 'k',
17
- 'l',
18
- 'm',
19
- 'n',
20
- 'o',
21
- 'p',
22
- 'q',
23
- 'r',
24
- ] as const
25
4
  export interface Props {
26
5
  height?: number
27
6
  }
28
- export default function MuxLogo({height = 26}) {
7
+ export default function MuxLogo({height = 26}: Props) {
29
8
  const id = useId()
30
- const [titleId, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r] = useMemo<typeof ids>(
31
- () => ids.map((field) => `${id}-${field}`) as unknown as typeof ids,
32
- [id]
33
- )
9
+ const theme = useTheme_v2()
10
+ const fillColor = theme.color._dark ? 'white' : 'black'
11
+ const titleId = useMemo(() => `${id}-title`, [id])
12
+
13
+ const pathStyle: CSSProperties = {
14
+ fillRule: 'nonzero',
15
+ }
34
16
 
35
17
  return (
36
18
  <svg
37
19
  aria-labelledby={titleId}
38
- role="img"
20
+ style={{height: `${height}px`}}
21
+ viewBox="0 0 1600 500"
22
+ version="1.1"
39
23
  xmlns="http://www.w3.org/2000/svg"
40
24
  xmlSpace="preserve"
41
- viewBox="92.08878326416016 102.66712188720703 692.76123046875 219.99948120117188"
42
- style={{height: `${height}px`}}
43
25
  >
44
- <title id={titleId}>Mux Logo</title>
45
- <defs>
46
- <linearGradient
47
- id={c}
48
- spreadMethod="pad"
49
- gradientTransform="matrix(528.38055 0 0 -528.38055 63.801 159.5)"
50
- gradientUnits="userSpaceOnUse"
51
- y2={0}
52
- x2={1}
53
- y1={0}
54
- x1={0}
55
- >
56
- <stop
57
- offset={0}
58
- style={{
59
- stopOpacity: 1,
60
- stopColor: '#ff4e00',
61
- }}
62
- />
63
- <stop
64
- offset={1}
65
- style={{
66
- stopOpacity: 1,
67
- stopColor: '#ff1791',
68
- }}
69
- />
70
- </linearGradient>
71
- <linearGradient
72
- id={d}
73
- spreadMethod="pad"
74
- gradientTransform="matrix(523.66766 0 0 -523.66766 67.897 159.5)"
75
- gradientUnits="userSpaceOnUse"
76
- y2={0}
77
- x2={1}
78
- y1={0}
79
- x1={0}
80
- >
81
- <stop
82
- offset={0}
83
- style={{
84
- stopOpacity: 1,
85
- stopColor: '#ff4e00',
86
- }}
87
- />
88
- <stop
89
- offset={1}
90
- style={{
91
- stopOpacity: 1,
92
- stopColor: '#ff1791',
93
- }}
94
- />
95
- </linearGradient>
96
- <linearGradient
97
- id={g}
98
- spreadMethod="pad"
99
- gradientTransform="rotate(180 296.075 79.75) scale(524.84045)"
100
- gradientUnits="userSpaceOnUse"
101
- y2={0}
102
- x2={1}
103
- y1={0}
104
- x1={0}
105
- >
106
- <stop
107
- offset={0}
108
- style={{
109
- stopOpacity: 1,
110
- stopColor: '#ff4e00',
111
- }}
112
- />
113
- <stop
114
- offset={1}
115
- style={{
116
- stopOpacity: 1,
117
- stopColor: '#ff1791',
118
- }}
119
- />
120
- </linearGradient>
121
- <linearGradient
122
- id={i}
123
- spreadMethod="pad"
124
- gradientTransform="matrix(524.84045 0 0 -524.84045 63.801 159.5)"
125
- gradientUnits="userSpaceOnUse"
126
- y2={0}
127
- x2={1}
128
- y1={0}
129
- x1={0}
130
- >
131
- <stop
132
- offset={0}
133
- style={{
134
- stopOpacity: 1,
135
- stopColor: '#ff4e00',
136
- }}
137
- />
138
- <stop
139
- offset={1}
140
- style={{
141
- stopOpacity: 1,
142
- stopColor: '#ff1791',
143
- }}
144
- />
145
- </linearGradient>
146
- <linearGradient
147
- id={j}
148
- spreadMethod="pad"
149
- gradientTransform="matrix(523.08514 0 0 -523.08514 67.897 224.446)"
150
- gradientUnits="userSpaceOnUse"
151
- y2={0}
152
- x2={1}
153
- y1={0}
154
- x1={0}
155
- >
156
- <stop
157
- offset={0}
158
- style={{
159
- stopOpacity: 1,
160
- stopColor: '#ff4e00',
161
- }}
162
- />
163
- <stop
164
- offset={1}
165
- style={{
166
- stopOpacity: 1,
167
- stopColor: '#ff1791',
168
- }}
169
- />
170
- </linearGradient>
171
- <linearGradient
172
- id={k}
173
- spreadMethod="pad"
174
- gradientTransform="matrix(524.84045 0 0 -524.84045 63.801 94.553)"
175
- gradientUnits="userSpaceOnUse"
176
- y2={0}
177
- x2={1}
178
- y1={0}
179
- x1={0}
180
- >
181
- <stop
182
- offset={0}
183
- style={{
184
- stopOpacity: 1,
185
- stopColor: '#ff4e00',
186
- }}
187
- />
188
- <stop
189
- offset={1}
190
- style={{
191
- stopOpacity: 1,
192
- stopColor: '#ff1791',
193
- }}
194
- />
195
- </linearGradient>
196
- <linearGradient
197
- id={l}
198
- spreadMethod="pad"
199
- gradientTransform="matrix(524.84045 0 0 -524.84045 63.801 159.5)"
200
- gradientUnits="userSpaceOnUse"
201
- y2={0}
202
- x2={1}
203
- y1={0}
204
- x1={0}
205
- >
206
- <stop
207
- offset={0}
208
- style={{
209
- stopOpacity: 1,
210
- stopColor: '#ff4e00',
211
- }}
212
- />
213
- <stop
214
- offset={1}
215
- style={{
216
- stopOpacity: 1,
217
- stopColor: '#ff1791',
218
- }}
219
- />
220
- </linearGradient>
221
- <linearGradient
222
- id={m}
223
- spreadMethod="pad"
224
- gradientTransform="matrix(524.84045 0 0 -524.84045 63.801 94.554)"
225
- gradientUnits="userSpaceOnUse"
226
- y2={0}
227
- x2={1}
228
- y1={0}
229
- x1={0}
230
- >
231
- <stop
232
- offset={0}
233
- style={{
234
- stopOpacity: 1,
235
- stopColor: '#ff4e00',
236
- }}
237
- />
238
- <stop
239
- offset={1}
240
- style={{
241
- stopOpacity: 1,
242
- stopColor: '#ff1791',
243
- }}
244
- />
245
- </linearGradient>
246
- <linearGradient
247
- id={p}
248
- spreadMethod="pad"
249
- gradientTransform="matrix(521.97632 0 0 -521.97632 69.067 191.973)"
250
- gradientUnits="userSpaceOnUse"
251
- y2={0}
252
- x2={1}
253
- y1={0}
254
- x1={0}
255
- >
256
- <stop
257
- offset={0}
258
- style={{
259
- stopOpacity: 1,
260
- stopColor: '#ff4e00',
261
- }}
262
- />
263
- <stop
264
- offset={1}
265
- style={{
266
- stopOpacity: 1,
267
- stopColor: '#ff1791',
268
- }}
269
- />
270
- </linearGradient>
271
- <linearGradient
272
- id={q}
273
- spreadMethod="pad"
274
- gradientTransform="matrix(523.09039 0 0 -523.09039 67.312 191.973)"
275
- gradientUnits="userSpaceOnUse"
276
- y2={0}
277
- x2={1}
278
- y1={0}
279
- x1={0}
280
- >
281
- <stop
282
- offset={0}
283
- style={{
284
- stopOpacity: 1,
285
- stopColor: '#ff4e00',
286
- }}
287
- />
288
- <stop
289
- offset={1}
290
- style={{
291
- stopOpacity: 1,
292
- stopColor: '#ff1791',
293
- }}
294
- />
295
- </linearGradient>
296
- <linearGradient
297
- id={r}
298
- spreadMethod="pad"
299
- gradientTransform="matrix(524.84045 0 0 -524.84045 63.801 159.5)"
300
- gradientUnits="userSpaceOnUse"
301
- y2={0}
302
- x2={1}
303
- y1={0}
304
- x1={0}
305
- >
306
- <stop
307
- offset={0}
308
- style={{
309
- stopOpacity: 1,
310
- stopColor: '#ff4e00',
311
- }}
312
- />
313
- <stop
314
- offset={1}
315
- style={{
316
- stopOpacity: 1,
317
- stopColor: '#ff1791',
318
- }}
319
- />
320
- </linearGradient>
321
- <clipPath id={a} clipPathUnits="userSpaceOnUse">
322
- <path d="M0 319h657.706V0H0Z" />
323
- </clipPath>
324
- <clipPath id={b} clipPathUnits="userSpaceOnUse">
325
- <path d="M423.64 242h164.999V77H423.64Z" />
326
- </clipPath>
327
- <clipPath id={e} clipPathUnits="userSpaceOnUse">
328
- <path d="M0 319h657.706V0H0Z" />
329
- </clipPath>
330
- <clipPath id={f} clipPathUnits="userSpaceOnUse">
331
- <path d="M311.3 242h93.031V77H311.3Z" />
332
- </clipPath>
333
- <clipPath id={h} clipPathUnits="userSpaceOnUse">
334
- <path d="M198.96 242h35.106V77H198.96Z" />
335
- </clipPath>
336
- <clipPath id={n} clipPathUnits="userSpaceOnUse">
337
- <path d="M0 319h657.706V0H0Z" />
338
- </clipPath>
339
- <clipPath id={o} clipPathUnits="userSpaceOnUse">
340
- <path d="M69.067 242H169.12V141.947H69.067Z" />
341
- </clipPath>
342
- </defs>
343
- <g clipPath={`url(#${a})`} transform="matrix(1.33333 0 0 -1.33333 0 425.333)">
344
- <g
345
- style={{
346
- opacity: 0.69999701,
347
- }}
348
- clipPath={`url(#${b})`}
349
- >
350
- <path
351
- style={{
352
- fill: `url(#${c})`,
353
- stroke: 'none',
354
- }}
355
- d="M558.674 82.142c6.855-6.855 17.969-6.855 24.824 0 6.854 6.855 6.854 17.969 0 24.823L453.605 236.858c-6.855 6.855-17.969 6.855-24.824 0s-6.855-17.969 0-24.823z"
356
- />
357
- </g>
358
- </g>
359
- <path
360
- style={{
361
- fill: `url(#${d})`,
362
- stroke: 'none',
363
- }}
364
- d="M558.674 236.858 428.781 106.966c-6.855-6.855-6.855-17.969 0-24.825 6.855-6.854 17.969-6.854 24.823 0l129.894 129.894c6.854 6.855 6.854 17.968 0 24.823A17.498 17.498 0 0 1 571.086 242a17.495 17.495 0 0 1-12.412-5.142"
365
- transform="matrix(1.33333 0 0 -1.33333 0 425.333)"
366
- />
367
- <g clipPath={`url(#${e})`} transform="matrix(1.33333 0 0 -1.33333 0 425.333)">
368
- <g
369
- style={{
370
- opacity: 0.69999701,
371
- }}
372
- clipPath={`url(#${f})`}
373
- >
374
- <path
375
- style={{
376
- fill: `url(#${g})`,
377
- stroke: 'none',
378
- }}
379
- d="M328.853 112.107c22.297 0 40.372 18.075 40.372 40.372v71.315c0 10.054 7.505 18.206 17.554 18.206 10.048 0 17.552-8.152 17.552-18.206v-71.315c0-41.686-33.793-75.479-75.478-75.479-9.694 0-17.553 7.859-17.553 17.554 0 9.694 7.859 17.553 17.553 17.553"
380
- />
381
- </g>
382
- <g
383
- style={{
384
- opacity: 0.69999701,
385
- }}
386
- clipPath={`url(#${h})`}
387
- >
388
- <path
389
- style={{
390
- fill: `url(#${i})`,
391
- stroke: 'none',
392
- }}
393
- d="M216.513 242c-10.049 0-17.553-8.152-17.553-18.206V95.206c0-10.054 7.504-18.206 17.553-18.206 10.048 0 17.553 8.152 17.553 18.206v128.588c0 10.054-7.505 18.206-17.553 18.206"
394
- />
395
- </g>
396
- </g>
397
- <path
398
- style={{
399
- fill: `url(#${j})`,
400
- stroke: 'none',
401
- }}
402
- d="M369.225 224.447c0-9.694 7.859-17.553 17.553-17.553 9.695 0 17.553 7.859 17.553 17.553s-7.858 17.552-17.553 17.552c-9.694 0-17.553-7.858-17.553-17.552"
403
- transform="matrix(1.33333 0 0 -1.33333 0 425.333)"
404
- />
405
- <path
406
- style={{
407
- fill: `url(#${k})`,
408
- stroke: 'none',
409
- }}
410
- d="M553.532 94.554c0-9.695 7.859-17.554 17.553-17.554 9.695 0 17.554 7.859 17.554 17.554 0 9.694-7.859 17.552-17.554 17.552-9.694 0-17.553-7.858-17.553-17.552"
411
- transform="matrix(1.33333 0 0 -1.33333 0 425.333)"
412
- />
413
- <path
414
- style={{
415
- fill: `url(#${l})`,
416
- stroke: 'none',
417
- }}
418
- d="M69.067 223.794V95.206C69.067 85.152 76.571 77 86.62 77c10.048 0 17.553 8.152 17.553 18.206v128.588c0 10.055-7.505 18.205-17.553 18.205-10.049 0-17.553-8.15-17.553-18.205"
419
- transform="matrix(1.33333 0 0 -1.33333 0 425.333)"
420
- />
421
- <path
422
- style={{
423
- fill: `url(#${m})`,
424
- stroke: 'none',
425
- }}
426
- d="M198.96 94.554c0-9.695 7.859-17.554 17.553-17.554 9.695 0 17.554 7.859 17.554 17.554 0 9.694-7.859 17.553-17.554 17.553-9.694 0-17.553-7.859-17.553-17.553"
427
- transform="matrix(1.33333 0 0 -1.33333 0 425.333)"
428
- />
429
- <g clipPath={`url(#${n})`} transform="matrix(1.33333 0 0 -1.33333 0 425.333)">
430
- <g
431
- style={{
432
- opacity: 0.69999701,
433
- }}
434
- clipPath={`url(#${o})`}
435
- >
436
- <path
437
- style={{
438
- fill: `url(#${p})`,
439
- stroke: 'none',
440
- }}
441
- d="M139.155 147.088c6.855-6.855 17.969-6.855 24.824 0s6.855 17.969 0 24.824l-64.947 64.946c-6.855 6.855-17.969 6.855-24.824 0s-6.855-17.969 0-24.823z"
442
- />
443
- </g>
26
+ <g id="Layer-1" fill={fillColor}>
27
+ <path
28
+ d="M994.287,93.486c-17.121,-0 -31,-13.879 -31,-31c0,-17.121 13.879,-31 31,-31c17.121,-0 31,13.879 31,31c0,17.121 -13.879,31 -31,31m0,-93.486c-34.509,-0 -62.484,27.976 -62.484,62.486l0,187.511c0,68.943 -56.09,125.033 -125.032,125.033c-68.942,-0 -125.03,-56.09 -125.03,-125.033l0,-187.511c0,-34.51 -27.976,-62.486 -62.485,-62.486c-34.509,-0 -62.484,27.976 -62.484,62.486l0,187.511c0,137.853 112.149,250.003 249.999,250.003c137.851,-0 250.001,-112.15 250.001,-250.003l0,-187.511c0,-34.51 -27.976,-62.486 -62.485,-62.486"
29
+ style={pathStyle}
30
+ />
31
+ <path
32
+ d="M1537.51,468.511c-17.121,-0 -31,-13.879 -31,-31c0,-17.121 13.879,-31 31,-31c17.121,-0 31,13.879 31,31c0,17.121 -13.879,31 -31,31m-275.883,-218.509l-143.33,143.329c-24.402,24.402 -24.402,63.966 0,88.368c24.402,24.402 63.967,24.402 88.369,-0l143.33,-143.329l143.328,143.329c24.402,24.4 63.967,24.402 88.369,-0c24.403,-24.402 24.403,-63.966 0.001,-88.368l-143.33,-143.329l0.001,-0.004l143.329,-143.329c24.402,-24.402 24.402,-63.965 0,-88.367c-24.402,-24.402 -63.967,-24.402 -88.369,-0l-143.329,143.328l-143.329,-143.328c-24.402,-24.401 -63.967,-24.402 -88.369,-0c-24.402,24.402 -24.402,63.965 0,88.367l143.329,143.329l0,0.004Z"
33
+ style={pathStyle}
34
+ />
35
+ <path
36
+ d="M437.511,468.521c-17.121,-0 -31,-13.879 -31,-31c0,-17.121 13.879,-31 31,-31c17.121,-0 31,13.879 31,31c0,17.121 -13.879,31 -31,31m23.915,-463.762c-23.348,-9.672 -50.226,-4.327 -68.096,13.544l-143.331,143.329l-143.33,-143.329c-17.871,-17.871 -44.747,-23.216 -68.096,-13.544c-23.349,9.671 -38.574,32.455 -38.574,57.729l0,375.026c0,34.51 27.977,62.486 62.487,62.486c34.51,-0 62.486,-27.976 62.486,-62.486l0,-224.173l80.843,80.844c24.404,24.402 63.965,24.402 88.369,-0l80.843,-80.844l0,224.173c0,34.51 27.976,62.486 62.486,62.486c34.51,-0 62.486,-27.976 62.486,-62.486l0,-375.026c0,-25.274 -15.224,-48.058 -38.573,-57.729"
37
+ style={pathStyle}
38
+ />
444
39
  </g>
445
- <path
446
- style={{
447
- fill: `url(#${q})`,
448
- stroke: 'none',
449
- }}
450
- d="m204.101 236.858-64.947-64.946c-6.854-6.855-6.854-17.969 0-24.824 6.856-6.855 17.97-6.855 24.824 0l64.947 64.947c6.855 6.855 6.855 17.968 0 24.823A17.495 17.495 0 0 1 216.513 242a17.498 17.498 0 0 1-12.412-5.142"
451
- transform="matrix(1.33333 0 0 -1.33333 0 425.333)"
452
- />
453
- <path
454
- style={{
455
- fill: `url(#${r})`,
456
- stroke: 'none',
457
- }}
458
- d="M253.374 223.794v-71.315c0-41.685 33.793-75.479 75.479-75.479 9.695 0 17.553 7.859 17.553 17.554 0 9.694-7.858 17.553-17.553 17.553-22.297 0-40.372 18.075-40.372 40.372v71.315c0 10.055-7.505 18.205-17.554 18.205s-17.553-8.15-17.553-18.205"
459
- transform="matrix(1.33333 0 0 -1.33333 0 425.333)"
460
- />
461
40
  </svg>
462
41
  )
463
42
  }
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  EllipsisHorizontalIcon,
3
+ ImageIcon,
3
4
  LockIcon,
4
5
  PlugIcon,
5
6
  ResetIcon,
@@ -43,6 +44,11 @@ const LockButton = styled(Button)`
43
44
  color: white;
44
45
  `
45
46
 
47
+ // @TODO: add support for audio type (asset._type) when uploading an audio file so we can hide the thumbnail option.
48
+ const isVideoAsset = (asset: VideoAssetDocument) => {
49
+ return asset._type === 'mux.videoAsset'
50
+ }
51
+
46
52
  function PlayerActionsMenu(
47
53
  props: Pick<MuxInputProps, 'onChange' | 'readOnly'> & {
48
54
  asset: VideoAssetDocument
@@ -111,6 +117,13 @@ function PlayerActionsMenu(
111
117
  text="Browse"
112
118
  onClick={() => setDialogState('select-video')}
113
119
  />
120
+ {isVideoAsset(asset) && (
121
+ <MenuItem
122
+ icon={ImageIcon}
123
+ text="Thumbnail"
124
+ onClick={() => setDialogState('edit-thumbnail')}
125
+ />
126
+ )}
114
127
  <MenuDivider />
115
128
  <MenuItem
116
129
  icon={PlugIcon}
@@ -19,6 +19,7 @@ import {
19
19
  type UploadTextTrack,
20
20
  } from '../util/types'
21
21
  import TextTracksEditor, {type TrackAction} from './TextTracksEditor'
22
+ import PlaybackPolicy from './uploadConfiguration/PlaybackPolicy'
22
23
  import type {StagedUpload} from './Uploader'
23
24
 
24
25
  export type UploadConfigurationStateAction =
@@ -26,7 +27,8 @@ export type UploadConfigurationStateAction =
26
27
  | {action: 'max_resolution_tier'; value: UploadConfig['max_resolution_tier']}
27
28
  | {action: 'mp4_support'; value: UploadConfig['mp4_support']}
28
29
  | {action: 'normalize_audio'; value: UploadConfig['normalize_audio']}
29
- | {action: 'signed'; value: UploadConfig['signed']}
30
+ | {action: 'signed_policy'; value: UploadConfig['signed_policy']}
31
+ | {action: 'public_policy'; value: UploadConfig['public_policy']}
30
32
  | TrackAction
31
33
 
32
34
  const ENCODING_OPTIONS = [
@@ -84,6 +86,8 @@ export default function UploadConfiguration({
84
86
  mp4_support: 'none',
85
87
  max_resolution_tier: '1080p',
86
88
  text_tracks: prev.text_tracks?.filter(({type}) => type !== 'autogenerated'),
89
+ public_policy: true,
90
+ signed_policy: false,
87
91
  })
88
92
  // If encoding tier switches to smart, add back in default smart features
89
93
  }
@@ -97,7 +101,9 @@ export default function UploadConfiguration({
97
101
  case 'mp4_support':
98
102
  case 'max_resolution_tier':
99
103
  case 'normalize_audio':
100
- case 'signed':
104
+ case 'signed_policy':
105
+ return Object.assign({}, prev, {[action.action]: action.value})
106
+ case 'public_policy':
101
107
  return Object.assign({}, prev, {[action.action]: action.value})
102
108
  // Updating individual tracks
103
109
  case 'track': {
@@ -135,7 +141,8 @@ export default function UploadConfiguration({
135
141
  encoding_tier: pluginConfig.encoding_tier,
136
142
  max_resolution_tier: pluginConfig.max_resolution_tier,
137
143
  mp4_support: pluginConfig.mp4_support,
138
- signed: secrets.enableSignedUrls && pluginConfig.defaultSigned,
144
+ signed_policy: secrets.enableSignedUrls && pluginConfig.defaultSigned,
145
+ public_policy: true,
139
146
  normalize_audio: pluginConfig.normalize_audio,
140
147
  text_tracks: autoTextTracks,
141
148
  } as UploadConfig
@@ -279,31 +286,13 @@ export default function UploadConfiguration({
279
286
  </FormField>
280
287
  )}
281
288
 
282
- {(secrets.enableSignedUrls || config.encoding_tier === 'smart') && (
289
+ {config.encoding_tier === 'smart' && (
283
290
  <FormField title="Additional Configuration">
284
291
  <Stack space={2}>
285
- {secrets.enableSignedUrls && (
286
- <Flex align="center" gap={2}>
287
- <Checkbox
288
- id={`${id}--signed`}
289
- style={{display: 'block'}}
290
- name="signed"
291
- required
292
- checked={config.signed}
293
- onChange={(e) =>
294
- dispatch({
295
- action: 'signed',
296
- value: e.currentTarget.checked,
297
- })
298
- }
299
- />
300
- <Text>
301
- <label htmlFor={`${id}--signed`}>Signed playback URL</label>
302
- </Text>
303
- </Flex>
304
- )}
292
+ <PlaybackPolicy id={id} config={config} secrets={secrets} dispatch={dispatch} />
293
+
305
294
  {config.encoding_tier === 'smart' && (
306
- <Flex align="center" gap={2}>
295
+ <Flex align="center" gap={2} padding={[0, 2]}>
307
296
  <Checkbox
308
297
  id={`${id}--mp4_support`}
309
298
  style={{display: 'block'}}
@@ -340,6 +329,9 @@ export default function UploadConfiguration({
340
329
 
341
330
  <Box marginTop={4}>
342
331
  <Button
332
+ disabled={
333
+ config.encoding_tier === 'smart' && !config.public_policy && !config.signed_policy
334
+ }
343
335
  icon={UploadIcon}
344
336
  text="Upload"
345
337
  tone="positive"
@@ -351,6 +343,17 @@ export default function UploadConfiguration({
351
343
  )
352
344
  }
353
345
 
346
+ function setPlaybackPolicy(config: UploadConfig): MuxNewAssetSettings['playback_policy'] {
347
+ const playback_policy: MuxNewAssetSettings['playback_policy'] = []
348
+ if (config.public_policy) {
349
+ playback_policy.push('public')
350
+ }
351
+ if (config.signed_policy) {
352
+ playback_policy.push('signed')
353
+ }
354
+ return playback_policy
355
+ }
356
+
354
357
  function formatUploadConfig(config: UploadConfig): MuxNewAssetSettings {
355
358
  const generated_subtitles = config.text_tracks
356
359
  .filter<AutogeneratedTextTrack>(isAutogeneratedTrack)
@@ -383,7 +386,7 @@ function formatUploadConfig(config: UploadConfig): MuxNewAssetSettings {
383
386
  ),
384
387
  ],
385
388
  mp4_support: config.mp4_support,
386
- playback_policy: config.signed ? ['public', 'signed'] : ['public'],
389
+ playback_policy: setPlaybackPolicy(config),
387
390
  max_resolution_tier: config.max_resolution_tier,
388
391
  encoding_tier: config.encoding_tier,
389
392
  normalize_audio: config.normalize_audio,
@@ -7,6 +7,7 @@ import type {SanityClient} from 'sanity'
7
7
  import {PatchEvent, set, setIfMissing} from 'sanity'
8
8
 
9
9
  import {uploadFile, uploadUrl} from '../actions/upload'
10
+ import {DialogStateProvider} from '../context/DialogStateContext'
10
11
  import {type DialogState, type SetDialogState} from '../hooks/useDialogState'
11
12
  import {isValidUrl} from '../util/asserters'
12
13
  import {extractDroppedFiles} from '../util/extractFiles'
@@ -347,21 +348,26 @@ export default function Uploader(props: Props) {
347
348
  ref={containerRef}
348
349
  >
349
350
  {props.asset ? (
350
- <Player
351
- readOnly={props.readOnly}
352
- asset={props.asset}
353
- onChange={props.onChange}
354
- buttons={
355
- <PlayerActionsMenu
356
- asset={props.asset}
357
- dialogState={props.dialogState}
358
- setDialogState={props.setDialogState}
359
- onChange={props.onChange}
360
- onSelect={handleUpload}
361
- readOnly={props.readOnly}
362
- />
363
- }
364
- />
351
+ <DialogStateProvider
352
+ dialogState={props.dialogState}
353
+ setDialogState={props.setDialogState}
354
+ >
355
+ <Player
356
+ readOnly={props.readOnly}
357
+ asset={props.asset}
358
+ onChange={props.onChange}
359
+ buttons={
360
+ <PlayerActionsMenu
361
+ asset={props.asset}
362
+ dialogState={props.dialogState}
363
+ setDialogState={props.setDialogState}
364
+ onChange={props.onChange}
365
+ onSelect={handleUpload}
366
+ readOnly={props.readOnly}
367
+ />
368
+ }
369
+ />
370
+ </DialogStateProvider>
365
371
  ) : (
366
372
  <UploadPlaceholder
367
373
  hovering={dragState !== null}