sanity-plugin-mux-input 3.0.5 → 4.0.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/dist/index.js +28 -28
- package/dist/index.js.map +1 -1
- package/package.json +5 -15
- package/dist/index.cjs +0 -5746
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -288
- package/dist/index.d.cts.map +0 -1
- package/sanity.json +0 -8
- package/src/_exports/index.ts +0 -73
- package/src/actions/assets.ts +0 -152
- package/src/actions/secrets.ts +0 -110
- package/src/actions/upload.ts +0 -308
- package/src/clients/upChunkObservable.ts +0 -54
- package/src/components/AddCaptionDialog.tsx +0 -440
- package/src/components/CaptionsDialog.tsx +0 -23
- package/src/components/ConfigureApi.styled.tsx +0 -19
- package/src/components/ConfigureApi.tsx +0 -296
- package/src/components/DraggableWatermark.tsx +0 -885
- package/src/components/EditCaptionDialog.tsx +0 -511
- package/src/components/EditThumbnailDialog.tsx +0 -121
- package/src/components/ErrorBoundaryCard.tsx +0 -97
- package/src/components/FileInputButton.tsx +0 -54
- package/src/components/FileInputMenuItem.styled.tsx +0 -36
- package/src/components/FileInputMenuItem.tsx +0 -85
- package/src/components/FormField.tsx +0 -38
- package/src/components/IconInfo.tsx +0 -22
- package/src/components/ImportVideosFromMux.tsx +0 -339
- package/src/components/Input.styled.tsx +0 -22
- package/src/components/Input.tsx +0 -78
- package/src/components/InputBrowser.tsx +0 -41
- package/src/components/MuxLogo.tsx +0 -42
- package/src/components/Onboard.tsx +0 -65
- package/src/components/PageSelector.tsx +0 -54
- package/src/components/Player.styled.tsx +0 -11
- package/src/components/Player.tsx +0 -117
- package/src/components/PlayerActionsMenu.tsx +0 -191
- package/src/components/ResyncMetadata.tsx +0 -278
- package/src/components/SelectAsset.tsx +0 -39
- package/src/components/SelectSortOptions.tsx +0 -45
- package/src/components/SpinnerBox.tsx +0 -16
- package/src/components/StudioTool.tsx +0 -24
- package/src/components/TextTracksEditor.tsx +0 -117
- package/src/components/TextTracksManager.tsx +0 -738
- package/src/components/UploadConfiguration.tsx +0 -696
- package/src/components/UploadPlaceholder.tsx +0 -88
- package/src/components/UploadProgress.tsx +0 -80
- package/src/components/Uploader.styled.tsx +0 -65
- package/src/components/Uploader.tsx +0 -499
- package/src/components/VideoDetails/DeleteDialog.tsx +0 -148
- package/src/components/VideoDetails/VideoDetails.tsx +0 -358
- package/src/components/VideoDetails/VideoReferences.tsx +0 -63
- package/src/components/VideoDetails/useVideoDetails.ts +0 -103
- package/src/components/VideoInBrowser.tsx +0 -245
- package/src/components/VideoMetadata.tsx +0 -45
- package/src/components/VideoPlayer.tsx +0 -241
- package/src/components/VideoThumbnail.tsx +0 -139
- package/src/components/VideosBrowser.tsx +0 -100
- package/src/components/documentPreview/DocumentPreview.tsx +0 -84
- package/src/components/documentPreview/DraftStatus.tsx +0 -34
- package/src/components/documentPreview/MissingSchemaType.tsx +0 -32
- package/src/components/documentPreview/PaneItemPreview.tsx +0 -67
- package/src/components/documentPreview/PublishedStatus.tsx +0 -35
- package/src/components/documentPreview/TimeAgo.tsx +0 -12
- package/src/components/icons/Audio.tsx +0 -13
- package/src/components/icons/Resolution.tsx +0 -12
- package/src/components/icons/StopWatch.tsx +0 -20
- package/src/components/icons/ToolIcon.tsx +0 -19
- package/src/components/uploadConfiguration/PlaybackPolicy.tsx +0 -133
- package/src/components/uploadConfiguration/PlaybackPolicyOption.tsx +0 -76
- package/src/components/uploadConfiguration/PlaybackPolicyWarning.tsx +0 -29
- package/src/components/uploadConfiguration/ResolutionTierSelector.tsx +0 -72
- package/src/components/uploadConfiguration/StaticRenditionSelector.tsx +0 -180
- package/src/components/withFocusRing/helpers.ts +0 -24
- package/src/components/withFocusRing/index.ts +0 -1
- package/src/components/withFocusRing/withFocusRing.ts +0 -30
- package/src/context/DialogStateContext.tsx +0 -33
- package/src/context/DrmPlaybackWarningContext.tsx +0 -97
- package/src/hooks/useAccessControl.ts +0 -13
- package/src/hooks/useAssetDocumentValues.ts +0 -11
- package/src/hooks/useAssets.ts +0 -73
- package/src/hooks/useCancelUpload.ts +0 -22
- package/src/hooks/useClient.ts +0 -8
- package/src/hooks/useDialogState.ts +0 -11
- package/src/hooks/useDocReferences.ts +0 -21
- package/src/hooks/useFetchFileSize.ts +0 -55
- package/src/hooks/useImportMuxAssets.ts +0 -132
- package/src/hooks/useInView.ts +0 -41
- package/src/hooks/useMediaMetadata.ts +0 -104
- package/src/hooks/useMuxAssets.ts +0 -179
- package/src/hooks/useMuxPolling.ts +0 -52
- package/src/hooks/useResyncAsset.ts +0 -110
- package/src/hooks/useResyncMuxMetadata.ts +0 -169
- package/src/hooks/useSaveSecrets.ts +0 -78
- package/src/hooks/useSecretsDocumentValues.ts +0 -38
- package/src/hooks/useSecretsFormState.ts +0 -47
- package/src/plugin.tsx +0 -31
- package/src/sanity-ui.d.ts +0 -5
- package/src/schema.ts +0 -196
- package/src/util/addKeysToMuxData.ts +0 -30
- package/src/util/asserters.ts +0 -23
- package/src/util/assetTitlePlaceholder.ts +0 -31
- package/src/util/constants.ts +0 -15
- package/src/util/convertWatermarkToMux.ts +0 -160
- package/src/util/createSearchFilter.ts +0 -76
- package/src/util/createUrlParamsObject.ts +0 -29
- package/src/util/extractFiles.ts +0 -67
- package/src/util/formatBytes.ts +0 -31
- package/src/util/formatDriveShareLink.ts +0 -64
- package/src/util/formatSeconds.ts +0 -48
- package/src/util/generateJwt.ts +0 -57
- package/src/util/getAnimatedPosterSrc.ts +0 -26
- package/src/util/getPlaybackPolicy.ts +0 -69
- package/src/util/getPosterSrc.ts +0 -28
- package/src/util/getVideoMetadata.ts +0 -23
- package/src/util/getVideoSrc.ts +0 -23
- package/src/util/parsers.ts +0 -5
- package/src/util/pluginVersion.ts +0 -5
- package/src/util/readSecrets.ts +0 -38
- package/src/util/roundPxString.ts +0 -16
- package/src/util/textTracks.ts +0 -222
- package/src/util/tryWithSuspend.ts +0 -22
- package/src/util/types.ts +0 -566
- package/v2-incompatible.js +0 -11
package/src/util/types.ts
DELETED
|
@@ -1,566 +0,0 @@
|
|
|
1
|
-
import type MuxPlayerElement from '@mux/mux-player'
|
|
2
|
-
import type {ObjectInputProps} from 'sanity'
|
|
3
|
-
import type {PartialDeep} from 'type-fest'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* All static rendition resolution options supported by Mux
|
|
7
|
-
*/
|
|
8
|
-
export type StaticRenditionResolution =
|
|
9
|
-
| 'highest'
|
|
10
|
-
| 'audio-only'
|
|
11
|
-
| '270p'
|
|
12
|
-
| '360p'
|
|
13
|
-
| '480p'
|
|
14
|
-
| '540p'
|
|
15
|
-
| '720p'
|
|
16
|
-
| '1080p'
|
|
17
|
-
| '1440p'
|
|
18
|
-
| '2160p'
|
|
19
|
-
|
|
20
|
-
export interface MuxInputConfig {
|
|
21
|
-
/**
|
|
22
|
-
* Enable static renditions by default. Can be overwritten on a per-asset basis.
|
|
23
|
-
* Supports:
|
|
24
|
-
* - Standard mode: 'highest' (up to 4K MP4) and/or 'audio-only' (M4A)
|
|
25
|
-
* - Advanced mode: Specific resolutions ('270p', '360p', '480p', '540p', '720p', '1080p', '1440p', '2160p') and/or 'audio-only'
|
|
26
|
-
*
|
|
27
|
-
* **Important**: 'highest' cannot be mixed with specific resolutions. If both are provided, only 'highest' will be used.
|
|
28
|
-
*
|
|
29
|
-
* @see {@link https://docs.mux.com/guides/video/enable-static-mp4-renditions}
|
|
30
|
-
* @defaultValue []
|
|
31
|
-
*/
|
|
32
|
-
static_renditions: StaticRenditionResolution[]
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* @deprecated Use `static_renditions` instead. This field is kept for backward compatibility.
|
|
36
|
-
* Enable static renditions by setting this to 'standard'. Can be overwritten on a per-asset basis.
|
|
37
|
-
* Requires `"video_quality": "plus"`
|
|
38
|
-
* @see {@link https://docs.mux.com/guides/video/enable-static-mp4-renditions#why-enable-mp4-support}
|
|
39
|
-
* @defaultValue 'none'
|
|
40
|
-
*/
|
|
41
|
-
mp4_support: 'none' | 'standard'
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Max resolution tier can be used to control the maximum resolution_tier your asset is encoded, stored, and streamed at.
|
|
45
|
-
* Requires `"video_quality": "plus"`
|
|
46
|
-
* @see {@link https://docs.mux.com/guides/stream-videos-in-4k}
|
|
47
|
-
* @defaultValue '1080p'
|
|
48
|
-
*/
|
|
49
|
-
max_resolution_tier: '2160p' | '1440p' | '1080p'
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* @deprecated Use {@link video_quality}
|
|
53
|
-
* <br>
|
|
54
|
-
* The encoding tier informs the cost, quality, and available platform features for the asset.
|
|
55
|
-
* @see {@link https://docs.mux.com/guides/use-encoding-tiers}
|
|
56
|
-
* @defaultValue 'smart'
|
|
57
|
-
*/
|
|
58
|
-
encoding_tier?: 'baseline' | 'smart'
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* The video quality level informs the cost, quality, and available platform features for the asset.
|
|
62
|
-
* @see {@link https://www.mux.com/docs/guides/use-video-quality-levels}
|
|
63
|
-
* @defaultValue 'plus'
|
|
64
|
-
*/
|
|
65
|
-
video_quality: 'basic' | 'plus' | 'premium'
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Normalize the audio track loudness level.
|
|
69
|
-
* @see {@link https://docs.mux.com/guides/adjust-audio-levels#how-to-turn-on-audio-normalization}
|
|
70
|
-
* @defaultValue false
|
|
71
|
-
*/
|
|
72
|
-
normalize_audio: boolean
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Enables signed URLs by default, if you configured them with your API token.
|
|
76
|
-
* @see {@link https://docs.mux.com/guides/secure-video-playback}
|
|
77
|
-
* @defaultValue false
|
|
78
|
-
*/
|
|
79
|
-
defaultSigned?: boolean
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Enables public URLs by default.
|
|
83
|
-
* @defaultValue true
|
|
84
|
-
*/
|
|
85
|
-
defaultPublic?: boolean
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Enables DRM Protection by default, if you configured your DRM Configuration Id.
|
|
89
|
-
* @see {@link https://www.mux.com/docs/guides/protect-videos-with-drm}
|
|
90
|
-
* @defaultValue true
|
|
91
|
-
*/
|
|
92
|
-
defaultDrm?: boolean
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Auto-generate captions for these languages by default.
|
|
96
|
-
* Requires `"video_quality": "plus"`
|
|
97
|
-
*
|
|
98
|
-
* @see {@link https://docs.mux.com/guides/add-autogenerated-captions-and-use-transcripts}
|
|
99
|
-
* @deprecated use `defaultAutogeneratedSubtitleLang` instead. Only a single autogenerated
|
|
100
|
-
*/
|
|
101
|
-
defaultAutogeneratedSubtitleLangs?: SupportedMuxLanguage[]
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Auto-generate captions for this language by default. Users can still
|
|
105
|
-
* Requires `"video_quality": "plus"`
|
|
106
|
-
*
|
|
107
|
-
* @see {@link https://docs.mux.com/guides/add-autogenerated-captions-and-use-transcripts}
|
|
108
|
-
*/
|
|
109
|
-
defaultAutogeneratedSubtitleLang?: SupportedMuxLanguage
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Whether or not to allow content editors to override asset upload
|
|
113
|
-
* configuration settings when uploading a video to Mux.
|
|
114
|
-
*
|
|
115
|
-
* @see {@link https://docs.mux.com/guides/secure-video-playback}
|
|
116
|
-
* @defaultValue false
|
|
117
|
-
*/
|
|
118
|
-
disableUploadConfig?: boolean
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Whether or not to allow content editors to add text tracks alongside their
|
|
122
|
-
* asset when uploading a video to Mux.
|
|
123
|
-
*
|
|
124
|
-
* @see {@link https://docs.mux.com/guides/secure-video-playback}
|
|
125
|
-
* @defaultValue false
|
|
126
|
-
*/
|
|
127
|
-
disableTextTrackConfig?: boolean
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Whether or not to show the playback warning when trying to watch DRM content for the first time.
|
|
131
|
-
*
|
|
132
|
-
* @defaultValue false
|
|
133
|
-
*/
|
|
134
|
-
disableDrmPlaybackWarning?: boolean
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* The mime types that are accepted by the input.
|
|
138
|
-
*
|
|
139
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/accept}
|
|
140
|
-
* @defaultValue ['video/*','audio/*']
|
|
141
|
-
|
|
142
|
-
*/
|
|
143
|
-
acceptedMimeTypes?: ('audio/*' | 'video/*')[]
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Maximum file size allowed for video uploads in bytes.
|
|
147
|
-
* If not specified, no file size validation will be performed.
|
|
148
|
-
*
|
|
149
|
-
* @example 1024 * 1024 * 1024 // 1 GB
|
|
150
|
-
* @defaultValue undefined
|
|
151
|
-
*/
|
|
152
|
-
maxAssetFileSize?: number
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Maximum video duration allowed in seconds.
|
|
156
|
-
* If not specified, no duration validation will be performed.
|
|
157
|
-
*
|
|
158
|
-
* @example 2 * 60 * 60 // 2 hours
|
|
159
|
-
* @defaultValue undefined
|
|
160
|
-
*/
|
|
161
|
-
maxAssetDuration?: number
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* HLS.js configuration options to be passed to the Mux Player.
|
|
165
|
-
* These options allow you to customize the underlying HLS.js playback engine behavior.
|
|
166
|
-
*
|
|
167
|
-
* @see {@link https://github.com/video-dev/hls.js/blob/master/docs/API.md#fine-tuning}
|
|
168
|
-
* @defaultValue undefined
|
|
169
|
-
* @example
|
|
170
|
-
* ```ts
|
|
171
|
-
* {
|
|
172
|
-
* maxBufferLength: 30,
|
|
173
|
-
* lowLatencyMode: true,
|
|
174
|
-
* capLevelToPlayerSize: true
|
|
175
|
-
* }
|
|
176
|
-
* ```
|
|
177
|
-
*/
|
|
178
|
-
hlsConfig?: MuxPlayerElement['_hlsConfig']
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
export interface PluginConfig extends MuxInputConfig {
|
|
182
|
-
/**
|
|
183
|
-
* How the videos browser should appear as a studio tool in Sanity's top navigation
|
|
184
|
-
*
|
|
185
|
-
* Pass `false` if you want to disable it.
|
|
186
|
-
* @defaultValue {title: 'Videos', icon: VideoIcon}
|
|
187
|
-
**/
|
|
188
|
-
tool:
|
|
189
|
-
| false
|
|
190
|
-
| {
|
|
191
|
-
title?: string
|
|
192
|
-
icon?: React.ComponentType
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* The roles that are allowed to configure the plugin.
|
|
197
|
-
*
|
|
198
|
-
* If not set, all roles will be allowed to configure the plugin.
|
|
199
|
-
* @defaultValue []
|
|
200
|
-
*/
|
|
201
|
-
allowedRolesForConfiguration: string[]
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
export const SUPPORTED_MUX_LANGUAGES = [
|
|
205
|
-
{label: 'English', code: 'en', state: 'Stable'},
|
|
206
|
-
{label: 'Spanish', code: 'es', state: 'Stable'},
|
|
207
|
-
{label: 'Italian', code: 'it', state: 'Stable'},
|
|
208
|
-
{label: 'Portuguese', code: 'pt', state: 'Stable'},
|
|
209
|
-
{label: 'German', code: 'de', state: 'Stable'},
|
|
210
|
-
{label: 'French', code: 'fr', state: 'Stable'},
|
|
211
|
-
{label: 'Polish', code: 'pl', state: 'Beta'},
|
|
212
|
-
{label: 'Russian', code: 'ru', state: 'Beta'},
|
|
213
|
-
{label: 'Dutch', code: 'nl', state: 'Beta'},
|
|
214
|
-
{label: 'Catalan', code: 'ca', state: 'Beta'},
|
|
215
|
-
{label: 'Turkish', code: 'tr', state: 'Beta'},
|
|
216
|
-
{label: 'Swedish', code: 'sv', state: 'Beta'},
|
|
217
|
-
{label: 'Ukrainian', code: 'uk', state: 'Beta'},
|
|
218
|
-
{label: 'Norwegian', code: 'no', state: 'Beta'},
|
|
219
|
-
{label: 'Finnish', code: 'fi', state: 'Beta'},
|
|
220
|
-
{label: 'Slovak', code: 'sk', state: 'Beta'},
|
|
221
|
-
{label: 'Greek', code: 'el', state: 'Beta'},
|
|
222
|
-
{label: 'Czech', code: 'cs', state: 'Beta'},
|
|
223
|
-
{label: 'Croatian', code: 'hr', state: 'Beta'},
|
|
224
|
-
{label: 'Danish', code: 'da', state: 'Beta'},
|
|
225
|
-
{label: 'Romanian', code: 'ro', state: 'Beta'},
|
|
226
|
-
{label: 'Bulgarian', code: 'bg', state: 'Beta'},
|
|
227
|
-
] as const
|
|
228
|
-
|
|
229
|
-
export const SUPPORTED_MUX_LANGUAGES_VALUES = SUPPORTED_MUX_LANGUAGES.map((l) => l.code)
|
|
230
|
-
|
|
231
|
-
export type SupportedMuxLanguage = (typeof SUPPORTED_MUX_LANGUAGES_VALUES)[number]
|
|
232
|
-
|
|
233
|
-
export interface TextTrack {
|
|
234
|
-
_id: string
|
|
235
|
-
name: string
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
export interface AutogeneratedTextTrack extends TextTrack {
|
|
239
|
-
type: 'autogenerated'
|
|
240
|
-
language_code: SupportedMuxLanguage
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
export interface CustomTextTrack extends TextTrack {
|
|
244
|
-
type: 'subtitles' | 'captions'
|
|
245
|
-
language_code: string
|
|
246
|
-
file: {
|
|
247
|
-
contents: string
|
|
248
|
-
type: string
|
|
249
|
-
name: string
|
|
250
|
-
size: number
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
export function isCustomTextTrack(track: Partial<UploadTextTrack>): track is CustomTextTrack {
|
|
255
|
-
return track.type !== 'autogenerated'
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
export function isAutogeneratedTrack(
|
|
259
|
-
track: Partial<UploadTextTrack>,
|
|
260
|
-
): track is AutogeneratedTextTrack {
|
|
261
|
-
return track.type === 'autogenerated'
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
export type UploadTextTrack = AutogeneratedTextTrack | CustomTextTrack
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* Watermark configuration for UI (draggable position)
|
|
268
|
-
*/
|
|
269
|
-
export interface WatermarkConfig {
|
|
270
|
-
enabled: boolean
|
|
271
|
-
imageUrl?: string
|
|
272
|
-
/**
|
|
273
|
-
* Aspect ratio (width / height) of the watermark image.
|
|
274
|
-
* Used to convert between our center-based UI coords and Mux overlay margins.
|
|
275
|
-
*/
|
|
276
|
-
imageAspectRatio?: number
|
|
277
|
-
/**
|
|
278
|
-
* Optional explicit Mux `overlay_settings`.
|
|
279
|
-
* When set, these values should be used as-is for the upload request and preview.
|
|
280
|
-
* @see {@link https://www.mux.com/docs/guides/add-watermarks-to-your-videos}
|
|
281
|
-
*/
|
|
282
|
-
overlay_settings?: MuxOverlaySettings
|
|
283
|
-
position?: {
|
|
284
|
-
x: number // percentage (0-100)
|
|
285
|
-
y: number // percentage (0-100)
|
|
286
|
-
}
|
|
287
|
-
size?: number // percentage of video width (0-100)
|
|
288
|
-
opacity?: number // 0-1 (converted to percentage string for Mux API)
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* Mux overlay_settings format for watermark API
|
|
293
|
-
* @see {@link https://www.mux.com/docs/guides/add-watermarks-to-your-videos}
|
|
294
|
-
*/
|
|
295
|
-
export interface MuxOverlaySettings {
|
|
296
|
-
vertical_align: 'top' | 'middle' | 'bottom'
|
|
297
|
-
vertical_margin: string // percentage (e.g., "10%") or pixels (e.g., "40px")
|
|
298
|
-
horizontal_align: 'left' | 'center' | 'right'
|
|
299
|
-
horizontal_margin: string // percentage (e.g., "10%") or pixels (e.g., "40px")
|
|
300
|
-
width?: string // percentage (e.g., "25%") or pixels (e.g., "80px")
|
|
301
|
-
height?: string // percentage or pixels
|
|
302
|
-
opacity?: string // percentage string (e.g., "90%")
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
export interface UploadConfig extends Pick<
|
|
306
|
-
MuxInputConfig,
|
|
307
|
-
'max_resolution_tier' | 'normalize_audio' | 'video_quality'
|
|
308
|
-
> {
|
|
309
|
-
static_renditions: StaticRenditionResolution[]
|
|
310
|
-
text_tracks: UploadTextTrack[]
|
|
311
|
-
signed_policy: boolean
|
|
312
|
-
public_policy: boolean
|
|
313
|
-
watermark?: WatermarkConfig
|
|
314
|
-
drm_policy: boolean
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* Data sent to Mux to create a new asset.
|
|
319
|
-
* @docs {@link https://docs.mux.com/api-reference#video/operation/create-direct-upload}
|
|
320
|
-
*/
|
|
321
|
-
export interface MuxNewAssetSettings extends Pick<
|
|
322
|
-
MuxInputConfig,
|
|
323
|
-
'max_resolution_tier' | 'normalize_audio' | 'video_quality'
|
|
324
|
-
> {
|
|
325
|
-
/** Static renditions configuration for downloadable files */
|
|
326
|
-
static_renditions?: {resolution: StaticRenditionResolution}[]
|
|
327
|
-
/** An array of objects that each describe an input file to be used to create the asset.*/
|
|
328
|
-
input?: {
|
|
329
|
-
/** The URL of the file that Mux should download and use. */
|
|
330
|
-
url?: string
|
|
331
|
-
/** Generate subtitle tracks using automatic speech recognition with this configuration. This may only be provided for the first input object (the main input file). */
|
|
332
|
-
generated_subtitles?: {
|
|
333
|
-
/** A name for this subtitle track. */
|
|
334
|
-
name: string
|
|
335
|
-
/** Arbitrary metadata set for the subtitle track. Max 255 characters. */
|
|
336
|
-
passthrough?: string
|
|
337
|
-
/** The language to generate subtitles in. */
|
|
338
|
-
language_code: SupportedMuxLanguage
|
|
339
|
-
}[]
|
|
340
|
-
/** The time offset in seconds from the beginning of the video indicating the clip's starting marker. */
|
|
341
|
-
start_time?: number
|
|
342
|
-
/** The time offset in seconds from the beginning of the video indicating the clip's ending marker. */
|
|
343
|
-
end_time?: number
|
|
344
|
-
/** This parameter is required for text type tracks. */
|
|
345
|
-
type?: 'video' | 'audio' | 'text'
|
|
346
|
-
/** Type of text track. This parameter only supports subtitles value. */
|
|
347
|
-
text_type?: 'subtitles'
|
|
348
|
-
/** The language code value must be a valid BCP 47 specification compliant value. */
|
|
349
|
-
language_code?: string
|
|
350
|
-
/** The name of the track containing a human-readable description. This value must be unique within each group of text or audio track types. */
|
|
351
|
-
name?: string
|
|
352
|
-
/** Indicates the track provides Subtitles for the Deaf or Hard-of-hearing (SDH). */
|
|
353
|
-
closed_captions?: boolean
|
|
354
|
-
/** This optional parameter should be used tracks with type of text and text_type set to subtitles. */
|
|
355
|
-
passthrough?: string
|
|
356
|
-
/** Overlay settings for watermarks. Used when adding a watermark image as a second input. */
|
|
357
|
-
overlay_settings?: MuxOverlaySettings
|
|
358
|
-
}[]
|
|
359
|
-
|
|
360
|
-
/** An array of playback policy names that you want applied to this asset and available through playback_ids. */
|
|
361
|
-
playback_policy?: PlaybackPolicy[]
|
|
362
|
-
|
|
363
|
-
/** An array of playback policy objects that you want applied to this asset and available through playback_ids. advanced_playback_policies must be used instead of playback_policies when creating a DRM playback ID. */
|
|
364
|
-
advanced_playback_policies: AdvancedPlaybackPolicy[]
|
|
365
|
-
|
|
366
|
-
/** Arbitrary user-supplied metadata that will be included in the asset details and related webhooks. */
|
|
367
|
-
passthrough?: string
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
/** Used by advanced_playback_policies, allows to define DRM config. */
|
|
371
|
-
export type AdvancedPlaybackPolicy = {
|
|
372
|
-
policy: PlaybackPolicy
|
|
373
|
-
drm_configuration_id?: string
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
export interface Secrets {
|
|
377
|
-
token: string | null
|
|
378
|
-
secretKey: string | null
|
|
379
|
-
enableSignedUrls: boolean
|
|
380
|
-
signingKeyId: string | null
|
|
381
|
-
signingKeyPrivate: string | null
|
|
382
|
-
drmConfigId: string | null
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
export type MuxImageOrigin = `https://image.mux.com`
|
|
386
|
-
export type MuxThumbnailUrl = `${MuxImageOrigin}/${string}/thumbnail.png?${string}`
|
|
387
|
-
export type MuxAnimatedThumbnailUrl = `${MuxImageOrigin}/${string}/animated.gif?${string}`
|
|
388
|
-
export type MuxVideoOrigin = `https://stream.mux.com`
|
|
389
|
-
export type MuxVideoUrl = `${MuxVideoOrigin}/${string}.m3u8?${string}`
|
|
390
|
-
|
|
391
|
-
// 'preserve' by default
|
|
392
|
-
// @url: https://docs.mux.com/guides/video/get-images-from-a-video#thumbnail-query-string-parameters
|
|
393
|
-
export type FitMode = 'preserve' | 'crop' | 'smartcrop' | 'pad'
|
|
394
|
-
|
|
395
|
-
export interface ThumbnailOptions {
|
|
396
|
-
fit_mode?: FitMode
|
|
397
|
-
height?: number
|
|
398
|
-
time?: number
|
|
399
|
-
width?: number
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
export interface AnimatedThumbnailOptions {
|
|
403
|
-
// Starting time code for the animation, if no end is set it'll have a 5s duration
|
|
404
|
-
// The start and end timecodes uses `asset.thumbTime` to create an iOS `Live Photo` effect by showing you the 5 secodnds before, and after, the thumb time`
|
|
405
|
-
start?: number
|
|
406
|
-
// End code, can't be longer than 10s after the start code
|
|
407
|
-
end?: number
|
|
408
|
-
// Max 640px, 320px by default
|
|
409
|
-
width?: number
|
|
410
|
-
// Preserves aspect ratio, like width, you can't set both the height and width, max 640
|
|
411
|
-
height?: number
|
|
412
|
-
// The fps is 15 by default, but can go up to 30
|
|
413
|
-
fps?: number
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
export interface AssetThumbnailOptions {
|
|
417
|
-
asset: Pick<VideoAssetDocument, 'playbackId' | 'data' | 'thumbTime' | 'filename' | 'assetId'>
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
export type PlaybackPolicy = 'signed' | 'public' | 'drm'
|
|
421
|
-
|
|
422
|
-
export interface MuxErrors {
|
|
423
|
-
type: string
|
|
424
|
-
messages: string[]
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
export interface MuxPlaybackId {
|
|
428
|
-
id: string
|
|
429
|
-
policy: PlaybackPolicy
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
export interface MuxVideoTrack {
|
|
433
|
-
type: 'video'
|
|
434
|
-
id: string
|
|
435
|
-
max_width: number
|
|
436
|
-
max_height: number
|
|
437
|
-
// if the fps can't be reliably determined, this will be -1
|
|
438
|
-
max_frame_rate: -1 | number
|
|
439
|
-
// top-level duration is always set, while track level duration is not
|
|
440
|
-
duration?: number
|
|
441
|
-
}
|
|
442
|
-
export interface MuxAudioTrack {
|
|
443
|
-
type: 'audio'
|
|
444
|
-
id: string
|
|
445
|
-
duration?: number
|
|
446
|
-
max_channels: number
|
|
447
|
-
max_channel_layout: 'stereo' | string
|
|
448
|
-
}
|
|
449
|
-
export interface MuxTextTrack {
|
|
450
|
-
type: 'text'
|
|
451
|
-
id: string
|
|
452
|
-
text_type?: 'subtitles'
|
|
453
|
-
// https://docs.mux.com/api-reference/video#operation/list-assets:~:text=text%20type%20tracks.-,tracks%5B%5D.,text_source,-string
|
|
454
|
-
text_source?:
|
|
455
|
-
| 'uploaded'
|
|
456
|
-
| 'embedded'
|
|
457
|
-
| 'generated_live'
|
|
458
|
-
| 'generated_live_final'
|
|
459
|
-
| 'generated_vod'
|
|
460
|
-
// BCP 47 language code
|
|
461
|
-
language_code?: 'en' | 'en-US' | string
|
|
462
|
-
// The name of the track containing a human-readable description. The hls manifest will associate a subtitle text track with this value
|
|
463
|
-
name?: 'English' | string
|
|
464
|
-
closed_captions?: boolean
|
|
465
|
-
// Max 255 characters
|
|
466
|
-
passthrough?: string
|
|
467
|
-
status: 'preparing' | 'ready' | 'errored'
|
|
468
|
-
error?: {
|
|
469
|
-
type: string
|
|
470
|
-
messages?: string[]
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
export type MuxTrack = MuxVideoTrack | MuxAudioTrack | MuxTextTrack
|
|
474
|
-
// Typings lifted from https://docs.mux.com/api-reference/video#tag/assets
|
|
475
|
-
export interface MuxAsset {
|
|
476
|
-
id: string
|
|
477
|
-
/** In seconds (instead of JS's default milliseconds) */
|
|
478
|
-
created_at: string
|
|
479
|
-
status: 'preparing' | 'ready' | 'errored'
|
|
480
|
-
duration: number
|
|
481
|
-
max_stored_resolution: 'Audio only' | 'SD' | 'HD' | 'FHD' | 'UHD'
|
|
482
|
-
// if the fps can't be reliably determined, this will be -1
|
|
483
|
-
max_stored_frame_rate: -1 | number
|
|
484
|
-
// The aspect ratio of the asset in the form of width:height, for example 16:9
|
|
485
|
-
aspect_ratio: `${number}:${number}`
|
|
486
|
-
playback_ids: MuxPlaybackId[]
|
|
487
|
-
tracks: MuxTrack[]
|
|
488
|
-
errors?: MuxErrors
|
|
489
|
-
upload_id: string
|
|
490
|
-
is_live?: boolean
|
|
491
|
-
// We use passthrough to set the mux.videoAsset._id of the asset that originally uploaded the video
|
|
492
|
-
passthrough: string
|
|
493
|
-
live_stream_id?: string
|
|
494
|
-
master?: {
|
|
495
|
-
status: 'ready' | 'preparing' | 'errored'
|
|
496
|
-
// Temporary URL to master MP4, expires after 24 hours
|
|
497
|
-
url: string
|
|
498
|
-
}
|
|
499
|
-
master_access: 'temporary' | 'none'
|
|
500
|
-
mp4_support: 'standard' | 'none'
|
|
501
|
-
// Asset Identifier of the video used as the source for creating the clip.
|
|
502
|
-
source_asset_id?: string
|
|
503
|
-
// Normalize the audio track loudness level. This parameter is only applicable to on-demand (not live) assets., default false
|
|
504
|
-
normalize_audio?: boolean
|
|
505
|
-
// The object does not exist if no static renditions have been requested
|
|
506
|
-
static_renditions?: {
|
|
507
|
-
status: 'ready' | 'preparing' | 'disabled' | 'errored'
|
|
508
|
-
files: {
|
|
509
|
-
name: string
|
|
510
|
-
ext: 'mp4' | 'm4a'
|
|
511
|
-
height: number
|
|
512
|
-
width: number
|
|
513
|
-
bitrate: number
|
|
514
|
-
filesize: string
|
|
515
|
-
type: 'standard' | 'advanced'
|
|
516
|
-
status: 'ready' | 'preparing' | 'skipped' | 'errored'
|
|
517
|
-
resolution_tier?: string
|
|
518
|
-
resolution?: string
|
|
519
|
-
id: string
|
|
520
|
-
passthrough?: string
|
|
521
|
-
}[]
|
|
522
|
-
}
|
|
523
|
-
recording_times?: {
|
|
524
|
-
started_at: string
|
|
525
|
-
duration: number
|
|
526
|
-
type: 'content' | 'slate'
|
|
527
|
-
}[]
|
|
528
|
-
// https://docs.mux.com/guides/video/minimize-processing-time
|
|
529
|
-
non_standard_input_reasons?: {
|
|
530
|
-
video_codec?: string
|
|
531
|
-
audio_codec?: string
|
|
532
|
-
video_gop_size?: 'high'
|
|
533
|
-
video_frame_rate?: string
|
|
534
|
-
video_resolution?: string
|
|
535
|
-
video_bitrate?: 'high'
|
|
536
|
-
pixel_aspect_ratio?: string
|
|
537
|
-
video_edit_list?: 'non-standard'
|
|
538
|
-
audio_edit_list?: 'non-standard'
|
|
539
|
-
unexpected_media_file_parameters?: 'non-standard'
|
|
540
|
-
test?: boolean
|
|
541
|
-
}
|
|
542
|
-
meta?: {
|
|
543
|
-
title?: string
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
export interface VideoAssetDocument {
|
|
548
|
-
_id: string
|
|
549
|
-
_type: 'mux.videoAsset'
|
|
550
|
-
_createdAt: string
|
|
551
|
-
_updatedAt?: string
|
|
552
|
-
status?: string
|
|
553
|
-
assetId?: string
|
|
554
|
-
playbackId?: string
|
|
555
|
-
filename?: string
|
|
556
|
-
thumbTime?: number
|
|
557
|
-
// Docs for what goes in `data` https://docs.mux.com/api-reference/video#tag/assets
|
|
558
|
-
data?: PartialDeep<MuxAsset>
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
export type Reference = {_type: 'reference'; _ref: string}
|
|
562
|
-
|
|
563
|
-
// @TODO add Reference, and ReferenceSchemaType in the generic
|
|
564
|
-
export type MuxInputProps = ObjectInputProps<{
|
|
565
|
-
asset?: Reference
|
|
566
|
-
}>
|
package/v2-incompatible.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const {showIncompatiblePluginDialog} = require('@sanity/incompatible-plugin')
|
|
2
|
-
const {name, version, sanityExchangeUrl} = require('./package.json')
|
|
3
|
-
|
|
4
|
-
export default showIncompatiblePluginDialog({
|
|
5
|
-
name: name,
|
|
6
|
-
versions: {
|
|
7
|
-
v3: version,
|
|
8
|
-
v2: '^1.1.8',
|
|
9
|
-
},
|
|
10
|
-
sanityExchangeUrl,
|
|
11
|
-
})
|