Manage streams
When working with live streams, you would want to manage your streams, i.e,
- Retrieve details about them.
- Update your stream details.
- Delete your streams.
1. Get live stream details
You can get all the details about any live stream by sending a request with the streamId
. The response will display the current status of the live stream and fetch all necessary details if you intend to broadcast that specific live stream.
Request example to Get live stream by ID
curl -X GET 'https://v1.fastpix.io/live/streams?limit=10&offset=1&orderBy=desc' \
--user {Access token ID}:{Secret Key} \
-H 'accept: application/json'
Here's how the response looks like:
{
"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"
}
}
}
2. Update a live stream
To update details for a particular live stream, you would need the streamId
for your live stream. In your request you can update the values for reconnectWindow
and metadata
(title, description). It’s useful for making changes to a stream that has already been created but not yet ended. Once the live stream is disabled, you cannot update a stream.
reconnectWindow
: When broadcasting software for live streaming purposefully or because of network problems disconnects from FastPix, the Reconnect Window specifies how long FastPix will wait (in seconds) before concluding the recorded media and declaring the stream to be over. If no Reconnect Window is supplied, the API falls back to a 60-second window.
metadata
(object): Stores additional details about the live stream, such as its title, category, or any other relevant information.
The updated parameters and the streamId needs to be shared in the request, and FastPix will return the updated stream details. Once updated, video.live_stream.updated webhook
event notifies your system.
Here’s is a request example for updating a stream by ID
curl -X PATCH 'https://v1.fastpix.io/live/streams/{streamId}' \
--user {Access Token ID}:{Secret Key} \
-H 'Content-Type: application/json' \
-d '{
"metadata": {
"livestream_name": "Gaming_stream"
},
"reconnectWindow": 100
}'
3. Delete a live stream
You can also delete a live stream by sending in a DELETE request to the delete a stream API using the streamId
for the live stream. The request example looks like this:
curl -X DELETE 'https://v1.fastpix.io/live/streams/{streamId}' \
--user {Access Token ID}:{Secret Key} \
Updated about 7 hours ago