Stream videos in five minutes | Mux

Stream videos in five minutes

Upload a video file to Mux and play it in your application in five minutes or less. Start here when you add video on demand, for example a course platform or user uploads.

In this guide:

  1. Get an API Access Token
  2. POST a video
  3. Wait for ready
  4. Watch your Video
  5. Manage your Mux assets

This quickstart shows the fastest path from a video file to playback with Mux. You create an access token, upload a video, and play it with a playback URL. Use this guide when you add video on demand to your application, for example a course platform or a UGC product.

1. Get an API Access Token

The Mux Video API uses a token key pair that consists of a Token ID and Token Secret for authentication. If you haven't already, generate a new Access Token in the Access Token settings of your Mux account dashboard.

You'll be presented with a form to create your new Access Token.

Now, click the Generate token button.

You'll be presented with your new Access Token ID and Secret Key.

Once you have your new Access Token ID and Secret Key, you're ready to upload your first video.

2. POST a video

Videos stored in Mux are called assets. To create your first video asset, you need to send a POST request to the /assets endpoint and set the input value to the URL of a video file that's accessible online.

Here are a few demo videos you can use that are stored on common cloud storage services:

To start making API requests to Mux, you might want to install one of our officially supported API SDKs. These are lightweight wrapper libraries that use your API credentials to make authenticated HTTP requests to the Mux API.

For an example of how to make API Requests from your local environment, see the Make API Requests guide.

The response will include an Asset ID and a Playback ID.

Mux does not store the original file in its exact form, so if your original quality files are important to you, don't delete them after submitting them to Mux.

3. Wait for ready

As soon as you make the POST request, Mux begins downloading and processing the video. For shorter files, this often takes just a few seconds. Very large files over poor connections may take a few minutes (or longer).

When the video is ready for playback, the asset status changes to ready. You should wait until the asset status is ready before you attempt to play the video.

The best way to be notified of asset status updates is via webhooks. Mux can send a webhook notification as soon as the asset is ready.

If you can't use webhooks for some reason, you can manually poll the asset API to see asset status. Note that this only works at low volume.

Try an example request

Enter the Asset ID from the API response:

Please don't poll this API more than once per second.

4. Watch your Video

To play back an asset, create a playback URL using the PLAYBACK_ID you received when you created the asset.

Preview in a player

See the playback guide for more information about how to integrate with a video player.

Preview with stream.new

Stream.new is an open source project by Mux that allows you to add a video and get a shareable link to stream it. Go to stream.new/v/{PLAYBACK_ID} to preview your video streaming.

After you have everything working, integrate Mux Data with your player for monitoring playback performance.

5. Manage your Mux assets

After you have assets created in your Mux environment, you may find some of these other endpoints handy:

More Video methods and descriptions are available at the API Docs.

Next Steps

Play your videos

Set up your iOS application, Android application or web application to start playing your Mux assets

Preview your video

Now that you have Mux assets, build rich experiences into your application by previewing your videos with Thumbnails and Storyboards

Integrate Mux Data

Add the Mux Data SDK to your player and start collecting playback performance metrics.