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.
- package/README.md +36 -6
- package/{lib/index.d.cts → dist/index.d.mts} +9 -2
- package/{lib → dist}/index.d.ts +9 -2
- package/{lib/index.cjs → dist/index.js} +240 -140
- package/dist/index.js.map +1 -0
- package/{lib/index.js → dist/index.mjs} +242 -142
- package/dist/index.mjs.map +1 -0
- package/package.json +48 -44
- package/src/_exports/index.ts +4 -3
- package/src/components/TextTracksEditor.tsx +76 -173
- package/src/components/UploadConfiguration.tsx +23 -23
- package/src/components/VideoInBrowser.tsx +21 -2
- package/src/components/VideoPlayer.tsx +15 -2
- package/src/hooks/useImportMuxAssets.ts +7 -3
- package/src/schema.ts +181 -0
- package/src/util/constants.ts +2 -0
- package/src/util/generateJwt.ts +2 -2
- package/src/util/types.ts +10 -2
- package/lib/index.cjs.map +0 -1
- package/lib/index.esm.js +0 -4275
- package/lib/index.esm.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/src/schema.tsx +0 -42
package/README.md
CHANGED
|
@@ -181,17 +181,22 @@ export default function MuxVideo({playbackId, title}: {playbackId?: string; titl
|
|
|
181
181
|
|
|
182
182
|
💡 You can try these recommendations through the [Codesandbox example](https://codesandbox.io/s/github/sanity-io/sanity-plugin-mux-input/tree/main/example).
|
|
183
183
|
|
|
184
|
-
## Configuring Mux
|
|
184
|
+
## Configuring Mux Video uploads
|
|
185
185
|
|
|
186
186
|
### Signed URLs (private playbacks)
|
|
187
187
|
|
|
188
|
-
To enable [signed
|
|
188
|
+
To enable [signed URLs](https://docs.mux.com/docs/security-signed-urls) with content uploaded to Mux, you will need to check the "Enable Signed Urls" option in the Mux Plugin configuration. This feature requires you to set the API Access Token and Secret Key (as per the [Quick start](#quick-start) section).
|
|
189
189
|
|
|
190
|
-
|
|
190
|
+
📌 **Note**: When the signed URL option is triggered, the plugin will cache a `signingKeyPrivate` in a private document in the dataset. This key is used by Mux to sign the uploads, and if it's incorrect your uploads will fail. If that's the case, you can delete the secrets document and try again:
|
|
191
191
|
|
|
192
|
-
|
|
192
|
+
```bash
|
|
193
|
+
# Using the Sanity CLI, delete the secrets, then re-open the plugin and configure it again
|
|
194
|
+
sanity documents delete secrets.mux
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
More information on signed URLs is available on Mux's [docs](https://docs.mux.com/docs/headless-cms-sanity#advanced-signed-urls)
|
|
193
198
|
|
|
194
|
-
### MP4 support (downloadable videos)
|
|
199
|
+
### MP4 support (downloadable videos or offline viewing)
|
|
195
200
|
|
|
196
201
|
To enable [static MP4 renditions](https://docs.mux.com/guides/video/enable-static-mp4-renditions), add `mp4_support: 'standard'` to the `options` of your `mux.video` schema type.
|
|
197
202
|
|
|
@@ -205,6 +210,8 @@ export default defineConfig({
|
|
|
205
210
|
|
|
206
211
|
If MP4 support is enabled in the plugin's configuration, editors can still choose to enable MP4 renditions on a per-video basis when uploading new assets.
|
|
207
212
|
|
|
213
|
+
MP4 allows users to download videos for later or offline viewing. More information can be found on Mux's [documentation](https://docs.mux.com/guides/enable-static-mp4-renditions).
|
|
214
|
+
|
|
208
215
|
### Video resolution (max_resolution_tier)
|
|
209
216
|
|
|
210
217
|
To edit [max_resolution_tier](https://docs.mux.com/api-reference#video/operation/create-direct-upload) to support other resolutions other than 1080p, add `max_resolution_tier: '1080p' | '1440p' | '2160p'` to the `options` of your `mux.video` schema type. Defaults to `1080p`.
|
|
@@ -217,7 +224,7 @@ export default defineConfig({
|
|
|
217
224
|
})
|
|
218
225
|
```
|
|
219
226
|
|
|
220
|
-
When uploading new assets, editors can still choose a lower resolution for each video than configured globally.
|
|
227
|
+
When uploading new assets, editors can still choose a lower resolution for each video than configured globally. This option controls the maximum resolution encoded or processed for the uploaded video. The option is particularly important to manage costs when uploaded videos are higher than `1080p` resolution. More information on the feature is available on Mux's [docs](https://docs.mux.com/guides/stream-videos-in-4k). Also, read more on this feature announcement on Mux's [blog](https://www.mux.com/blog/more-pixels-fewer-problems-introducing-4k-support-for-mux-video).
|
|
221
228
|
|
|
222
229
|
### Encoding tier (smart or baseline)
|
|
223
230
|
|
|
@@ -233,6 +240,29 @@ export default defineConfig({
|
|
|
233
240
|
|
|
234
241
|
If `encoding_tier: 'smart'`, editors can still choose to use the `baseline` encoding tier on a per-video basis when uploading new assets.
|
|
235
242
|
|
|
243
|
+
More information on the feature is available on Mux's [documentation](https://docs.mux.com/guides/use-encoding-tiers). Also, read more on the feature announcement on Mux's [blog](https://www.mux.com/blog/our-next-pricing-lever-baseline-on-demand-assets-with-free-video-encoding)
|
|
244
|
+
|
|
245
|
+
### Auto-generated subtitles and captions
|
|
246
|
+
|
|
247
|
+
If you've enabled smart encoding, you can use Mux's [auto-generated subtitles](https://docs.mux.com/guides/video/auto-generated-subtitles) feature. Unless you pass `disableTextTrackConfig: true` to the configuration, users will be able to choose a language to auto-generate subtitles for uploaded videos. Refer to Mux's documentation for the list of supported languages.
|
|
248
|
+
|
|
249
|
+
You can also define a default language for the upload configuration form:
|
|
250
|
+
|
|
251
|
+
```js
|
|
252
|
+
import {muxInput} from 'sanity-plugin-mux-input'
|
|
253
|
+
|
|
254
|
+
export default defineConfig({
|
|
255
|
+
plugins: [
|
|
256
|
+
muxInput({
|
|
257
|
+
encoding_tier: 'smart',
|
|
258
|
+
defaultAutogeneratedSubtitleLang: 'en', // choose from one of the supported languages
|
|
259
|
+
}),
|
|
260
|
+
],
|
|
261
|
+
})
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
If your videos are always spoken in a specific language and you want to include captions by default, you can use `disableTextTrackConfig: true` together with `defaultAutogeneratedSubtitleLang` to transcribe captions for every uploaded asset without needing user interaction.
|
|
265
|
+
|
|
236
266
|
## Contributing
|
|
237
267
|
|
|
238
268
|
Issues are actively monitored and PRs are welcome. When developing this plugin the easiest setup is:
|
|
@@ -112,10 +112,17 @@ declare interface MuxInputConfig {
|
|
|
112
112
|
* Auto-generate captions for these languages by default.
|
|
113
113
|
* Requires `"encoding_tier": "smart"`
|
|
114
114
|
*
|
|
115
|
-
* @see {@link https://docs.mux.com/guides/
|
|
116
|
-
* @
|
|
115
|
+
* @see {@link https://docs.mux.com/guides/add-autogenerated-captions-and-use-transcripts}
|
|
116
|
+
* @deprecated use `defaultAutogeneratedSubtitleLang` instead. Only a single autogenerated
|
|
117
117
|
*/
|
|
118
118
|
defaultAutogeneratedSubtitleLangs?: SupportedMuxLanguage[]
|
|
119
|
+
/**
|
|
120
|
+
* Auto-generate captions for this language by default. Users can still
|
|
121
|
+
* Requires `"encoding_tier": "smart"`
|
|
122
|
+
*
|
|
123
|
+
* @see {@link https://docs.mux.com/guides/add-autogenerated-captions-and-use-transcripts}
|
|
124
|
+
*/
|
|
125
|
+
defaultAutogeneratedSubtitleLang?: SupportedMuxLanguage
|
|
119
126
|
/**
|
|
120
127
|
* Whether or not to allow content editors to override asset upload
|
|
121
128
|
* configuration settings when uploading a video to Mux.
|
package/{lib → dist}/index.d.ts
RENAMED
|
@@ -112,10 +112,17 @@ declare interface MuxInputConfig {
|
|
|
112
112
|
* Auto-generate captions for these languages by default.
|
|
113
113
|
* Requires `"encoding_tier": "smart"`
|
|
114
114
|
*
|
|
115
|
-
* @see {@link https://docs.mux.com/guides/
|
|
116
|
-
* @
|
|
115
|
+
* @see {@link https://docs.mux.com/guides/add-autogenerated-captions-and-use-transcripts}
|
|
116
|
+
* @deprecated use `defaultAutogeneratedSubtitleLang` instead. Only a single autogenerated
|
|
117
117
|
*/
|
|
118
118
|
defaultAutogeneratedSubtitleLangs?: SupportedMuxLanguage[]
|
|
119
|
+
/**
|
|
120
|
+
* Auto-generate captions for this language by default. Users can still
|
|
121
|
+
* Requires `"encoding_tier": "smart"`
|
|
122
|
+
*
|
|
123
|
+
* @see {@link https://docs.mux.com/guides/add-autogenerated-captions-and-use-transcripts}
|
|
124
|
+
*/
|
|
125
|
+
defaultAutogeneratedSubtitleLang?: SupportedMuxLanguage
|
|
119
126
|
/**
|
|
120
127
|
* Whether or not to allow content editors to override asset upload
|
|
121
128
|
* configuration settings when uploading a video to Mux.
|