Mux
Mux as a planned MainSDK media driver for video transcoding and streaming - setup, main.yaml, works on files from any files driver, and swapping.
Mux is a hosted video service that transcodes uploads and streams them to any screen. It is listed as a planned driver behind media for media.video().transcode(). You would pick it when video is central to your app and you want adaptive streaming.
Interfaces it serves
Pick Mux in main.yaml for any of these. Your calls stay the same, and you can swap later.
mediaBuilding for 0.4Driver mux Mux
media:
driver: muxSwap to another provider
Before you start
- Create a Mux account and an environment for development and one for production.
- Create an access token for server calls and store it in your secrets manager.
Configure
media:
driver: muxHow the driver takes its access token (as a secret: reference) is not defined yet.
Use it
import { media } from "mainsdk/media";
export async function prepareVideo(videoId: string) {
return media.video(videoId).transcode(); // videoId from files.upload()
}Local development and testing
media ships in phase 2; its fake for createTestApp() from @mainsdk/testing and chaos.on("media", { outage: true }) arrive with its spec. Mux's separate environments keep test videos apart from production.
What MainSDK adds on top
- Location data stripped from video.
- Source videos stay in
files, owner-scoped, scanned and stored by yourfilesdriver.
See Images and video.
Limits and notes
- Planned driver, not in the spec yet;
mediais phase 2. - Works on files from any
filesdriver (ADR-0013). Whether Mux stays as amediadriver is not decided, becausemediahas no spec. - Check where Mux processes video against your MainSDK data region (US, EU or India).
Swap to or from it
media:
driver: mux # was getqrOriginals stay in files; transcoded copies held by Mux stay behind when you switch away.
FAQ
Can users upload video straight to Mux? No. Uploads go through files to the store you chose; importing a storage SDK in route code fails mainsdk check with MAIN-FILES-0010.
Should I use Mux today? media is phase 2 and has no spec, so the driver does not exist yet. Use the default getqr driver until it does.
Next
Open questions
Was this page helpful?