# Stream videos in five minutes
Upload and play back your video files in your application using Mux in five minutes or less.
## 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](https://dashboard.mux.com/settings/access-tokens) of your Mux account dashboard.

<Image src="/docs/images/settings-api-access-tokens.png" width={500} height={500} alt="Mux access token settings" />

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

<Image src="/docs/images/new-access-token.png" width={545} height={233} alt="Mux Video access token permissions" />

* **Access Tokens** belong to an **Environment** — a container for the various Access Tokens, Signing Keys, and assets that you'll come to add to Mux. For this guide, you can keep the **Production** environment selected.
* **Access Tokens** can have varying permissions to control what kinds of changes they have the ability to make. For this guide, your **Access Token** should have Mux Video **Read** and **Write** permissions.
* You can give your **Access Token** an internal-only name like "Onboarding" so you know where you've used it within your application.

Now, click the **Generate token** button.

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

<Image src="/docs/images/settings-generated-access-token.png" width={545} height={233} alt="Mux access token environment" />

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 <ApiRefLink href="/docs/api-reference/video/assets">assets</ApiRefLink>. To create your first video asset, you need to send a <ApiRefLink href="/docs/api-reference/video/assets/create-asset">POST request to the /assets endpoint</ApiRefLink> 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:

* Amazon S3: https://muxed.s3.amazonaws.com/leds.mp4
* Google Drive: https://drive.google.com/uc?id=13ODlJ-Dxrd7aJ7jy6lsz3bwyVW-ncb3v
* Dropbox: https://www.dropbox.com/scl/fi/l2sm1zyk6pydtosk3ovwo/get-started.mp4?rlkey=qjb34b0b7wgjbs5xj9vn4yevt\&dl=0

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.

```elixir

# mix.exs
def deps do
  [
    {:mux, "~> 1.8.0"}
  ]
end

```

```go

go get github.com/muxinc/mux-go

```

```node

# npm
npm install @mux/mux-node --save

# yarn
yarn add @mux/mux-node

```

```php

# composer.json
{
    "require": {
        "muxinc/mux-php": ">=0.0.1"
    }
}

```

```python

# Via pip
pip install git+https://github.com/muxinc/mux-python.git

# Via source
git checkout https://github.com/muxinc/mux-python.git
cd mux-python
python setup.py install --user

```

```ruby

gem 'mux_ruby'

```



<Callout type="info">
  For an example of how to make API Requests from your local environment, see the [Make API Requests](/docs/core/make-api-requests) guide.
</Callout>

<CodeExamples product="video" example="createAsset" />

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

* Asset IDs are used to manage assets using `api.mux.com` (e.g. to read or delete an asset).
* <ApiRefLink href="/docs/api-reference/video/playback-id">Playback IDs</ApiRefLink> are used to stream an asset to a video player through `stream.mux.com`. You can add multiple playback IDs to an asset to create playback URLs with different viewing permissions, and you can delete playback IDs to remove access without deleting the asset.

```json
{
  "data": {
    "status": "preparing",
    "playback_ids": [
      {
        "policy": "public",
        "id": "TXjw00EgPBPS6acv7gBUEJ14PEr5XNWOe"
      }
    ],
    "video_quality": "basic",
    "mp4_support": "none",
    "master_access": "none",
    "id": "01itgOBvgjAbES7Inwvu4kEBtsQ44HFL6",
    "created_at": "1607876845"
  }
}
```

<Callout type="info">
  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.
</Callout>

## 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. See the [webhooks guide](/docs/core/listen-for-webhooks) for details.

If you can't use webhooks for some reason, you can manually **poll** the <ApiRefLink href="/docs/api-reference/video/assets/get-asset">asset API</ApiRefLink> to see asset status. Note that this only works at low volume. Try this example:

## Try an example request

<CodeExamples product="video" example="retrieveAsset" />

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.

```curl
https://stream.mux.com/{PLAYBACK_ID}.m3u8
```

## Preview in a player

```android

implementation 'com.google.android.exoplayer:exoplayer-hls:2.X.X'

// Create a player instance.
SimpleExoPlayer player = new SimpleExoPlayer.Builder(context).build();
// Set the media item to be played.
player.setMediaItem(MediaItem.fromUri("https://stream.mux.com/{PLAYBACK_ID}.m3u8"));
// Prepare the player.
player.prepare();

```

```embed

<iframe
  src="https://player.mux.com/{PLAYBACK_ID}?metadata-video-title=Test%20video%20title&metadata-viewer-user-id=user-id-007"
  style="aspect-ratio: 16/9; width: 100%; border: 0;"
  allow="accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture;"
  allowfullscreen="true"
></iframe>

```

```html

<script src="https://cdn.jsdelivr.net/npm/@mux/mux-player" defer></script>

<mux-player
  playback-id="{PLAYBACK_ID}"
  metadata-video-title="Test video title"
  metadata-viewer-user-id="user-id-007"
></mux-player>

```

```react

import MuxPlayer from '@mux/mux-player-react';

export default function VideoPlayer() {
  return (
    <MuxPlayer
      playbackId="{PLAYBACK_ID}"
      metadata={{
        video_id: "video-id-54321",
        video_title: "Test video title",
        viewer_user_id: "user-id-007",
      }}
    />
  );
}

```

```swift

import SwiftUI
import AVKit

private let playbackURL: URL = {
    guard let url = URL(string: "https://stream.mux.com/{PLAYBACK_ID}.m3u8") else {
        preconditionFailure("Invalid playback URL")
    }
    return url
}()

struct ContentView: View {
    private let player = AVPlayer(url: playbackURL)

    var body: some View {
        // VideoPlayer comes from SwiftUI.
        VideoPlayer(player: player)
            .onAppear {
                player.play()
            }
    }
}

```



See the [playback guide](/docs/guides/play-your-videos) for more information about how to integrate with a video player.

## Preview with `stream.new`

[Stream.new](https://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. This URL is shareable and automatically generated using the video playback ID. Copy the link below and open it in a browser to view your video.

```
https://stream.new/v/{PLAYBACK_ID}
```

After you have everything working [integrate Mux Data](/docs/guides/track-your-video-performance) 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:

* <ApiRefLink href="/docs/api-reference/video/assets/create-asset">Create an asset</ApiRefLink>
* <ApiRefLink href="/docs/api-reference/video/assets/list-assets">List assets</ApiRefLink>
* <ApiRefLink href="/docs/api-reference/video/assets/get-asset">Retrieve an asset</ApiRefLink>
* <ApiRefLink href="/docs/api-reference/video/assets/delete-asset">Delete an asset</ApiRefLink>
* <ApiRefLink href="/docs/api-reference/video/assets/get-asset-input-info">Retrieve asset input info</ApiRefLink>
* <ApiRefLink href="/docs/api-reference/video/assets/create-asset-playback-id">Create asset playback ID</ApiRefLink>
* <ApiRefLink href="/docs/api-reference/video/assets/get-asset-playback-id">Retrieve asset playback ID</ApiRefLink>
* <ApiRefLink href="/docs/api-reference/video/assets/delete-asset-playback-id">Delete asset playback ID</ApiRefLink>
* <ApiRefLink href="/docs/api-reference/video/assets/update-asset-mp4-support">Update MP4 support on asset</ApiRefLink>
* <ApiRefLink href="/docs/api-reference/video/assets/update-asset-master-access">Update master access on asset</ApiRefLink>
* <ApiRefLink href="/docs/api-reference/video/assets/create-asset-track">Update asset track</ApiRefLink>
* <ApiRefLink href="/docs/api-reference/video/assets/delete-asset-track">Delete an asset track</ApiRefLink>

More Video methods and descriptions are available at the <ApiRefLink href="/docs/api-reference/video">API Docs</ApiRefLink>.

# Next Steps

<GuideCard
  title="Play your videos"
  description="Set up your iOS application, Android application or web application to start playing your Mux assets"
  links={[
    {title: "Read the guide", href: "/docs/guides/play-your-videos"},
  ]}
/>

<GuideCard
  title="Preview your video"
  description="Now that you have Mux assets, build rich experiences into your application by previewing your videos with Thumbnails and Storyboards"
  links={[
    {title: "Read the guide", href: "/docs/guides/get-images-from-a-video"},
  ]}
/>

<GuideCard
  title="Integrate Mux Data"
  description="Add the Mux Data SDK to your player and start collecting playback performance metrics."
  links={[
    {title: "Read the guide", href: "/docs/guides/track-your-video-performance"},
  ]}
/>
