Skip to main content
Skip table of contents

CreateStream

Creating and configuring a stream on the media server. If a request is sent with an existing stream identifier on the server, the stream will restart with new configuration parameters: the current connection with the source is terminated and a new one is established, the stream state and buffers are cleared.

POST /streams/{new-stream-uid}/
Body
json
JSON
{
    "primary-node": "node-host-1",
    "secondary-node": "node-host-2",
    "stream-enable": true,
    "stream-url": "rtsp://admin:admin@192.168.7.34:554/Streaming/Channels/101",
    "stream-proto": "rtsp,hls",
    "stream-tracks": "video,audio",
    "stream-limit": 0,
    "stream-access": "public",
    "stream-whitelist": "",
    "reconnect-numbers": 500,
    "reconnect-timeout": "10s",
    "reconnect-interval": "30m",
    "reconnect-invalid": 10,
    "dvr-enable": true,
    "dvr-archive": "/storage",
    "dvr-duration": "3d",
    "dvr-capacity": "10G",
    "dvr-chunk": "2m"
}
tokenrequired
string
API request authorization token. See Mediaserver/Web API/Authorization/CreateApiToken.
new-stream-uidoptional
uid
Unique identifier of the virtual camera {@hint:uid}.
stream-urlrequired
url
Connection URL for the stream or publishing URL for the stream. See Mediaserver/Configuration/Stream (stream.ini).
stream-tracksoptional
array
List of channels allowed to be captured, regardless of whether a channel exists in the stream or not.
stream-protooptional
array
Protocols allowed for clients to connect to the media server for viewing the stream.
stream-enableoptional
bool
Whether the media server is allowed or denied access to the stream (if denied, live and DVR playback and recording are unavailable).
dvr-enablerequired
enum
Allows or denies the server to record and store a copy of the stream.
dvr-archiverequired
path
Sets the root directory for storing DVR recordings.
dvr-durationrequired
seconds
Sets the duration of recording storage.
dvr-capacityrequired
bytes
Limits the amount of disk space for recordings. This parameter is for informational purposes only and does not impose physical restrictions.
dvr-chunkrequired
seconds
Sets the recording segment duration.
stream-accessrequired
string
Determines the type of authentication for clients connecting to view the stream.
stream-whitelistrequired
array
List of allowed IP addresses that can connect to view the stream.
stream-limitrequired
int
Limits the maximum number of concurrent client connections for viewing streams across all protocols.
reconnect-numbersoptional
int
Number of reconnection attempts. The limit of consecutive reconnection attempts to the stream, after which the media server marks the stream as unavailable and excludes it from further capture.
reconnect-timeoutoptional
seconds
Progressive time delay between reconnection attempts.
reconnect-intervaloptional
seconds
Maximum value of progressive delay between connections.
reconnect-invalidoptional
seconds

primary-nodeoptional
string
If cluster functionality is available, the parameter sets the primary stream capture node.
secondary-nodeoptional
string
If cluster functionality is available, the parameter sets the secondary (backup) stream capture node.
Response
200
Stream successfully created.
403
Authorization error. Invalid or missing API access token. See Mediaserver/Web API/Authorization/CreateApiToken.
Example
JSON
curl -k --location --request POST 'https://localhost:8080/streams/{new-stream-uid}/?token=string' \
--header 'Content-Type: application/json \
--data-raw '{
    "primary-node": "node-host-1",
    "secondary-node": "node-host-2",
    "stream-enable": true,
    "stream-url": "rtsp://admin:admin@192.168.7.34:554/Streaming/Channels/101",
    "stream-proto": "rtsp,hls",
    "stream-tracks": "video,audio",
    "stream-limit": 0,
    "stream-access": "public",
    "stream-whitelist": "",
    "reconnect-numbers": 500,
    "reconnect-timeout": "10s",
    "reconnect-interval": "30m",
    "reconnect-invalid": 10,
    "dvr-enable": true,
    "dvr-archive": "/storage",
    "dvr-duration": "3d",
    "dvr-capacity": "10G",
    "dvr-chunk": "2m"
}'
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.