Skip to main content
Skip table of contents

Get thе list of media-url: Stream.GetMediaUrls

The method and parameters

Stream.GetMediaUrls is used to get the list of media-url. The media service returns a list of URLs for each specified stream, enabling playback in various formats. If a stream is not served by this server, false is returned for that stream. If a stream or DVR functionality is prohibited, false will be returned as the value for the corresponding URLs.

string Stream.GetMediaUrls (object camerasunsigned ttl)

object cameras REQUIRED – a list of streams for which URLs are requested.

unsigned ttl 3600 – the duration for which the playback URL is available.

POST /api/

JSON-RPC
JSON
{
    "jsonrpc": "2.0",
    "method": "Stream.GetMediaUrls",
    "params": {
        "cameras": {},
        "ttl": 3600
    },
    "id": 1
}
cURL
BASH
curl -k --request POST \
	--url 'https://your-domain/api/' \
	--header 'Content-Length: 140' \
	--header 'Content-Type: application/json' \
	--header 'Accept: application/json' \
	--header 'Authorization: Bearer <api-authorization-token>' \
	--header 'Content-Length: <data length>' \
	--data '{
    "jsonrpc": "2.0",
    "method": "Stream.GetMediaUrls",
    "params": {
        "cameras": {},
        "ttl": 3600
    },
    "id": 1
}'
PHP
PHP
$data = array (
  'jsonrpc' => '2.0',
  'method' => 'Stream.GetMediaUrls',
  'params' => 
  array (
    'cameras' => 
    (object) array(
    ),
    'ttl' => 3600,
  ),
  'id' => 1,
);
$context = stream_context_create([
	'ssl'=>['verify_peer' => false],
	'http' => [
		'method' => 'POST',
		'header' => "Content-Type: application/json\r
Accept: application/json\r
Authorization: Bearer <api-authorization-token>\r
Content-Length: <data length>",
		'content'=>json_encode($data)
	]
]);
$result = file_get_contents('https://your-domain/api/', false, $context);

200 OK

List of playback URL objects

JSON
{
    "camera-uid1-primary": false,
    "camera-uid2-primary": {
        "live-rtsp": "video live streaming via RTSP",
        "live-preview": "<generation of live preview in mp4>",
        "live-hls": "<video live streaming via HLS>",
        "live-fmp4": "<video live streaming via fMP4>",
        "dvr-rtsp": "<dvr playback via RTSP>",
        "dvr-preview": "<generation of dvr preview at the specified time, in mp4>",
        "dvr-hls": "<dvr playback via HLS>",
        "dvr-mp4": "<dvr playback via fMP4>",
        "archive-mp4": "<video live streaming via MP4>",
        "archive-tar": "<a link to download a raw dvr archive>"
    }
}

400 Bad Request

The JSON-RPC error

JSON
{
    "error": {
        "code": -32601,
        "message": "Method not found"
    }
}

500 Internal Server Error

The server error

JavaScript errors detected

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

If this problem persists, please contact our support.