Skip to content

Commit

Permalink
fix: single autogenerated subtitle, better GraphQL support, proper au…
Browse files Browse the repository at this point in the history
…dio file previews, improved documentation (#366)

* chore: migrate to plugin-kit@4.0.13

* docs: note on autogenerated subtitles

* fix(useImportMuxAssets): handle assets without playbackIds

* chore: upgrade example dependencies

* fix: properly annotate schema for GraphQL

* fix: better render audio previews

* feat: only enable one auto-generated caption

* chore: update plugin version

* chore(prettier): 🤖 ✨

* fix(example): use plugin's published version

Co-authored-by: Cody Olsen <81981+stipsan@users.noreply.github.com>
Signed-off-by: henrique doro <opensource@hdoro.dev>

---------

Signed-off-by: henrique doro <opensource@hdoro.dev>
Co-Authored-By: hdoro <hdoro@users.noreply.github.com>
Co-Authored-By: Cody Olsen <81981+stipsan@users.noreply.github.com>
  • Loading branch information
3 people committed Jun 6, 2024
1 parent d6e5a97 commit 594e999
Show file tree
Hide file tree
Showing 24 changed files with 17,800 additions and 5,027 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ yalc.lock

# Compiled plugin
lib
dist

.env
.env.local
Expand Down
32 changes: 30 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,16 @@ export default function MuxVideo({playbackId, title}: {playbackId?: string; titl

### Signed URLs (private playbacks)

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. Assuming that the API Access Token and Secret Key are set (as per the [Quick start](#quick-start) section).
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).

More information on this feature is available on Mux's [docs](https://docs.mux.com/docs/headless-cms-sanity#advanced-signed-urls)
📌 **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:

```bash
# Using the Sanity CLI, delete the secrets, then re-open the plugin and configure it again
sanity documents delete secrets.mux
```

More information on signed URLs is available on Mux's [docs](https://docs.mux.com/docs/headless-cms-sanity#advanced-signed-urls)

### MP4 support (downloadable videos or offline viewing)

Expand Down Expand Up @@ -235,6 +242,27 @@ If `encoding_tier: 'smart'`, editors can still choose to use the `baseline` enco

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)

### Auto-generated subtitles and captions

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.

You can also define a default language for the upload configuration form:

```js
import {muxInput} from 'sanity-plugin-mux-input'

export default defineConfig({
plugins: [
muxInput({
encoding_tier: 'smart',
defaultAutogeneratedSubtitleLang: 'en', // choose from one of the supported languages
}),
],
})
```

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.

## Contributing

Issues are actively monitored and PRs are welcome. When developing this plugin the easiest setup is:
Expand Down
Loading

0 comments on commit 594e999

Please sign in to comment.