Skip to content

Support for Mux AI Workflows (@mux/ai): lifecycle hooks, webhooks, and audio static renditions #1105

Description

@ruymon

Is your feature request related to a problem? Please describe.
Not exactly.

Using sanity-plugin-mux-input to build an LMS platform. Want to run Mux AI workflows (@mux/ai, translateAudio) when a video is uploaded.

Goal:
Upload video in Sanity -> automatically generate dubbed audio tracks (multiple languages) -> attach them back to the same asset in Sanity.

Problem:

The plugin works well for upload + playback, but it is hard to build reliable post-processing workflows (like dubbing) on top of it.

Missing pieces:

  • No lifecycle hooks

    • No way to react when mux.videoAsset.status becomes "ready"
    • No hook when static renditions (especially audio) are ready
    • The plugin handles this internally via client-side polling
  • No server-side integration point

    • No built-in way to handle Mux webhooks (video.asset.ready, video.asset.static_rendition.ready)
    • No place to trigger downstream workflows like dubbing
  • AssetId exists but no trigger

    • assetId is stored in mux.videoAsset, but there is no clean event to act on it
  • AI prerequisites are not obvious

    • audio-only static rendition is supported
    • But not documented as required/best practice for @mux/ai translateAudio
  • Credentials gap (DX)

    • Plugin stores Mux creds in secrets.mux
    • @mux/ai supports runtime credentials, but no documented pattern to reuse secrets.mux. Leads to duplicated or unclear setup

Describe the solution you'd like
Not asking for full AI integration. Just need primitives to build on top.
Lifecycle hooks in plugin config:

onAssetReady(assetId, document)
onStaticRenditionReady(assetId, file)
  • credential reuse pattern

Expected outcome

  • Educator uploads video in Studio
  • System triggers dubbing automatically
  • Audio tracks are added to the same Mux asset (IN SANITY, NOT AN EXTERNAL S3)
  • Sanity reflects updated tracks
  • No extra UX for the educator
  • Clean DX

Alternatives considered

  • Sanity listener (client.listen). Works, but requires long-running process and no retries
  • Custom Mux webhook endpoint. Works, but disconnected from plugin and Studio state
  • Polling / cron. delayed

All work, none feel native


Would be useful to know if there are plans for better workflow hooks or examples around @mux/ai. Happy to contribute if there’s an open design.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions