Login

Get started with live streaming

Starting a live stream is easy with FastPix. Once you've created it, you'll find numerous options to connect live video and kick off your broadcast.

This guide will walk you through setting up your live stream using FastPix API, followed by broadcasting with OBS.


Step 1: Get an API Access Token

The FastPix live streaming API utilizes a token key pair comprising a Token ID and Token Secret for authentication. If you haven't done so yet, create a new Access Token in the Access Token settings within your FastPix Organization dashboard.


Step 1: Get an API Access Token


As a next step, a pop-up will appear with a form to create your new Access Token.


Step 2: Create a live stream

  • Access Tokens are associated with an Environment which serves as a parent container for the different Access Tokens, Signing Keys, and assets you will be adding to FastPix. For this guide, you can stick with the Production environment.
  • Access Tokens come with varying permissions to regulate the types of changes they can make. While using this guide, ensure that your Access Token has FastPix Video Read and write permissions.

Step 2: Create a live stream

To create your first live streaming with FastPix, use the below API reference:

POST request to the /streams endpoint API

The username and password that you would use in the POST request can be replaced with your own access token details (Access Token ID and Secret Key) generated from the FastPix Organization dashboard.


curl -X POST 'https://v1.fastpix.io/live/streams'
   --user {Access Token ID}:{Secret Key} \
   -H 'Content-Type: application/json' \
   -d '{
   "playbackSettings": {
      "accessPolicy": "public"
   },
   "inputMediaSettings": {
      "maxResolution": "1080p",
      "reconnectWindow": 60,
      "mediaPolicy": "public",
      "metadata": {
         "livestream_name": "fastpix_livestream"
      },
      "enableDvrMode": false
   }
}'

You'll receive a Playback ID and a Stream Key in the response.


Playback IDs API in FastPix's Live Stream API work just like those for an Asset. They allow you to do things like play videos, grab images from a video, or make timeline hover previews with your player.

The Stream Key is a secret code. You can use it with FastPix's RTMP Server URL (check the table below) to set up RTMP streaming software.


PLEASE NOTE

The Stream Key should be handled as a confidential key for live streaming. If someone gets hold of it, they can stream video to the Live Stream it belongs to. It is necessary that you keep it safe. In case you lose control of a stream key, you have the option to either delete the Live Stream or reset the stream key using the API.


{
  "success": true,
  "data": {
    "streamId": "fa7f8c0950ea48ebcc5ef9de8c23deaa",
    "streamKey": "3dc5d7641f918baa083a5c52a5bd9cbckfa7f8c0950ea48ebcc5ef9de8c23deaa",
    "srtSecret": "c51739512d0088d98a46925c9b74c73akfa7f8c0950ea48ebcc5ef9de8c23deaa",
    "trial": false,
    "status": "idle",
    "maxResolution": "1080p",
    "maxDuration": 43200,
    "createdAt": "2024-10-15T08:48:31.551351Z",
    "reconnectWindow": 60,
    "enableRecording": true,
    "mediaPolicy": "public",
    "metadata": {
      "livestream_name": "fastpix_livestream"
    },
    "enableDvrMode": false,
    "playbackIds": [
      {
        "id": "4e43ec52-4775-4f68-a3ff-a57d8a59bba8",
        "accessPolicy": "public"
      }
    ],
    "srtPlaybackResponse": {
      "srtPlaybackStreamId": "playfa7f8c0950ea48ebcc5ef9de8c23deaa",
      "srtPlaybackSecret": "490e707dd4d165c9e38d261b252f9457kfa7f8c0950ea48ebcc5ef9de8c23deaa"
    }
  }
}


AUDIO ONLY

FastPix's live streams supports audio_only mode, which is great for scenarios focused solely on audio content. For example, you can use it to host live podcasts or broadcast radio shows. When you enable the audio_only option, FastPix will only process the audio track, ignoring any video track that may be included in the broadcast.


Let’s talk about response parameters:

status: It gives you the current live stream status.

  • idle signifies that there isn't a livestream in progress. (means stream not yet started)
  • active status indicates that a stream is currently in progress. (means your stream/video is getting streamed).
  • disabled it means that no more streams can be published. (means stream is stopped)

📘

PLEASE NOTE

Once the stream ends then automatically the status gets updated from active to idle and again if the stream starts then it changes to active. This happens till the stream duration is within the limits.

  • The status gets updated to disabled if the duration limit reaches.
  • The stream will no longer be accessible after it is disabled.

streamKey:

  • It is a string which is used to make the main live stream available for third-party live stream services.

createdAt:

  • It displays the UTC date-time when the live stream is created.

playbackId:

  • It is an array of playback ids for a live stream.

Step 3: Start broadcasting

FastPix enables live streaming using the RTMP protocol, which is widely supported by various broadcast software, hardware, and open-source software for mobile applications.

To start live streaming, you or your users need software capable of pushing an RTMP stream. This software will be configured using the Stream Key obtained earlier, along with FastPix's RTMP Server URL.


📘

PLEASE NOTE

At present, FastPix live streaming supports only RTMP protocol and not the RTMPS protocol.


RTMP server URL: rtmp://global-live.fastpix.com:5222/app

The above URL is the standard RTMP entry point to stream live with FastPix. This is compatible with almost every streaming applications and services.



The software you use for broadcasting will guide you on how to start and stop an RTMP session. Once you begin the session, the software will send live video to FastPix. At that point, the live stream status changes to active, showing that it's receiving the RTMP stream and ready to play using the Playback ID.


Live streaming webhooks

The moment someone begins streaming video and the live stream status changes, your application can respond using Webhooks. FastPix will send different related events. Depending on what kind of user experience you're aiming for, your application might take benefit from some of these events or might not if these events are not that relevant.

  • video.live_stream.created: A new live stream has been created. Broadcasters possessing a stream key can commence transmitting their encoder feed to this particular live stream.
  • video.live_stream.connected: The live stream is in a "connected" status for video live streaming, confirming that an encoder has established a successful connection to it.
  • video.live_stream.recording: The live stream's video recording is now in progress.
  • video.live_stream.active: The live stream is currently marked as "active," signifying that it is presently "live" and actively broadcasting.
  • video.live_stream.disconnected: When the stream is stopped, causing the encoder to become disconnected.
  • video.live_stream.idle: The live stream enters an "idle" state as there is no ongoing streaming activity.
  • video.asset.created: The live stream enters an "cretaed" state as there is no ongoing streaming activity.
  • video.live_stream.updated: The live stream has been either updated, or the stream key for this livestream has been reset.
  • video.live_stream.enabled: The live stream that was previously disabled has now been enabled.
  • video.live_stream.disabled: The live stream has been disabled, and if desired, it can be re-enabled. However, please note that test streams cannot be re-enabled.
  • video.live_stream.deleted: The live stream has been deleted.

Step 4: Play live stream

To watch a live stream, use the unique PLAYBACK_ID you received when setting up the live stream, along with stream.fastpix.net, to get the URL for playback using HTTP Live Streaming (HLS).


https://stream.fastpix.io/{PLAYBACK_ID}.m3u8

<script src="https://cdn.jsdelivr.net/npm/@fastpix/fp-player"></script>
                      
<fp-player 
 playbackId="{PLAYBACK_ID}"
 metadata-video-title="TEST VIDEO TITLE"
 metadata-viewer-user-id="user-id-123"
 metadata-video-id="qwe-we3r-23ew"
 stream-type="live">
</fp-player>


For step-by-step guidance on integrating with a video player, refer to the playback guide.

Once everything is set up, integrate FastPix Data into your player to keep track of how the playback is performing.


Step 5: Stop stream broadcasting

Streamers can stop the broadcast software to disconnect from the FastPix servers. If any reconnect_window time was given as input and the time runs out, then the live stream will change its status to idle.

Please note that, live streams automatically gets disconnected after 12 hours. For any specific scenarios or requirements where you need more than 12 hours live streams - Please contact us.


API endpoints to handle Live stream functions

FastPix has the following endpoints that helps you to broadcast live: