Start live streaming | Mux

Start live streaming

Build live streaming into your application with the Mux live streaming API. Use this guide when you create your first live stream, broadcast with RTMP, and play it back.

In this guide:

  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. Generate a new Access Token in the settings of your Mux account dashboard.

  2. Create a unique Live Stream
    A Live Stream resource in Mux will be used to push live content via RTMP. Each live stream has a unique stream key.

  3. Start your broadcast
    Use any streaming app or hardware device that supports RTMP streaming.

  4. Playback your live stream
    Use the PLAYBACK_ID for the live stream to start playback in your application.

  5. Stop your broadcast
    Stop the broadcast from the streaming app or hardware.

  6. Manage your Mux Live streams
    Delete, update, and more live stream functionalities are available via the Video Live stream API methods.


Whether you’re looking to build “Twitch for X”, online classrooms, a news & sports broadcasting platform or something the world’s never seen before, the Mux Live Streaming API makes it easy to build live video into your own software. With a simple API call, you get everything you need to push a live stream and play it back at high quality for a global audience.

1. Get an API Access Token

For a guided example of how to make API Requests from your local environment, see the guide and watch this video tutorial: Make API Requests.

The access token should have Mux Video Read and Write permissions.

Access Tokens also belong to an Environment. Be sure to use the same Environment when using Mux Video and Mux Data together, so the data from Mux Data can be used to optimize your Mux Video streams.

2. Create a unique Live Stream

The Live Stream object in the Mux API is a record of a live stream of video that will be pushed to Mux. To create your first Live Stream, POST request to the /live-streams endpoint.

You can either replace ${MUX_TOKEN_ID} and ${MUX_TOKEN_SECRET} with your own access token details or make sure to export those environment variables with the correct values first.

The response will include a Playback ID and a Stream Key:

Important: The Stream Key should be treated as a private key for live streaming. Anyone with the key can stream video to the Live Stream it belongs to, so users must keep it safe.

Mux also allows you to set a few additional options on your live stream:

Option Description
"latency_mode": "reduced" Enables reduced latency for better performance.
"latency_mode": "low" Provides very low latency with varying results based on geographical location.
audio_only For audio specific use cases like podcasts.

3. Start your broadcast

Mux supports live streaming using the RTMP protocol, which most broadcast software supports. Your users or client app will need software that can push an RTMP stream, configured using the Stream Key from the prior step along with Mux's RTMP Server URL.

RTMP Server URL Description
rtmp://global-live.mux.com:5222/app Standard RTMP entry point compatible with most applications.
rtmps://global-live.mux.com:443/app Secure RTMPS entry point offering higher security.

Important: Mux's RTMP server URL uses port number 5222, not the standard 1935.

Broadcasting Webhooks

When a Streamer begins sending video and the Live Stream changes status, your application can respond by using Webhooks.

Event Description
video.live_stream.connected Broadcasting software/hardware successfully connected to Mux servers.
video.live_stream.recording Video is being recorded and prepared for playback.
video.live_stream.active Live Stream is now playable.
video.live_stream.idle Disconnect has occurred and recording is complete.

4. Playback your live stream

To play back a live stream, use the PLAYBACK_ID returned when creating the Live Stream along with stream.mux.com to create an HLS playback URL.

5. Stop your broadcast

When the Streamer is finished, they will stop the broadcast, disconnecting from the Mux servers.

6. Manage your Mux Live streams

After creating live streams in your Mux environment, you may find some handy endpoints:

Play your live stream

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

Integrate Mux Data

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