sanity-plugin-mux-input 2.14.0 → 2.16.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 +25 -24
- package/dist/index.d.mts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +1057 -470
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1059 -472
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/_exports/index.ts +1 -0
- package/src/actions/secrets.ts +6 -1
- package/src/actions/upload.ts +1 -1
- package/src/components/ConfigureApi.tsx +51 -5
- package/src/components/EditCaptionDialog.tsx +2 -2
- package/src/components/InputBrowser.tsx +8 -2
- package/src/components/PageSelector.tsx +4 -7
- package/src/components/Player.styled.tsx +7 -2
- package/src/components/PlayerActionsMenu.tsx +15 -1
- package/src/components/ResyncMetadata.tsx +152 -73
- package/src/components/SelectAsset.tsx +9 -3
- package/src/components/StudioTool.tsx +2 -2
- package/src/components/TextTracksManager.tsx +11 -55
- package/src/components/UploadConfiguration.tsx +104 -343
- package/src/components/Uploader.tsx +18 -7
- package/src/components/VideoDetails/VideoDetails.tsx +55 -19
- package/src/components/VideoDetails/useVideoDetails.ts +15 -1
- package/src/components/VideoInBrowser.tsx +53 -6
- package/src/components/VideoPlayer.tsx +120 -47
- package/src/components/VideoThumbnail.tsx +84 -72
- package/src/components/VideosBrowser.tsx +7 -5
- package/src/components/uploadConfiguration/PlaybackPolicy.tsx +95 -6
- package/src/components/uploadConfiguration/PlaybackPolicyOption.tsx +26 -10
- package/src/components/uploadConfiguration/ResolutionTierSelector.tsx +71 -0
- package/src/components/uploadConfiguration/StaticRenditionSelector.tsx +179 -0
- package/src/context/DrmPlaybackWarningContext.tsx +93 -0
- package/src/hooks/useFetchFileSize.ts +54 -0
- package/src/hooks/useMediaMetadata.ts +100 -0
- package/src/hooks/useResyncAsset.ts +110 -0
- package/src/hooks/useResyncMuxMetadata.ts +33 -0
- package/src/hooks/useSaveSecrets.ts +10 -3
- package/src/hooks/useSecretsDocumentValues.ts +9 -1
- package/src/hooks/useSecretsFormState.ts +6 -3
- package/src/schema.ts +5 -0
- package/src/util/addKeysToMuxData.ts +30 -0
- package/src/util/asserters.ts +14 -0
- package/src/util/createUrlParamsObject.ts +7 -3
- package/src/util/generateJwt.ts +11 -2
- package/src/util/getPlaybackPolicy.ts +63 -4
- package/src/util/getStoryboardSrc.ts +7 -3
- package/src/util/getVideoMetadata.ts +1 -0
- package/src/util/getVideoSrc.ts +9 -9
- package/src/util/readSecrets.ts +3 -1
- package/src/util/textTracks.ts +6 -3
- package/src/util/tryWithSuspend.ts +22 -0
- package/src/util/types.ts +27 -2
- package/src/util/getPlaybackId.ts +0 -9
package/README.md
CHANGED
|
@@ -341,41 +341,42 @@ export default defineConfig({
|
|
|
341
341
|
You can also configure `acceptedMimeTypes` for individual fields in your schema, which will override the plugin-level configuration:
|
|
342
342
|
|
|
343
343
|
```js
|
|
344
|
-
import {
|
|
344
|
+
import {defineField, defineType} from 'sanity'
|
|
345
345
|
|
|
346
346
|
export default defineType({
|
|
347
|
-
name:
|
|
348
|
-
title:
|
|
349
|
-
type:
|
|
347
|
+
name: 'muxTest',
|
|
348
|
+
title: 'Mux Files',
|
|
349
|
+
type: 'document',
|
|
350
350
|
fields: [
|
|
351
351
|
defineField({
|
|
352
|
-
name:
|
|
353
|
-
title:
|
|
354
|
-
type:
|
|
352
|
+
name: 'audioFile',
|
|
353
|
+
title: 'Audio File',
|
|
354
|
+
type: 'mux.video',
|
|
355
355
|
options: {
|
|
356
|
-
acceptedMimeTypes: [
|
|
356
|
+
acceptedMimeTypes: ['audio/*'],
|
|
357
357
|
},
|
|
358
358
|
}),
|
|
359
359
|
defineField({
|
|
360
|
-
name:
|
|
361
|
-
title:
|
|
362
|
-
type:
|
|
360
|
+
name: 'videoFile',
|
|
361
|
+
title: 'Video File',
|
|
362
|
+
type: 'mux.video',
|
|
363
363
|
options: {
|
|
364
|
-
acceptedMimeTypes: [
|
|
364
|
+
acceptedMimeTypes: ['video/*'],
|
|
365
365
|
},
|
|
366
366
|
}),
|
|
367
367
|
defineField({
|
|
368
|
-
name:
|
|
369
|
-
title:
|
|
370
|
-
type:
|
|
368
|
+
name: 'either',
|
|
369
|
+
title: 'Either File',
|
|
370
|
+
type: 'mux.video',
|
|
371
371
|
}),
|
|
372
372
|
],
|
|
373
|
-
})
|
|
373
|
+
})
|
|
374
374
|
```
|
|
375
375
|
|
|
376
376
|
The `acceptedMimeTypes` option controls the `accept` attribute on the file input, which filters which file types users can select when uploading. This affects both the file picker dialog and drag-and-drop file validation.
|
|
377
377
|
|
|
378
378
|
📌 **Note**: This option accepts an array of MIME type patterns. The valid values are:
|
|
379
|
+
|
|
379
380
|
- `'video/*'` - Accepts all video file types
|
|
380
381
|
- `'audio/*'` - Accepts all audio file types
|
|
381
382
|
|
|
@@ -407,17 +408,17 @@ export default defineConfig({
|
|
|
407
408
|
You can override the global limits for specific fields, allowing different validation rules for different use cases:
|
|
408
409
|
|
|
409
410
|
```js
|
|
410
|
-
import {
|
|
411
|
+
import {defineType, defineField} from 'sanity'
|
|
411
412
|
|
|
412
413
|
export default defineType({
|
|
413
|
-
name:
|
|
414
|
-
title:
|
|
415
|
-
type:
|
|
414
|
+
name: 'muxTest',
|
|
415
|
+
title: 'Mux Files',
|
|
416
|
+
type: 'document',
|
|
416
417
|
fields: [
|
|
417
418
|
defineField({
|
|
418
|
-
name:
|
|
419
|
-
title:
|
|
420
|
-
type:
|
|
419
|
+
name: 'shortVideo',
|
|
420
|
+
title: 'Short Video (max 1 minute)',
|
|
421
|
+
type: 'mux.video',
|
|
421
422
|
options: {
|
|
422
423
|
maxAssetFileSize: 100 * 1024 * 1024, // 100 MB
|
|
423
424
|
maxAssetDuration: 60, // 1 minute
|
|
@@ -438,7 +439,7 @@ export default defineType({
|
|
|
438
439
|
type: 'mux.video',
|
|
439
440
|
// Uses plugin defaults or no validation if not configured
|
|
440
441
|
}),
|
|
441
|
-
]
|
|
442
|
+
],
|
|
442
443
|
})
|
|
443
444
|
```
|
|
444
445
|
|
package/dist/index.d.mts
CHANGED
|
@@ -142,6 +142,12 @@ declare interface MuxInputConfig {
|
|
|
142
142
|
* @defaultValue true
|
|
143
143
|
*/
|
|
144
144
|
defaultPublic?: boolean
|
|
145
|
+
/**
|
|
146
|
+
* Enables DRM Protection by default, if you configured your DRM Configuration Id.
|
|
147
|
+
* @see {@link https://www.mux.com/docs/guides/protect-videos-with-drm}
|
|
148
|
+
* @defaultValue true
|
|
149
|
+
*/
|
|
150
|
+
defaultDrm?: boolean
|
|
145
151
|
/**
|
|
146
152
|
* Auto-generate captions for these languages by default.
|
|
147
153
|
* Requires `"video_quality": "plus"`
|
|
@@ -173,6 +179,12 @@ declare interface MuxInputConfig {
|
|
|
173
179
|
* @defaultValue false
|
|
174
180
|
*/
|
|
175
181
|
disableTextTrackConfig?: boolean
|
|
182
|
+
/**
|
|
183
|
+
* Whether or not to show the playback warning when trying to watch DRM content for the first time.
|
|
184
|
+
*
|
|
185
|
+
* @defaultValue false
|
|
186
|
+
*/
|
|
187
|
+
disableDrmPlaybackWarning?: boolean
|
|
176
188
|
/**
|
|
177
189
|
* The mime types that are accepted by the input.
|
|
178
190
|
*
|
|
@@ -252,7 +264,7 @@ declare interface MuxVideoTrack {
|
|
|
252
264
|
duration?: number
|
|
253
265
|
}
|
|
254
266
|
|
|
255
|
-
declare type PlaybackPolicy = 'signed' | 'public'
|
|
267
|
+
declare type PlaybackPolicy = 'signed' | 'public' | 'drm'
|
|
256
268
|
|
|
257
269
|
declare interface PluginConfig extends MuxInputConfig {
|
|
258
270
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -142,6 +142,12 @@ declare interface MuxInputConfig {
|
|
|
142
142
|
* @defaultValue true
|
|
143
143
|
*/
|
|
144
144
|
defaultPublic?: boolean
|
|
145
|
+
/**
|
|
146
|
+
* Enables DRM Protection by default, if you configured your DRM Configuration Id.
|
|
147
|
+
* @see {@link https://www.mux.com/docs/guides/protect-videos-with-drm}
|
|
148
|
+
* @defaultValue true
|
|
149
|
+
*/
|
|
150
|
+
defaultDrm?: boolean
|
|
145
151
|
/**
|
|
146
152
|
* Auto-generate captions for these languages by default.
|
|
147
153
|
* Requires `"video_quality": "plus"`
|
|
@@ -173,6 +179,12 @@ declare interface MuxInputConfig {
|
|
|
173
179
|
* @defaultValue false
|
|
174
180
|
*/
|
|
175
181
|
disableTextTrackConfig?: boolean
|
|
182
|
+
/**
|
|
183
|
+
* Whether or not to show the playback warning when trying to watch DRM content for the first time.
|
|
184
|
+
*
|
|
185
|
+
* @defaultValue false
|
|
186
|
+
*/
|
|
187
|
+
disableDrmPlaybackWarning?: boolean
|
|
176
188
|
/**
|
|
177
189
|
* The mime types that are accepted by the input.
|
|
178
190
|
*
|
|
@@ -252,7 +264,7 @@ declare interface MuxVideoTrack {
|
|
|
252
264
|
duration?: number
|
|
253
265
|
}
|
|
254
266
|
|
|
255
|
-
declare type PlaybackPolicy = 'signed' | 'public'
|
|
267
|
+
declare type PlaybackPolicy = 'signed' | 'public' | 'drm'
|
|
256
268
|
|
|
257
269
|
declare interface PluginConfig extends MuxInputConfig {
|
|
258
270
|
/**
|